I am preparing a long document with Latex on Linux. The document uses lots of plots including 3D plots. Without externalizing the plots, latex gives me a message of memory problem. After much searching on forums and reading about the pgfplots document (http://pgfplots.sourceforge.net/pgfplots.pdf) on Page 464, I realized that the problem is due to the \label \ref pair in my plots as I use \label inside the pgfplot code, and \ref in the caption to refer to the marker line. The Latex document compiles successfully on first run and creates all the necessary files such as .dpth .spl .eps .dvi .log on the first latex run. But when I run latex for the second time, I get this error:

! Package tikz Error: Sorry, the system call 'latex -shell-escape -halt-on-erro r -interaction=batchmode -jobname "elsarticle-template-1a-num-figure_crossref0" "\def\tikzexternalrealjob{elsarticle-template-1a-num}\input{elsarticle-templat e-1a-num}" && dvips -o "elsarticle-template-1a-num-figure_crossref0".eps "elsar ticle-template-1a-num-figure_crossref0".dvi' did NOT result in a usable output file 'elsarticle-template-1a-num-figure_crossref0' (expected one of .epsi:.eps: .ps:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something li ke that. Or maybe the command simply failed? Error messages can be found in 'el sarticle-template-1a-num-figure_crossref0.log'. If you continue now, I'll try t o typeset the picture.

I am using the following latex commands two times:

latex -shell-escape elsarticle-template-1a-num.tex
latex -shell-escape elsarticle-template-1a-num.tex

This is how my document looks:


    \usepackage{pst-grad} % For gradients
    \usepackage{pst-plot} % For axes
    \tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource" && dvips -o "\image".eps "\image".dvi}}
    Lots of text content here. Also some pstricks images.
    %Plots begin here. Here I use \label \ref
    \caption{Values of \(\alpha\) from [0,1] in different data. The line denoted by \ref{abc} marker is the \texttt{abc}. The line with \ref{new_one} marker is the \texttt{New One} scheme.}


This is one of the pgfplots files. Showing alpha_0_vary_results_1.txt file.

\begin{axis}[title=Data 1,xlabel=\(\alpha\),ylabel=Measure]
\addplot[color=black,mark=x , mark size=4] coordinates {
\addplot+[color=black,mark=o , mark size=4] coordinates {

I get no errors in running latex two times using the above commands when I remove all the plots from my document. So this means the problem is related to the plots.

  • I am using pgfplots version 2.10 – puser May 7 '14 at 1:39

I could find out the solution to my problem after much searching and testing. This is what I did now. This is how the beginning of the document looks now:

    /tikz/external/mode=list and make
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource" && dvips -o "\image".eps "\image".dvi}}

Then I made some changes to the way I compile latex.

latex -shell-escape file_name.tex

bibtex file_name.aux
bibtex file_name.aux

latex -shell-escape file_name.tex

make -j 4 -B -f *.makefile

latex -shell-escape file_name.tex
latex -shell-escape file_name.tex

bibtex file_name.aux
make -j 4 -f *.makefile
latex -shell-escape file_name.tex

I have noted that if I don't follow the above compilation sequence, there are some problems in the final PDF file generated. For example, in the caption area I don't see the marker along with its line, only "??" sign.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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