如何从tikz ER图中删除属性?

时间:2018-03-20 09:13:22

标签: latex entity-relationship tikz

我正在使用VMC上的一个项目,我需要在其中展示代码的结构。我尝试使用ER图,但我无法从实体中删除最后一个属性。代码如下所示

\usepackage{tikz}
\usetikzlibrary{er,positioning}

-

\begin{tikzpicture}[auto,node distance=1.5cm]
  \node[entity] (node1) {VMC}
    %[grow=down,sibling distance=4cm]
    child {node[attribute] {Attribute 1}};
  \node[entity] (node2) [below right = of node1] {WF};
  \node[entity] (node3) [below left = of node1] {Main};
  \node[entity] (node4) [below right = of node3] {GD};
  \node[relationship] (rel1) [above = of node4, below = of node1] {Tools};

  \path (node1) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
  \path (node4) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
\end{tikzpicture}

,图表如下所示

enter image description here

这是我想要的,但我想删除属性框并将工具框移动到中心。希望有人可以帮助我,我是tikz的新手。

1 个答案:

答案 0 :(得分:1)

据我所知,您只需删除相应的Attribute 1代码,并添加rel1node1的距离:

\begin{tikzpicture}[auto,node distance=1.5cm]
  \node[entity] (node1) {VMC}
    %[grow=down,sibling distance=4cm]
    child {};
  \node[entity] (node2) [below right = of node1] {WF};
  \node[entity] (node3) [below left = of node1] {Main};
  \node[entity] (node4) [below right = of node3] {GD};
  \node[relationship] (rel1) [below=1cm of node1] {Tools};

  \path (node1) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
  \path (node4) edge node {} (node2)
                edge node {} (node3)
                edge node {} (rel1);
\end{tikzpicture}

enter image description here