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);

関連情報