# TikZ example involving Spies won't typeset properly using XeLaTeX

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.)

-

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:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spy}
\pagestyle{empty}
\begin{document}
\begin{figure}
\begin{tikzpicture}
[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);
\end{tikzpicture}
\end{figure}
\end{document}


When compiled under pdflatex, the following figure results:

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

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 '11 at 2:47
@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 '11 at 3:23
sorry for my curt comment. I use texlive 2011 not mactex, maybe that's the point. –  Pig Cry Nov 1 '11 at 6:41
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 '11 at 9:01
Seems to work fine for TikZ 3.0.0 –  someonr Jan 2 at 8:04