
새 컴퓨터를 사용하기 시작했는데 이전 TikZ 코드 중 하나가 예상치 못한 결과를 낳았습니다. 디버깅 후 다음 MWE에 도착했습니다.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\coordinate (CENTER) at (current page.center);
\coordinate (A) at ([xshift=1cm,yshift=-2cm] CENTER); %This coordinate is not shifted on PGF 3.1.5 running on texlive on windows; but it is shifted on PGFs 3.1 running on MacTex.
\coordinate [xshift=1cm,yshift=-2cm] (B) at (CENTER); %This is shifted in both computers.
\node at (CENTER) {XXX};
\node at (A) {000};
\node at (B) {111};
\end{tikzpicture}
\end{document}
이상하게도 이동은 좌표(A)에 적용되지 않으므로 새 시스템(Windows의 새로운 바닐라 texlive, 업데이트된 PGF 버전 3.1.5 포함)에서 이 코드를 컴파일할 때 계속 유지됩니다(CENTER). 그러나 이전 컴퓨터(MACOS에서 PGF 버전 3.1이 포함된 MacTex 2019 실행)에서는 좌표(A)가 이동되어 (B) 위에 나타납니다.
이 동작은 좌표에서는 발생하지만 노드에서는 발생하지 않습니다. 다음 코드에서는 노드 (A)와 (B)가 예상대로 동일한 위치에 나타납니다.
\begin{tikzpicture}[remember picture,overlay]
\node (CENTER) at (current page.center) {XXX};
\node (A) at ([xshift=1cm,yshift=-2cm] CENTER) {000};
\node [xshift=1cm,yshift=-2cm] (B) at (CENTER) {111};
\end{tikzpicture}%
왜 이런 일이 일어나는지 아는 사람이 있습니까? 어딘가에 버그로 신고해야 할까요(어떻게)? 새 컴퓨터에서 파일을 컴파일하려면 이전 코드를 모두 업데이트해야 할까 봐 걱정됩니다.
답변1
이 문제는 이미 다음에서 직접적으로 해결되지 않았습니다.#809. 이는 심각한 문제이므로,핫픽스 3.1.5a이미 출시되었으며 며칠 안에 CTAN에서 다운로드할 수 있습니다.
그동안,헨리 멘케해결 방법을 제공합니다.
\makeatletter
\def\tikz@@coordinate@at@math#1{%
\pgf@process{#1}%
\edef\tikz@temp{(\the\pgf@x,\the\pgf@y)}%
\expandafter\tikz@coordinate@caller\tikz@temp{}%
}%
\makeatother
3.1.5의 작업 예:
\documentclass{article}
\usepackage{tikz}
\makeatletter
\def\tikz@@coordinate@at@math#1{%
\pgf@process{#1}%
\edef\tikz@temp{(\the\pgf@x,\the\pgf@y)}%
\expandafter\tikz@coordinate@caller\tikz@temp{}%
}%
\makeatother
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\coordinate (CENTER) at (current page.center);
\coordinate (A) at ([xshift=1cm,yshift=-2cm] CENTER);
\coordinate [xshift=1cm,yshift=-2cm] (B) at (CENTER);
\node at (CENTER) {XXX};
\node at (A) {000};
\node at (B) {111};
\end{tikzpicture}
\end{document}