\documentclass[tikz]{standalone} \usepackage{fontspec} \setmainfont{Liberation Serif} \setsansfont{Liberation Sans} \begin{document} \usetikzlibrary{er} \usetikzlibrary{calc} \begin{tikzpicture} [ text depth=1pt, every attribute/.style={fill=black!20,draw=black}, every entity/.style={fill=blue!20,draw=blue,thick}, every relationship/.style={fill=orange!20,draw=orange,thick,aspect=1.5} ] \node[entity] (student) at (6,3) {Студент} child {node [attribute] at ($(student)+(-0.5,+1.5)$) {Корпоративная почта}} child {node [attribute] at ($(student)+(+3.0,+1.5)$) {Имя}} child {node [attribute] at ($(student)+(+3.0,+0.5)$) {Отчество}} child {node [attribute] at ($(student)+(+3.0,-0.5)$) {Фамилия}}; \node[entity] (teacher) at (0,-3) {Преподаватель} child {node [attribute] at ($(teacher)+(-2.5,+1.5)$) {Фамилия}} child {node [attribute] at ($(teacher)+(-2.5,+0.5)$) {Имя}} child {node [attribute] at ($(teacher)+(-2.5,-0.5)$) {Отчество}} child {node [attribute] at ($(teacher)+(-1.5,-1.5)$) {Корпоративная почта}}; \node[entity] (group) at (0,3) {Группа} child {node [attribute] at ($(group)+(0,1.5)$) {Обозначение}}; \node[entity] (lab) at (6,0) {Лабораторная работа} child {node [attribute] at ($(lab)+(3,0)$) {Название}}; \node[entity] (subject) at (6,-3) {Предмет} child {node [attribute] at ($(subject)+(0,-1.5)$){Название}}; \node[relationship] (assigns) at (0,0) {Назначает} child {node [attribute] at ($(assigns)+(-2.5,0)$){Срок}} edge node[right] {N} (teacher) edge node[above] {N} (lab) edge node[right] {N} (group); \node[relationship] at (6,-1.5) {По} edge node[right] {N} (lab) edge node[right] {1} (subject); %% \node[relationship] (assigned) at (5,+1.5) {Назначена} %% child {node [attribute] at ($(assigned)+(3,0)$){Срок}} %% edge node[right] {N} (lab) %% edge node[right] {N} (group); \node[relationship] at (3,3) {Входит в} edge node[above] {N} (student) edge node[above] {1} (group); \node[relationship] at (6,1.5) (attempted) {Сдавал} child {node [attribute] at ($(attempted)+(-2,0)$){Дата}} child {node [attribute] at ($(attempted)+(+2.5,0)$){Оценка}} edge node[right] {N} (student) edge node[right] {N} (lab); \end{tikzpicture} \end{document} %% Local Variables: %% compile-command: "xelatex erd.tex" %% End: