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 am trying to externalize PGF Plot to be saved as EPS file using latex and enabled shell-escape.

    \documentclass[a4paper]{article}
    \usepackage{lipsum}
    \usepackage{tikz}
    \usepackage{pgfplots}
    \usepgfplotslibrary{external}
    \tikzexternalize%[prefix=fig/]
    \tikzset{external/system call={latex -shell-escape -interaction=nonstopmode -jobname="\image" "\texsource" ; dvips -o "\image".ps "\image".dvi ; ps2eps -f "\image".ps && mv "\image".eps "\image"}} 

    \pgfplotsset{ compat=1.8,  tick label style={font=\small},  label style={font=\small}, legend style={font=\footnotesize}}
    \tikzexternalize[prefix=fig/] 
    \title{\LaTeX\ plots with \texttt{tikz} and \texttt{pgfplots}}
    \author{Roel Van Beeumen}
    \date{April 17, 2012}

    \begin{document}
    %\tikzsetnextfilename{filename}
    \tikzset{external/force remake}
    \maketitle


    % == A first plot ======================================== %
    \section{A first plot}

    \lipsum[1]
    \begin{figure}[h]
    \centering
    % -------------------------------------------------------- %
    \begin{tikzpicture}
    \begin{axis}[xlabel=$x$,ylabel=$\sqrt{|x|}$, axis x line=bottom,axis y line=left, ymax=2.1,xmax=4.4]
    \addplot[blue,mark=none,domain=-4:4,samples=201] {sqrt(abs(x))};
    \end{axis}
    \end{tikzpicture}
    % -------------------------------------------------------- %
    \end{figure}
    \lipsum[2]



    % == A second plot ======================================= %
    \section{A second plot}

    \lipsum[3]
    \begin{figure}[h]
    \centering
    % -------------------------------------------------------- %
    \begin{tikzpicture}
    \begin{loglogaxis}[xlabel=Dof,ylabel=Error,width=\textwidth]
    \addplot file{datafile1a.dat};
    \addplot file{datafile1b.dat};
    \legend{Case 1,Case 2}
    \end{loglogaxis}
    \end{tikzpicture}
    % -------------------------------------------------------- %
    \end{figure}
    \lipsum[4-5]



    % == A third plot ======================================== %
    \section{A third plot}

    \lipsum[6]
    \begin{figure}[hbtp]
    \centering
    % -------------------------------------------------------- %
    \begin{tikzpicture}
    \begin{loglogaxis}[xlabel=Dof,ylabel=Error,width=\textwidth]
    \addplot table[x=dof1,y=error1] {datafile2.dat};
    \addplot table[x=dof2,y=error2] {datafile2.dat};
    \legend{Case 1,Case 2}
    \end{loglogaxis}
    \end{tikzpicture}
    % -------------------------------------------------------- %
    \end{figure}
    \lipsum[7]


    \end{document}  

However, on executing this with latex -shell-escape in Linux Mint 16 with TeX Live 2013, I get the following error for each plot.

! Package tikz Error: Sorry, the system call 'latex -shell-escape -interaction= nonstopmode -jobname="untitled-1-figure2" "\def\tikzexternalrealjob{untitled-1} \input{untitled-1}" ; dvips -o "untitled-1-figure2".ps "untitled-1-figure2".dvi ; ps2eps -f "untitled-1-figure2".ps && mv "untitled-1-figure2".eps "untitled-1 -figure2"' did NOT result in a usable output file 'untitled-1-figure2' (expecte d one of epsi:eps:ps). Please verify that you have enabled system calls. For pd flatex, 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 'untitled-1-figure2.log'. If you continue now, I'll try to typeset the picture.

However, if I just press Return key, it generates EPS files successfully. I tried a lot of trials, but no luck. Please help me.

share|improve this question

closed as unclear what you're asking by percusse, Andrew Swann, Benedikt Bauer, Claudio Fiandrino, Jake Jun 6 at 10:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
It is to be expected that either untitled-1-figure2.log contains hints on what went wrong or that untitled-1.log contains more information. Could you take a look into these two log files and append suspicious snippets? –  Christian Feuersänger Mar 26 at 20:21
    
Welcome to TeX.SX! Have you had a chance to check the log files yet, as Christian suggested? –  Paul Gessler Mar 31 at 0:51