6

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 =)

2
  • 1
    As a small note: LaTeXiT (on a mac) allows you to save your work in many formats, including eps. Its main purpose is to be able to include nice equations into other types of documents (Pages,Word,LibreOffice,etc.) but I use it to draw diagrams.
    – Frédéric
    Commented Aug 12, 2011 at 12:56
  • I have the same problem than Kaare. Did you find a solution? I run with Miktex...
    – user12949
    Commented Mar 25, 2012 at 13:33

2 Answers 2

6

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.)

6
  • Actually, that's not quite right. That pdftops shouldn't be there ... Commented Aug 12, 2011 at 11:32
  • Okay, gotten rid of the pdftops and replaced it with ps2epsi instead. Commented Aug 12, 2011 at 11:41
  • The location of the " doesn't matter. The shell will remove them anyway before the program sees them. They are just there to escape any special characters in the filename. I updated tex.stackexchange.com/questions/8641/… to add the missing ps2eps.
    – Caramdir
    Commented Aug 12, 2011 at 16:34
  • Unfortunately I can not make this work. That is to say, copy-pasting the above code has exactly the same effect as the old code.
    – Kaare
    Commented Aug 12, 2011 at 17:22
  • @Kaare: What happens if you run the commands individually? Commented Aug 12, 2011 at 18:57
2

Step 1

Create a batch file as follows:

rem batch.bat takes an input file name WITHOUT extension.

del %1.pdf
del %1.eps

pdflatex %1
pdftops -level3 -eps %1.pdf

del %1.aux
del %1.log

For simplicity, save it in the same directory in which your input file exists.

Step 2

Create a test input file as follows.

% test.tex
\documentclass{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewBorder=0pt
\PreviewEnvironment{tikzpicture}

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

For simplicity, save it in the same directory in which batch.bat exists.

Step 3

Open MS-DOS prompt by pressing Win+R, typing cmd and hitting ENTER. The MS-DOS prompt brings up and navigate to your input file directory. Afterwards, type

enter image description here

and hit ENTER. Done, you will get both PDF and EPS outputs.

enter image description here

5
  • If you are satisfied with this answer, don't forget to upvote and give a green check mark. Because I noticed you have not done it yet for your other question. :-) Commented Aug 12, 2011 at 10:26
  • You don't need to pass -enable-write18 to pdflatex in batch.bat because pdftops is executed directly outside pdflatex. Commented Aug 12, 2011 at 10:30
  • I get the following (after a lot of text describing the workings of MikTex): D:\projekt\Talks & such\DelA-defence>pdftops -level3 -eps tikzFigure1.pdf 'pdftops' is not recognized as an internal or external command, operable program or batch file.
    – Kaare
    Commented Aug 12, 2011 at 17:26
  • So, I guess the new question is where to get pdftops =) googling pdftops windows does not yield anything useful.
    – Kaare
    Commented Aug 12, 2011 at 17:31
  • @Kaare: I don't use MikTeX. In TeXLive, this tool exists. Commented Aug 13, 2011 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .