Регулировка размера узла взаимосвязи ER-диаграммы

Регулировка размера узла взаимосвязи ER-диаграммы

Я пытаюсь (безуспешно) уменьшить размер взаимосвязи CONTRACTED_Byв этой ER-модели, используяtikz-er2упаковка. Он естественным образом масштабирует высоту с шириной, но я бы предпочел, чтобы высота была короче. Есть ли способ этого добиться? (Извините, это не так минимально, как могло бы быть, но я решил повторить фигуру, которая у меня есть.)

\documentclass[12pt]{article}
\usepackage{tikz,tikz-er2}

\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[node distance=1.5cm]
\tikzset={every entity/.style = {minimum width=1cm,minimum height=0.8cm, text width=1cm,inner sep=1pt},
every attribute/.style = {minimum width=1.2cm,minimum height=0.5cm, text width=1.2cm,inner sep=1pt},
every relationship/.style = {minimum width=1.2cm,minimum height=0.5cm, text width=1.2cm,inner sep=1pt},
every edge/.style = {link}
}

\node[entity] (worker) {WORKER};
\node[attribute] (w1) [above left=1cm of worker,xshift=1cm] {\uline{Number}} edge (worker);
\node[attribute] (w2) [above right=1cm of worker,xshift=-1cm] {Name} edge (worker);
\node[attribute] (w3) [below left=1cm of worker,xshift=1cm] {Title} edge (worker);
\node[attribute] (w4) [below right=1cm of worker,xshift=-1cm] {Salary} edge (worker);

\node[relationship] (worksin) [right=of worker] {WORKS\_IN} edge node[above right] {N} (worker);
\node[attribute] (wn1) [above=of worksin,yshift=-0.5cm] {Responsibility} edge (worksin);
\node[attribute] (wn2) [below=of worksin,yshift=0.5cm] {Duration} edge (worksin);

\node[entity] (project) [right=of worksin] {PROJECT} edge node[above left] {1} (worksin);
\node[attribute] (p1) [above left=1cm of project,xshift=1cm] {\uline{Number}} edge (project);
\node[attribute] (p2) [above=of project] {Project\\Name} edge (project);
\node[attribute] (p3) [above right=1cm of project,xshift=-1cm] {Budget} edge (project);
\node[attribute] (p4) [right= of project] {Location} edge (project);

\node[relationship] (contract) [below=of project] {CONTRACTED\_BY} edge node[above right] {N} (project);
\node[attribute] (c1) [below left=of contract] {Contract\\number} edge (contract);

\node[entity] (client) [below=of contract] {CLIENT} edge node[above right] {1} (contract);
\node[attribute] (cl1) [below left=1cm of client, xshift=1cm] {\uline{Client name}} edge (client);
\node[attribute] (cl2) [below right=1cm of client, xshift=-1cm] {Address} edge (client);

\end{tikzpicture}

\end{document}

введите описание изображения здесь

решение1

Вы можете изменить aspectсоотношение этого узла с помощью aspectключа. По умолчанию в стиле он установлен на 1. Здесь я изменил его на 2.

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-er2}

\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[node distance=1.5cm]
\tikzset={every entity/.style = {minimum width=1cm,minimum height=0.8cm, text width=1cm,inner sep=1pt},
every attribute/.style = {minimum width=1.2cm,minimum height=0.5cm, text width=1.2cm,inner sep=1pt},
every relationship/.style = {minimum width=1.2cm,minimum height=0.5cm, text width=1.2cm,inner sep=1pt},
every edge/.style = {link}
}

\node[entity] (worker) {WORKER};
\node[attribute] (w1) [above left=1cm of worker,xshift=1cm] {\uline{Number}} edge (worker);
\node[attribute] (w2) [above right=1cm of worker,xshift=-1cm] {Name} edge (worker);
\node[attribute] (w3) [below left=1cm of worker,xshift=1cm] {Title} edge (worker);
\node[attribute] (w4) [below right=1cm of worker,xshift=-1cm] {Salary} edge (worker);

\node[relationship] (worksin) [right=of worker] {WORKS\_IN} edge node[above right] {N} (worker);
\node[attribute] (wn1) [above=of worksin,yshift=-0.5cm] {Responsibility} edge (worksin);
\node[attribute] (wn2) [below=of worksin,yshift=0.5cm] {Duration} edge (worksin);

\node[entity] (project) [right=of worksin] {PROJECT} edge node[above left] {1} (worksin);
\node[attribute] (p1) [above left=1cm of project,xshift=1cm] {\uline{Number}} edge (project);
\node[attribute] (p2) [above=of project] {Project\\Name} edge (project);
\node[attribute] (p3) [above right=1cm of project,xshift=-1cm] {Budget} edge (project);
\node[attribute] (p4) [right= of project] {Location} edge (project);

\node[relationship,aspect=2] (contract) [below=of project,] {CONTRACTED\_BY} edge node[above right] {N} (project);
\node[attribute] (c1) [below left=of contract] {Contract\\number} edge (contract);

\node[entity] (client) [below=of contract] {CLIENT} edge node[above right] {1} (contract);
\node[attribute] (cl1) [below left=1cm of client, xshift=1cm] {\uline{Client name}} edge (client);
\node[attribute] (cl2) [below right=1cm of client, xshift=-1cm] {Address} edge (client);

\end{tikzpicture}

\end{document}

вывод кода

решение2

Я не могу скомпилировать ваш код, так как мне не хватает tikz-er2, но, глядя на ваш код, ячейка "CONTRACTED_BY" больше из-за длины текста. Я бы предположил, что если бы вы уменьшили размер текста, ячейка тоже стала бы меньше. Вы можете попробовать следующее:

\node[relationship] (contract) [below=of project] {\small CONTRACTED\_BY} edge node[above right] {N} (project);

Связанный контент