我对坐标有些不太理解,但我相信你能解释
这是问题的一个例子
\documentclass[tikz, border = 3pt]{standalone}
\usepackage{tikzpagenodes}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0, 0);
\coordinate (B) at (4, 4);
\draw (A) rectangle (B);
\fill[red, xshift = 20pt] (B) circle (0.3) node[above = 7pt]{doesn't work};
\fill[blue, xshift = 20pt] (0, 0) circle (0.3) node[below = 7pt]{works};
\end{tikzpicture}
\end{document}
问题是当我尝试使用shift
先前定义的坐标时,例如
\fill[red, xshift = 20pt] (B) circle (0.3);
如图所示,它明显没有移动圆圈。这是为什么呢?
提前致谢
答案1
如果您在坐标字母附近应用 shift 选项,它将与分配给字母的坐标一起工作\fill[red] ([xshift=20pt]B) circle (0.3) node[above = 7pt]{doesn't work};
,但不适用于路径。
\documentclass[tikz, border = 3pt]{standalone}
\usepackage{tikzpagenodes}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0, 0);
\coordinate (B) at (4, 4);
\draw (A) rectangle (B);
\fill[red] ([xshift=20pt]B) circle (0.3) node[above = 7pt]{doesn't work};
\fill[blue, xshift = 20pt] (0, 0) circle (0.3) node[below = 7pt]{works};
\end{tikzpicture}
\end{document}