![TikZ 中节点之间的双弯曲箭头](https://linux22.com/image/354193/TikZ%20%E4%B8%AD%E8%8A%82%E7%82%B9%E4%B9%8B%E9%97%B4%E7%9A%84%E5%8F%8C%E5%BC%AF%E6%9B%B2%E7%AE%AD%E5%A4%B4.png)
考虑以下 MWE:
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
% Nodes
\node[draw] (node1) {1};
\node[draw, below left=of node1] (node2) {2};
\node[draw, below right=of node1] (node3) {3};
% Arrows
\draw[->] (node1.south) -| (node2.north);
\draw[->] (node1.south) -| (node3.north);
\end{tikzpicture}
\end{document}
例如,我希望箭头弯曲两次,方法是写类似|-|
而不是 的内容-|
。这样简单的解决方案可行吗?还是我需要更复杂的东西?
(我在网上搜索过答案,但显然使用了错误的关键词。任何有关 TikZ 手册有用部分的帮助都将不胜感激。)
答案1
像这样:
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Nodes
\node[draw] (node1) {1};
\node[draw, below left=of node1] (node2) {2};
\node[draw, below right=of node1] (node3) {3};
% Arrows
\draw[->] (node1.south) |- ($(node1.south) - (0,5mm)$) -| (node2.north);
\draw[->] (node1.south) |- ($(node1.south) - (0,5mm)$) -| (node3.north);
\end{tikzpicture}
\begin{tikzpicture}
% Nodes
\node[draw] (node1) {1};
\node[draw, below left=of node1] (node2) {2};
\node[draw, below right=of node1] (node3) {3};
% Arrows
\draw[->] (node1.south) |- ++(0,-5mm) -| (node2.north);
\draw[->] (node1.south) |- ++(0,-8mm) -| (node3.north);
\end{tikzpicture}
\end{document}