I'm trying to use TikZ's external library with XeTeX, for example, and I'm running into some issues. Having set

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

(EDIT: as an answer points out I had accidentaly used ``...'' instead of "..." here) while using the default mode=convert with system call XeTeX just dies with the following error

! Package tikz Error: Sorry, the system call 'xelatex -halt-on-error -interaction=batchmode -jobname ``xetexpics
/externalTest-figure0'' ``\def\tikzexternalrealjob{externalTest}\input{externalTest}''' did NOT result in a usab
le output file 'xetexpics/externalTest-figure0' (expected one of .pdf:.jpg:.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 something like that. Or maybe the command simply failed? Error messages can be found in 'xetexpics/externalT
est-figure0.log'. If you continue now, I'll try to typeset the picture.

(EDIT: This was due to only restructed write18 being enabled, see comment)

without producing the log file. Changing to mode=list and make it produces an incorrect makefile where all tabs have been replaced by ^^I and without properly escaped backslashes. Fixing these errors and running make seems to indicate success, but the generated images are empty. The only warning or error I can seem to find in the log is

Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.

Has anyone had any success with using external with XeTeX, and does anyone have any suggestions on how to make it work?

I'm using XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2012/dev/Arch Linux), pgf 2008/01/15 v2.10 and tikz 2010/10/13 v2.10 according to the log.

  • The info message about \expanded is normal and surely has nothing to do with the problem.
    – egreg
    Commented Oct 22, 2011 at 22:11
  • 1
    If the original system call did not produce any .log file for the individual images, it may have failed to run the system call. For pdftex, this usually produces some kind of log warning of sort "write 18 call has been forbidden" in the .log file of the main file. Perhaps the shell-escape is inactive. Commented Oct 23, 2011 at 14:30
  • Could you try to convert one of the image .pdfs to .ps and view them in gv? Perhaps the picture's dimensions are set incorrectly by tikz - and as far as I know, pdf will ALWAYS remove picture parts outside of the bounding box whereas .ps files will display them. If the bounding box turns out to be wrong, you have found a bug in tikz (probably a bug of the pgf basic layer externalization). Commented Oct 23, 2011 at 14:33
  • I realised that I had only restricted write18 enabled, and that xelatex wasn't part of the enabled programs (for good reasons). Having changed this I can compile with convert with system call. Converting the pdf to a ps with pdf2ps still produces an empty document. Commented Oct 23, 2011 at 15:44
  • I have just tried to compile an example with my local xelatex. I fear it is outdated (version This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian) (format=xelatex 2011.7.30)), but at least the produced figure worked perfectly. Maybe I really need to upgrade to a more recent texlive ;) . Anyway, perhaps the pgf support for xetex is broken on your system. On mine, the figures .log file contains something like Package pgfsys Info: Driver file for pgf: pgfsys-xetex.def ... (...systemlayer/pgfsys-xetex.def pgfsys-xetex.def 2010/02/16 (rcs-revision 1.3) Commented Oct 24, 2011 at 21:03

1 Answer 1


The problem of writing "incorrectly" the tab is known (see Tabs in output file written by xelatex and pdflatex are different)

The "solution" is to call

xelatex -8bit -shell-escape

but this may have adverse effects on the writing of aux files.

Pay attention on how you write:

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

should have real double quotes.

  • 1
    Very true, that's what I get for just copy-pasting into emacs :) Also -8bit does solve the tab issue, but it still doesn't seem to produce the picture. Commented Oct 22, 2011 at 23:05
  • Where should these commands be added? I am using TexShop on Mac OS X.
    – Wayne Tsai
    Commented Sep 30, 2016 at 12:44
  • 1
    @WayneTsai You should open ~/Library/TeXShop/Engines/XeLaTeX.engine (with any text editor, including TeXShop) and add -8bit -shell-escape to the last line, after xelatex.
    – egreg
    Commented Sep 30, 2016 at 13:02
  • 1
    @WayneTsai It's actually better if you duplicate XeLaTeX.engine into, say, XeLaTeX-shell.engine and do the above modification to the duplicate file; so long as it has .engine extension and lives in ~/Library/TeXShop/Engines, it will appear in the drop down menu near to the Typeset button.
    – egreg
    Commented Sep 30, 2016 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .