Estou tentando externalizar o PGF Plot para ser salvo como arquivo EPS usando látex e habilitado para escape de shell.
\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}
No entanto, ao executar isso com latex -shell-escape no Linux Mint 16 com TeX Live 2013, recebo o seguinte erro para cada gráfico.
! Erro do pacote tikz: Desculpe, a chamada do sistema 'latex -shell-escape -interaction= nonstopmode -jobname="untitled-1-figure2" "\def\tikzexternalrealjob{untitled-1} \input{untitled-1}" ; dvips -o "sem título-1-figura2".ps "sem título-1-figura2".dvi ; ps2eps -f "untitled-1-figure2".ps && mv "untitled-1-figure2".eps "untitled-1 -figure2"' NÃO resultou em um arquivo de saída utilizável 'untitled-1-figure2' (esperado um de epsi:eps:ps). Verifique se você ativou as chamadas do sistema. Para pd flatex, é 'pdflatex -shell-escape'. Às vezes também é chamado de ‘write 18’ ou algo parecido. Ou talvez o comando simplesmente tenha falhado? Mensagens de erro podem ser encontradas em 'untitled-1-figure2.log'. Se você continuar agora, tentarei compor a imagem.
No entanto, se eu apenas pressionarRetornarchave, ele gera arquivos EPS com sucesso. Tentei muitas tentativas, mas sem sorte. Por favor me ajude.