我正在尝试将正交边的语法(p |- q)
与计算相对坐标的语法结合起来($ (a) + (1,0) $)
。例如:
\draw ($ (node1.south) + (1,0) $) to ( ($ (node1.south) + (1,0) $) |- node2.north);
但是,我收到一个错误:
Package pgf Error: No shape named ($ (node1 is known.
在这种情况下,有一个明显的解决方法,但出于教育目的,我想了解为什么这种语法不起作用,以及通常如何解决问题?直观地看,文档建议我可以简单地结合这两种语法。
更新——MWE:
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node at (0, 0) (node1) {Hello};
\node at (0, -2) (node2) {World};
% working:
\draw ($ (node1.south) + (1,0) $) to ( node1.south |- node2.north);
% not working:
\draw ($ (node1.south) + (1,0) $) to ( ($ (node1.south) + (1,0) $) |- node2.north);
\end{tikzpicture}
\end{document}