1

I have a problem with \includegraphics within TikZ with XeLaTeX, namely that the images get displaced.

This is similar to the problem described in this question, but the symptoms are different. Moreover, this problem appeared when I switched from Ubuntu’s TeX Live to a manually installed minimalistic TeX Live 2019, which suggests that I may be missing some package or I made some mistake when installing (I haven’t tried a full installation yet). Note that no error or otherwise helpful message is thrown.

Minimal example

It seems that any PDF image will cause the problem, but just so we are on the same page, I compile the following to obtain an image.pdf to use. (It doesn’t seem to matter whether I compile with pdflatex or xelatex.)

\documentclass{standalone}
\begin{document}
    \Huge Here is some text.
\end{document}

The main file is:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \node{
                \includegraphics[scale=1]{image.pdf}
            };
    \end{tikzpicture}
\end{document}

I compile this file once with xelatex (left) and once with pdflatex (right) and everything seems normal:

example for scale=1

Now, I change the size of the image to scale=2:

example for scale=2

And finally for scale=3, the included image has completely sailed off the page:

example for scale=3

This problem vanishes when I remove the TikZ wrapper. What could be the reason for this and how can I fix it?

5
  • What happens if you use mm instead of em as a unit? – Ulrike Fischer Jul 13 '19 at 15:42
  • @UlrikeFischer: Not much, but using yet another unit made me discover something interesting: Please see my edit. – Wrzlprmft Jul 13 '19 at 17:55
  • Hm. Interesting. It looks like a pgf bug, but needs some investigating. – Ulrike Fischer Jul 13 '19 at 18:40
  • 2
    It is clearly a pgf bug in the newest version. Reverting to the previous one resolves the problem. I made a bug report github.com/pgf-tikz/pgf/issues/708 – Ulrike Fischer Jul 13 '19 at 18:59
  • @UlrikeFischer: Thanks for finding that out. Now I just need to figure out how to obtain and install the last version of PGF … – Wrzlprmft Jul 13 '19 at 20:50
0

This turned out to be a bug in PGF that has now been fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.