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

관련 정보