The example in this answer, illustrating the use of "spies" using the Tikz package, fails to typeset correctly when using XeLaTeX: the magnification circle appears empty. Using pdfLaTeX and LaTeXmk works fine, otherwise.

Do I need to configure my TeX distribution somehow in order to typeset TikZ code using XeLaTeX? (Currently using MacTex 2011 with TeXworks, on OS X Lion.)

1 Answer 1


There indeed seems to be a problem with the use of "spies" under XeLaTeX. Consider the following MWE, which is a stripped-down version of the answer referred to by the OP:

  [spy using outlines={circle, magnification=4, 
   size=1cm, connect spies}]
\draw[help lines] (0,0) grid (2,2);
\draw[red] (0,0) -- (1,1);
\spy [blue] on (1,1) in node at (1.75,2.75);

When compiled under pdflatex, the following figure results:

enter image description here

In contrast, when the same program is compiled under XeLaTeX, one gets:

enter image description here

I.e., both the "cross-hairs" and the red line that terminates in the middle of the "target" aren't shown inside the spy-circle. :-(

  • add the command and it doesn't work.
    – Pig Cry
    Nov 1, 2011 at 2:47
  • 1
    @PigCry: Please be more specific regarding "it doesn't work". Which TeX distribution are you running, under which OS? Did you remove all aux files prior to recompiling under XeLaTeX?
    – Mico
    Nov 1, 2011 at 3:23
  • sorry for my curt comment. I use texlive 2011 not mactex, maybe that's the point.
    – Pig Cry
    Nov 1, 2011 at 6:41
  • 1
    I add the command \usepackage{fontspec}, compile it under xelatex without error warning, but the magnification circle appears almost empty, only with a vertical. I think the vertical is a grid line.
    – Pig Cry
    Nov 1, 2011 at 9:01
  • 2
    Seems to work fine for TikZ 3.0.0
    – someonr
    Jan 2, 2014 at 8:04

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.