Anpassung der Knotengröße im ER-Diagramm

Anpassung der Knotengröße im ER-Diagramm

Ich versuche (erfolglos), die Größe der CONTRACTED_ByBeziehung in diesem ER-Modell zu reduzieren, indem ichtikz-er2Paket. Die Höhe skaliert natürlich mit der Breite, aber ich hätte lieber eine geringere Höhe. Gibt es eine Möglichkeit, das zu erreichen? (Tut mir leid, das ist nicht so minimal, wie es sein könnte, aber ich habe mich entschieden, die Figur, die ich habe, nachzubilden.)

\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}

Bildbeschreibung hier eingeben

Antwort1

aspectSie können das Verhältnis dieses Knotens mit der Taste ändern aspect. Standardmäßig ist es im Stil auf eingestellt 1. Hier habe ich es auf geändert 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}

Ausgabe des Codes

Antwort2

Ich kann Ihren Code nicht kompilieren, da mir tikz-er2 fehlt, aber wenn ich mir Ihren Code ansehe, ist das Feld „CONTRACTED_BY“ aufgrund der Textlänge größer. Ich nehme an, wenn Sie die Textgröße reduzieren, wäre das Feld auch kleiner. Sie können Folgendes versuchen:

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

verwandte Informationen