Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[shell escape=-enable-write18] %needed for the MiKTeX compiler

\begin{document}

\begin{figure}
\begin{tikzpicture}
\begin{axis}
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\caption{Our first external graphics example}
\end{figure}

\end{document}

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

\tikzexternalize

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.

/Andreas

share|improve this question
    
You can always do it the other way around: Place you plot/diagram in an external file with a full preamble and use the standalone class to be able to compile it by itself. You can then use the standalone package to strip the preamble when you \input it, or include the resulting image directly. The next version of standalone will allow you to switch between both and even create the PDF automatically. –  Martin Scharrer Jul 5 '11 at 13:18
    
Thanks for the tip! I understand you are the author of standalone. Is the package also able to export eps images? –  andreasdr Jul 5 '11 at 15:26
    
If you compile the standalone files with normal latex then yes. –  Martin Scharrer Jul 5 '11 at 15:37
1  
I see two possible reasons for the failure: the first is that the system did not allow the system call and the second is that the system call has been started, but failed. In general, if there exists a log file externalizetest-figure0.log, the system call has tried to start. If not, you can be sure that the system call did not even start. In that case, the main log file externalizetest.log might indicate a small hint of what went wrong. Perhaps it did not find the "pdflatex" command? –  Christian Feuersänger Jul 5 '11 at 16:14
1  
Why do you want to export EPS when you use pdflatex? Both standalone nor export actually export anything, but use either latex or pdflatex (either automatic or manual) to create a DVI (which can be converted EPS) or PDF file. As said, place the tikzpicture in a own file, add a \documentclass{standalone} \usepackage{tikz,otherpackages}<libs..> preamble and compile it with latex. Then use dvips -E (IIRC) on the DVI file to get a EPS. –  Martin Scharrer Jul 5 '11 at 16:43
show 5 more comments

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
add comment

I used to have the same problem. In my environment (Eclipse with Texlipse), the problem was that I specified a temporary output directory. By disabling this, the externalization works. Moreover, I had problem getting my bibliography updated. This was solved, too. The disadvantage is only that the directory looks messy. Cheers, Roman

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.