我只是想用 LaTeX 制作任何框图,但我遇到了一个麻烦,我不知道如何制作节点的子节点,
我想要的只是将名为“Antrian”的框移动到红色位置,并将其下方的两个框作为其子节点。
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows, arrows.meta, calc, positioning}
\begin{document}
\pagestyle{empty}
% Define block styles
\tikzstyle{block} = [rectangle, draw,
text width=22mm, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (operasional) {Operasional};
\node [block, right of=operasional, node distance = 3cm] (proses) {Proses};
\node[block, right of= proses, node distance = 3cm] (antrian){Antrian};
\node[block, below of= antrian] (kasir){Jumlah kasir yang beroperasi};
\node[block, right of=kasir, node distance = 3cm](kedatangan){Rata-rata tingkat kedatangan};
\coordinate[below = of $(kasir.south)!0.5!(kedatangan.south)$](temp1);
\node[block, below of = temp1, node distance =3cm] (kinerja) {Kinerja};
\node[block,left of= kinerja, node distance = 3cm](pelayanan){Pelayanan yang optimal};
% Draw edges
\path [line] (operasional) -- (proses);
\path[line] (proses) -- (antrian);
\path [line] (antrian.south) -| (kasir);
\path [line] (antrian.south) -| (kedatangan);
\path [line] (kinerja) -- (pelayanan);
\draw (kasir.south) |- (temp1) -| (kedatangan);
\draw[-Latex] (temp1) -- (kinerja);
\end{tikzpicture}
\end{document}
我真的需要你的帮助,非常感谢
答案1
欢迎使用 TeX.SE!您正在加载但未使用positioning
。我也\tikzstyle
用相应的\tikzset
语法替换了。
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows, arrows.meta, calc, positioning}
\begin{document}
\pagestyle{empty}
% Define block styles
\tikzset{block/.style={rectangle, draw,
text width=22mm, text centered, rounded corners, minimum height=4em},
line/.style={draw, -latex'}}
\begin{tikzpicture}[node distance = 1.5cm, auto]
% Place nodes
\node [block] (operasional) {Operasional};
\node [block, right=of operasional] (proses) {Proses};
\node[block, right=of proses] (antrian){Antrian};
\node[block, below left=of antrian] (kasir){Jumlah kasir yang beroperasi};
\node[block, below right=of antrian](kedatangan){Rata-rata tingkat kedatangan};
\coordinate[below = of $(kasir.south)!0.5!(kedatangan.south)$](temp1);
\node[block, below of = temp1, node distance =3cm] (kinerja) {Kinerja};
\node[block,left=of kinerja](pelayanan){Pelayanan yang optimal};
% Draw edges
\path [line] (operasional) -- (proses);
\path[line] (proses) -- (antrian);
\path [line] (antrian.south) -- ++(0,-0.5) -| (kasir);
\path [line] (antrian.south) -- ++(0,-0.5) -| (kedatangan);
\path [line] (kinerja) -- (pelayanan);
\draw (kasir.south) |- (temp1) -| (kedatangan);
\draw[-Latex] (temp1) -- (kinerja);
\end{tikzpicture}
\end{document}