我在学校学习使用 LaTeX 完成我的期末项目。现在,我进入了流程图制作部分。我可以制作一个简单的框图,比如输入输出过程,但当我尝试制作更复杂的框图时,我发现自己遇到了麻烦。其中一个如下所示。
你能帮我解决这个问题吗?任何帮助我都会很感激。提前谢谢。
这是我制作的简单代码图,我猜它仍然是错误的
\documentclass[tikz,margin=2mm]{standalone}
\usetikzlibrary{trees,arrows}
\begin{document}
\tikzset{block/.style={rectangle, draw, text width=15mm, text centered,
minimum height=4em}, line/.style={draw, -latex'}}
\tikzstyle{level 1}=[level distance=30mm, sibling distance=30mm]
\tikzstyle{level 2}=[level distance=30mm, sibling distance=15mm]
\tikzstyle{level 3}=[level distance=20mm]
\begin{tikzpicture}[grow=right,->,>=angle 60]
%\begin{scope}[yshift=0]
\node [block] {Datang}
child {node [block] {Loket 3 Fasilitas Pelayanan Tahap 1}
child {node[block]{Loket 3 Fasilitas Pelayanan Tahap 2}
child[-] {node{}}
}
}
child {node[block] {Loket 2 Fasilitas Pelayanan Tahap 1}
child {node[block]{Loket 2 Fasilitas Pelayanan Tahap 2}
child[-] {node{}}
}
}
child {node[block] {Loket 1 Fasilitas Pelayanan Tahap 1}
child {node[block]{Loket 1 Fasilitas Pelayanan Tahap 2}
child[-] {node{}}
}
};
%\end{scope}
\end{tikzpicture}
\end{document}
答案1
您快到了。
\documentclass[tikz,margin=3.14mm]{standalone}
\usetikzlibrary{trees,arrows,positioning}
\begin{document}
\tikzset{block/.style={rectangle, draw, text width=15mm, text centered,
minimum height=4em}, line/.style={draw, -latex'}}
\tikzset{level 1/.style={level distance=30mm, sibling distance=30mm},
level 2/.style={level distance=30mm, sibling distance=15mm},
level 3/.style={level distance=20mm}}
\begin{tikzpicture}[grow=right,->,>=angle 60]
\node [block] {Datang}
child {node [block] {Loket 3 Fasilitas Pelayanan Tahap 1}
child {node[block] (C1){Loket 3 Fasilitas Pelayanan Tahap 2}
}
}
child {node[block] {Loket 2 Fasilitas Pelayanan Tahap 1}
child {node[block] (C2) {Loket 2 Fasilitas Pelayanan Tahap 2}
}
}
child {node[block] {Loket 1 Fasilitas Pelayanan Tahap 1}
child {node[block] (C3) {Loket 1 Fasilitas Pelayanan Tahap 2}
}
};
\node[block,right=1.5cm of C2] (D1) {final node};
\foreach \X in {1,2,3}
{\draw (C\X) -- (D1);}
\end{tikzpicture}
\end{document}