18

I'm draw a TikZ figure, but I came across two problems. First one is that all the nodes have the different size due to the size of the text inside the nodes. I read in some other question here, that to make them equal is to specify minimum size, but this doesn't seem to work for me. I have something like this:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,calc,positioning}

\begin{document}

\begin{figure}[H]
    \centering
    \begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm,scale=1, transform shape,align=center,minimum size=3em]

    \node[state]    (MP)                                {more \\points};  
    \node[state]    (BP)    [right=of MP]               {better \\pointers};
    \node[state]    (GS)    [below=of $(MP)!0.5!(BP)$]  {game \\signal};
    \node[state]    (SO)    [below left=of GS]          {stressed \\out};
    \node[state]    (CO)    [below right=of GS]         {contribute};
    \node[state]    (GT)    [below=of $(SO)!0.5!(CO)$]  {great \\time};

    \path[->] (MP) edge node {} (GS)
              (BP) edge node {} (GS)
              (GS) edge node {} (SO)
              (GS) edge node {} (CO)
              (SO) edge node {} (GT)
              (CO) edge node {} (GT);

    \end{tikzpicture}
\end{figure}

\end{document}

I simply want all the nodes to have the same size, of course this depends on the node with the biggest text. But how can I achieve this?

Also my current figure is not that symmetric. stressed out node should be aligned with more points, and contribute should be aligned with better pointers. But they are a bit further left and right, respectively. Any idea how to align them too?

2 Answers 2

20

You just need to fix a minimum size large enough, but applied to state, not to the tikzpicutre:

    state/.style={circle, draw, minimum size=2cm}

The symmetry can be obtained changing the drawing order:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,calc,positioning}

\begin{document}

\begin{figure}%[H]
    \centering
    \begin{tikzpicture}[>=stealth', shorten >=1pt, auto,
    node distance=2.5cm, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state]    (MP) {more \\points};  
    \node[state, below right=of MP] (GS) {game \\signal};
    \node[state, above right=of GS] (BP) {better \\pointers};
    \node[state, below left=of GS] (SO) {stressed \\out};
    \node[state, below right=of GS] (CO) {contribute};
    \node[state, below right=of SO] (GT) {great \\time};

    \path[->] (MP) edge node {} (GS)
              (BP) edge node {} (GS)
              (GS) edge node {} (SO)
              (GS) edge node {} (CO)
              (SO) edge node {} (GT)
              (CO) edge node {} (GT);

    \end{tikzpicture}
\end{figure}

\end{document}

enter image description here

8

you can use minimum size=6em

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,calc,positioning}

\begin{document}

\tikzset{bignode/.style={red, draw=blue, fill=yellow!20, minimum size=6em,}}


{
    \centering
    \begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm,scale=1, transform shape,align=center,minimum size=3em]

    \node[state,bignode]     (MP)                                {more \\points};  
    \node[state,bignode]     (BP)    [right=of MP]               {better \\pointers};
    \node[state,bignode]     (GS)    [below=of $(MP)!0.5!(BP)$]  {game \\signal};
    \node[state,bignode]     (SO)    [below left=of GS]          {stressed \\out};
    \node[state,bignode]     (CO)    [below right=of GS]         {contribute};
    \node[state,bignode]     (GT)    [below=of $(SO)!0.5!(CO)$]  {great \\time};

    \path[->] (MP) edge node {} (GS)
              (BP) edge node {} (GS)
              (GS) edge node {} (SO)
              (GS) edge node {} (CO)
              (SO) edge node {} (GT)
              (CO) edge node {} (GT);

    \end{tikzpicture}

}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .