[Tex/LaTex] Externalize graphics when using pgfplots doesn’t work (MiKTeX 2.9)


I'm having problems exporting my pgfplots figures to separate files using the externalize command. I get an error, the central point of which seems to be "Please verify that you have enabled system calls.". I have followed the instructions in the pgfplots manual to do this, however.
I'm using MiKTeX 2.9 and Windows 7.

(In a related thread, the poster has the same problem as me: Attempt to export EPS figures from TikZ fails . However, in that case the poster is able to successfully export an image using the command "pdflatex -enable-write18 -output-format=dvi", I don't get that far. I have read that thread carefully but still can't figure out how to solve my problem).

My example is the following, taken from the pgfplots manual:

\tikzexternalize[shell escape=-enable-write18] %needed for the MiKTeX compiler


\addplot {x^2};
\caption{Our first external graphics example}


I compile using the command:

pdflatex.exe -shell-escape

This gives the following error:

entering extended mode
===== 'mode=convert with system call': Invoking 'pdflatex -enable-write18 -halt
-on-/b/c9/cerror /b/c0/c-interaction=batchmode -jobname "externalizetest-figure0" "\def\tikze
xternalrealjob{externalizetest}\input{externalizetest}"' ========
! Package tikz /b/c9/cError:/b/c0/c Sorry, the system call 'pdflatex -enable-write18 -halt-on
-/b/c9/cerror /b/c0/c-interaction=batchmode -jobname "externalizetest-figure0" "\def\tikzexte
rnalrealjob{externalizetest}\input{externalizetest}"' did NOT result in a usabl
e output file 'externalizetest-figure0' (expected one of .epsi:.eps:.ps:). Plea
se 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? /b/c9/cError /b/c0/cmessages can be found in 'externalizete
st-figure0.log'. If you continue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.

As I understand it, the line

\tikzexternalize[shell escape=-enable-write18]

is supposed to replace the command -shell-escape to -enable-write18, which is needed for MiKTeX. Just to make sure that isn't the problem, I tried using the command

pdflatex.exe -enable-write18

instead, and


in the .tex file. But that doesn't work either.

I'd be very thankful for help on how to enable system calls with MiKTeX 2.9, or, if the problem lies somewhere else, for thoughts on what might be wrong.


Best Answer

Reinstalling and updating MiKTeX 2.9 (avoiding the update of hyph-utf8, which seems to be having some problems since the new version came out on June 23) solved the problem. The above code (using either of the command lines mentioned) now correctly exports the figure to a separate pdf file.

Related Question