如何使两个元组之间的线更长?

如何使两个元组之间的线更长?

我画了一幅类似过程流的图,但是,我发现两个元组之间的线太短,如下图所示。

在此处输入图片描述

如何让这条线更长?代码如下:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\resizebox{.5\textwidth}{!}{
\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]
\node[bag]{$S_0){:}(B,true,0)$}
    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[missing]
                    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[missing]
                              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$}
                        }
                    }
            }
    };
\end{tikzpicture}}
\end{document}

答案1

这就是您所寻找的东西吗?

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}

\begin{document}

\begin{tikzpicture}

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

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容