4

I started using a new computer and one of my previous TikZ code produced unexpected results. After debugging it, I arrived at the following 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}

Strangely, the shifting is not applied to coordinate (A), so it stays over (CENTER), when I compile this code in the new machine (brand new vanilla texlive on Windows, with updated PGF version 3.1.5). However on my previous computer (running MacTex 2019 with PGF version 3.1, on MACOS), the coordinate (A) is shifted, so it appears over (B).

This behaviour happens with coordinates, but not with nodes. In the following code, the nodes (A) and (B) appear on the same position, as expected.

\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}%

Does anyone knows why is this happening? Should I report it as a bug somewhere (how)? I am worried that I will have to updated all my old codes, in order to compile the files in the new machine.

2
  • Oh WOW, I just updated my installation again (last update was in this week) and I confirm the problem. Let me guess: if you add \pgfversion you get 3.1.5. ? Issues can be reported at github.com/pgf-tikz/pgf/issues
    – user194703
    Commented Dec 21, 2019 at 2:02
  • 1
    That is right. At first, I was not sure if the issue was due to some configuration configurations of my machines or the tex distribution. But I believe it is due to the 3.1.5 update of PGF indeed.
    – Fabricio
    Commented Dec 21, 2019 at 17:43

1 Answer 1

3

This issue is already addressed not-so-directly in #809. As this is a serious issue, hotfix 3.1.5a is already released, and you can get it from CTAN in a couple of days.

In the mean time, Henri Menke provides a workaround:

\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

Working example in 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}

enter image description here

1
  • Thanks. At first, I was not sure if I was missing some configuration in my new instalation or if it was indeed a bug. The workaround is great for now.
    – Fabricio
    Commented Dec 21, 2019 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .