2

Consider the following code:

\documentclass{article}
\usepackage{tikz}

\begin{document}

a\includegraphics[height=100pt]{example-image-10x16}b

\begin{tikzpicture}
\node[anchor=south west] at (0,0) {a\includegraphics[height=100pt]{example-image-10x16}b};
\fill[red] (0,0) circle[radius=.1];
\end{tikzpicture}
\end{document}

Run with pdflatex and it compiles just fine. Run with xelatex and the image in the node is displaced. It appears to be where the included graphic is located, since the a and b are always in the correct place. It also has something to do with the explicit height=100pt since removing that also fixes the problem (width=<something> also causes the problem to occur).

Displaced image

  1. What's happening?
  2. How can I make it stop?

Note that the following are related:

  1. Wrong positioning of images inside tikzpicture with XeLaTeX
  2. Switching from PDFLaTeX to XeLaTeX is messing with my pgftext coordinates

but I'm already in the situation of the answers given there.

Nor does the answer to Centering full-page Tikz image on page without margins with xelatex? work.


Edit: Following on from David and Harish's comments, I updated TL2013 and PGF. With the PGF that comes with TL2013 then it compiles correctly. With the CVS version of PGF then it does not. So the problem appears to lie with the PGF code for xelatex. I also discovered that the page changed from A4 paper (TL version of PGF) to letter paper (CVS version). As a Brit, my TL is set to produce A4 by default. Manually putting in a4paper changes the paper size back to A4, but doesn't correct the image displacement. So my guess is that the error is in PGF's driver file for XeTeX.

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751

0 Answers0