[Tex/LaTex] Attempting to export tikz to eps

epstikz-externaltikz-pgf

So, after having read the below thread:

Attempt to export EPS figures from TikZ fails

I am able to generate .dvi versions of my figures. However, I need .eps, and it seems that the question above only covers getting the externalize library to work. It does so now, with no errormessages. But there is no eps-output.

Reading the manual, it seems I have to add "pdftops -eps {pdf file} {eps file}" to the "system call option". Below is seen my attempt at doing so:

\documentclass{article}
\usepackage{tikz}

% set up externalization
\usetikzlibrary{external}
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" && 
dvips -o "\image".ps "\image".dvi pdftops -eps "\image".pdf "\image".eps}}
\tikzexternalize[shell escape=-enable-write18] % MikTeX uses a -enable-write18 instead of --shell-escape.

\begin{document}
\begin{tikzpicture}
\draw[fill=blue] (0,0) circle (1cm);
\end{tikzpicture}
\end{document}

as you can see, having no idea what to put in place of {some file}, I just copied the form of what was already there.
The above does not generate any errors, nor any .eps-files.

I am outputting to .ps format.

I hope someone can explain to me how to add the proper option =)

Best Answer

You were missing an && before the pdftoeps, your quotation marks were in the wrong place (you had "\image".ps instead of "image.ps"), and pdftoeps is the wrong command to use to convert a postscript file to an encapsulated postscript file. On my system, I have a command called ps2epsi which works. I also tried it with ps2eps which also works (don't know the difference!). Admittedly, I'm testing this on Linux so can't be absolutely sure that this will work for you with MikTeX, but give this a go and see if it works:

\documentclass{article}
%\url{http://tex.stackexchange.com/q/25524/86}
\usepackage{tikz}

% set up externalization
\usetikzlibrary{external}
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" && 
dvips "\image.dvi" && ps2epsi "\image.ps"}}
\tikzexternalize[shell escape=-enable-write18] % MikTeX uses a -enable-write18 instead of --shell-escape.

\begin{document}
\begin{tikzpicture}
\draw[fill=blue] (0,0) circle (1cm);
\end{tikzpicture}
\end{document}

(NB: Anyone testing this on Linux should comment out the optional argument to \tikzexternalize.)