[pdftex] How to make externalizing work with xelatex?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat May 21 11:53:41 CEST 2011

On Sat, May 21, 2011 at 04:44:13PM +0800, narke wrote:

> With pdflatex, I can use '-shell-escape' to compile my latex source
> that contains tikz pictures with externalizing activated.  But when I
> enabled the ttf fonts support with fontspec package and compile the
> modified source with 'xelatex -shell-escape', I got errors and cannot
> pass the compiler.
> Attached is an simple sample, it's just a modified version of that in pgf manul.
> The error message when run 'xelatex -shell-escape' is:
> ----------------- cut begin
> -------------------------------------------------------------
> This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
>  restricted \write18 enabled.
> entering extended mode
> ! Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interact
> ion=batchmode -jobname "foo-figure0" "\def\tikzexternalrealjob{foo}\input{foo}"
> ' did NOT result in a usable output file 'foo-figure0' (expected one of .pdf:.j
> pg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex
> , this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or so
> mething like that. Or maybe the command simply failed? Error messages can be fo
> und in 'foo-figure0.log'. If you continue now, I'll try to typeset the picture.

There is a protocol file `foo-figure0.log'. It tells you that you need
XeTeX instead of pdfTeX. Therefore you have to replace the system call
to replace "pdflatex" by "xelatex", see pgf/tikz documentation
"3.2 Externalizing Graphics".

\tikzset{external/system call={%
  xelatex \tikzexternalcheckshellescape
  -halt-on-error -interaction=batchmode
  -jobname "\image" "\texsource"}}

Yours sincerely
  Heiko Oberdiek

More information about the pdftex mailing list