我有四个节点,一个父节点和三个子节点。我尝试用以下特定箭头路径进行链接:
我刚刚开始使用 tikz 包,到目前为止我的代码如下所示:
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc}
\begin{document}
\begin{tikzpicture}[
,node distance =5mm
,>=latex'
,block/.style ={
,draw
,minimum height = 10mm
,minimum width =28mm
,align=center
}
,every path/.style={->} %sets arrow style
]
\node [block] (main) {Main};
\node [block, below=of main] (second) {Second};
\node [block, left=of second] (first) {First};
\node [block, right=of second] (third) {Third};
\draw (main) to (first);
\draw (main) to (second);
\draw (main) to (third);
\end{tikzpicture}
\end{document}
这给了我:
我尝试使用 -|,但只生成了路径中的一个角,而不是我需要的两个角。任何帮助都非常感谢。
答案1
像这样:
\begin{tikzpicture}[
,node distance =5mm
,>=latex'
,block/.style ={
,draw
,minimum height = 10mm
,minimum width =28mm
,align=center
}
,every path/.style={->} %sets arrow style
]
\node [block] (main) {Main};
\node [block, below=of main] (second) {Second};
\node [block, left=of second] (first) {First};
\node [block, right=of second] (third) {Third};
\draw ([xshift=-3mm] main.south) -- + (0,-2mm) -| (first);
\draw (main) to (second);
\draw ([xshift= 3mm] main.south) -- + (0,-2mm) -| (third);
\end{tikzpicture}