TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I drawed a picture like a process flow, However, I found the line between two tuples is too short as seen in the following image.

enter image description here

How to make the line longer? Here is the code:

\tikzset{level 1/.style={level distance=0.7cm, sibling distance=3cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=6cm}}

\tikzset{bag/.style={text width=20em, text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth]
    child{ edge from parent node[right]{}; \node[bag]{$S_1{:}(R_{good}\sq P,true,DS)$}
            child{ edge from parent node[right]{}; \node[bag]{$S_2{:}(and)$}
                    child{ edge from parent node[right=0.1cm]{$[else]$}; \node[bag]{$S_3{:}(A_1,true,DS)$}
                        child{edge from parent node[right=0.1cm]{};\node[bag]{$S_5{:}(P_1,true,DS)$}
                           child{edge from parent node[right=0.1cm]{$ $};\node[bag]{$S_7{:}(or)$}
                              child{edge from parent node[right=0.1cm]{};\node[bag]{$S_8{:}(A_2, FS{>}1,1)$}
                                 child{edge from parent node[right=0.1cm]{};\node[bag]{$S_{10}{:}(P_2,FS{>}1,DS{+}1)$}
                                    child{edge from parent node[right=0.1cm]{$$};\node[bag]{$S_{12}{:}(or)$}
                              child{edge from parent node[right=0.15cm]{};\node[bag]{$S_9{:}(R_{good},0{<}FS{<}1,DS{+}FS)$}
                                child{edge from parent node[right=0.1cm]{};\node[bag]{$S_{11}{:}(Stop,0{<}FS{<}1,DS{+}FS)\tick$}
                    child{ edge from parent node[right=0.9cm]{$[if]$}; \node[bag]{$S_4{:}(R_{good}\sq  P,true,DS)$}
                        child{edge from parent node[right=0.1cm]{$\lreply \_ User$};\node[bag]{$S_6{:}(Stop,K_{DS\land FS\land PS},DS)\tick$}
share|improve this question
Don't specify text width=20em. That tells TikZ to assume that the text in each node has a width of 20em, regardless of the actual content of the node. This width is then used to determine where the connecting lines start. – Jake Aug 16 '12 at 5:24
Thanks, it works – sweetyBaby Aug 16 '12 at 6:06
@sweetyBaby Your code is incomplete and it does not compile ! I don't understand why you use a tree in this case, there are simpler ways. – Alain Matthes Aug 16 '12 at 6:14

Would this be something you're looking for?




\node (n1) {math 1};
\node[below=1cm of n1] (n2) {math 2};
\node[below=3.5cm of n2] (n3) {math 3};
\node[below=1cm of n3] (n4) {math 4};
\node[below=1cm of n4] (n5) {math 5};
\node[below=3.5cm of n5] (n6) {math 6};
\node[below=1cm of n6] (n7) {math 7};
\node[below=1cm of n7] (n8) {math 8};
\node[below=1cm of n8] (n9) {math 9};

\node[xshift=2,below right=1cm of n2] (n21) {sidemath 21};
\node[below=1cm of n21] (n22) {sidemath 22};
\node[xshift=2,below right=1cm of n5] (n51) {sidemath 51};
\node[below=1cm of n51] (n52) {sidemath 52};

\foreach \x [evaluate=\x as \i using int(\x+1)] in {1,...,8}
{   \draw[-stealth] (n\x) -- (n\i);
\draw[-stealth] (n2) -- (n21);
\draw[-stealth] (n21) -- (n22);
\draw[-stealth] (n5) -- (n51);
\draw[-stealth] (n51) -- (n52);



enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.