3

I'm working on a template for an automated report (using knitr). I created a title banner for my organization using TikZ; the last step to finish the branding was to switch to my organization's fonts. For this, I switched to XeLaTeX--my first time using it. The fonts work great! But the position of the logo in my tikzpicture got messed up, and I can't seem to do anything with it.

Minimal Example:

\documentclass{article}
\usepackage[margin = 0.5in]{geometry}
\usepackage{graphicx}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \node at (1in, 1in) {\pgftext{\includegraphics[height=0.3in]{mylogo}}};
    \node at (5in, 5in) {\pgftext{\includegraphics[height=0.3in]{mylogo}}};
    \node at (2in, 2in) {First one};
    \node at (3in, 3in) {Second one};
\end{tikzpicture}

\end{document}

When I run PDFLaTeX on the above code, everything works as expected: I see two logos, and both text nodes. If I run XeLaTeX, the normal text nodes still work as expected, but I only see one logo in the top left (I think they're both printed there). The question is: How can I position the image while using XeTeX?

The mylogo file is a .png, not that I can imagine that affecting anything. I'm running MiKTeX on a Windows box; I just ran the updater so everything should be up to date.

  • 2
    Remove \pgftext. – egreg Mar 7 '13 at 22:33
4

I don't know what \pgftext is supposed to do, but it seems to be the problem. Removing it should put the logos where they should.

  • I got the \pgftext from this answer and never tried without it, but it does seem completely extraneous. – Gregor Thomas Mar 7 '13 at 23:17
  • 1
    @shujaa \pgftext escapes back to "ordinary TeX" from the PGF environment. However, you're using inside a \node where you are already "escaped" back to TeX. Therefore it is superfluous and only good fortune meant that it had no effect with pdflatex! – Andrew Stacey Mar 8 '13 at 10:24

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.