是否有一个简单的习语(不使用calc
库)来指定相对于节点的 Tikz 坐标?
类似于\coordinate (x) [right=of A];
而不是 \node (x) [draw=none, right=of A]{};
?
谢谢
答案1
\documentclass{article}
\usepackage {tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (A){A};
\coordinate (x) [right=of A]; % <-- this does *not* work expected
\coordinate[right=of A] (y) ; % <-- this *works* as expected
\draw (x) -- ++(1,1);
\draw[red] (y) -- ++(1,1);
\end{tikzpicture}
\end{document}
备注:问题类似
\node (x) {} [right= of A];
代替
\node[right= of A] (x) {} ;
但
\node (x) [right= of A] {} ;
很有价值