
좌표에 대해 제가 잘 이해하지 못하는 부분이 있는데, 설명해주실 거라고 확신합니다.
이것이 문제의 예이다
\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
\fill[red] ([xshift=20pt]B) circle (0.3) node[above = 7pt]{doesn't work};
좌표 문자 근처에 Shift 옵션을 적용하고 경로에는 적용하지 않으면 문자에 지정된 좌표로 작동합니다 .
\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}