I'm attempting to output EPS figures when using MikTeX 2.8 under Windows XP, and am following Export eps figures from TikZ. My problem is that I can't get the bare example given there to run.
The code I'm using was copied from that thread verbatim:
\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}}
\tikzexternalize[shell escape=-enable-write18] % MikTeX uses a -enable-write18 instead of --shell-escape.
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\end{tikzpicture}
\end{document}
When running I get the following error message:
This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8)
entering extended mode
(C:/junk/untitled-2.tex
LaTeX2e <2009/09/24>
. . .
[Loading MPS to PDF converter (version 2006.09.02).]
)
===== 'mode=convert with system call': Invoking 'latex -halt-on-error -interaction=batchmode -jobname "untitled-2-figure0" "\def\tikzexternalrealjob{untitled-2}\input{untitled-2}" && dvips -o "untitled-2-figure0".ps "untitled-2-figure0".dvi' ========
! Package tikz Error: Sorry, the system call 'latex -halt-on-error -interaction=batchmode -jobname "untitled-2-figure0" "\def\tikzexternalrealjob{untitled-2}\input{untitled-2}" && dvips -o "untitled-2-figure0".ps "untitled-2-figure0".dvi' did NOT result in a usable output file 'untitled-2-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, 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-2-figure0.log'. If you continue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.14 \end{tikzpicture}
?
Can someone help me over this hurdle?
My previous post was written on my Windows XP system using Chrome, where the answer box limited me to about 600 characters and did not accept markup or newlines :-(. I'm writing this on my Windows 7 system with Chrome, and the answer box has all markup bells and whistles I need -- very strange.
Following is the compilation output:
This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8) entering extended mode ("C:/Documents and Settings/Moshe/My Documents/test.tex" LaTeX2e <2009/09/24> . . .
===== 'mode=convert with system call': Invoking 'latex -enable-write18 -halt-on
-error -interaction=batchmode -jobname "test-figure0" "\def\tikzexternalrealjob {test}\input{test}" && dvips -o "test-figure0".ps "test-figure0".dvi' ========
! Package tikz Error: Sorry, the system call 'latex -enable-write18 -halt-on-er ror -interaction=batchmode -jobname "test-figure0" "\def\tikzexternalrealjob{te st}\input{test}" && dvips -o "test-figure0".ps "test-figure0".dvi' did NOT resu lt in a usable output file 'test-figure0' (expected one of .pdf:.jpg:.jpeg:.png :). Please verify that you have enabled system calls. For pdflatex, this is 'pd flatex -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 'test- figure0.log'. If you continue now, I'll try to typeset the picture.
See the tikz package documentation for explanation. Type H <return> for immediate help. ...
l.14 \end{tikzpicture}
I hope this is easier to read than my previous post :-)
-enable-write18command line option, do you? It is required for this to work. – Martin Scharrer Mar 22 '11 at 08:38-enable-write18option must be passed tolatex. The\tikzexternalizesetting is AFAIK only for sub-calls oflatex. Try to move this line before\tikzsetand have a lock at theuntitled-2-figure0.logfile mentioned in the error message. It might contain more information. – Martin Scharrer Mar 22 '11 at 09:03
– Moshe Rubin Mar 22 '11 at 09:26runsystem(latex -halt-on-error -interaction=batchmode -jobname "untitled-2-figure0" "\def\tikzexternalrealjob{untitled-2}\input{untitled-2}" && dvips -o "untitled-2-figure0".ps "untitled-2-figure0".dvi)...quotation error in system command.pdflatex --enable-write18and see if that works. – Andrew Stacey Mar 22 '11 at 09:29"\image".ps "\image".dvito"\image.ps" "\image.dvi". – Martin Scharrer Mar 22 '11 at 09:44I then ran it from the command line without MikTaX, using the following command:
– Moshe Rubin Mar 22 '11 at 09:59pdflatex -enable-write18 -output-format=dvi. It now runs correctly, outputting a DVI file. How do I get it to output an EPS file? The only two valid -output-format values are PDF and DVI.dvipscommand which is included should have converted it fromDVItoEPS. You can run it manually if you want. Depending on what you want exactly you could also try thestandaloneclass instead. – Martin Scharrer Mar 22 '11 at 10:58latex -halt-on-error -interaction=batchmode -jobname "untitled-2-figure0" "\def\tikzexternalrealjob{untitled-2}\input{untitled-2}" && dvips -o "untitled-2-figure0.ps" "untitled-2-figure0.dvi"from the command line. The&&is very unix-y and I don't know if it will work correctly in Windows. It does look as though now the first part of the command is working correctly but the second is not getting called, so that may be the culprit. – Andrew Stacey Mar 22 '11 at 13:10pdflatex -enable-write18on the command line, you should get extra files which are the image files. What format are they? The conversion to EPS only happens for the generated image files, not for the main file. – Andrew Stacey Mar 22 '11 at 13:11@Andrew: After many fruitless hours I decided to bite the bullet and go command-line, writing a batch/script file that runs pdflatex, dvips, and convert on a given PDF file outputted by TikZ.
Now I can finally get an EPS or TIFF file, but the quality is very degraded relative to the PDF. How can I improve the quality via convert? (Can I post graphics here?)
– Moshe Rubin Mar 23 '11 at 10:42@is notified. You should split this comments into two. The difference between PS and EPS should be minimal, i.e. setting the headers. Try to use Ghostscript to convert it. – Martin Scharrer Mar 23 '11 at 10:48convert %1.pdf %1.tiff. There is a myriad of command line options. How does one convert a PDF to a TIFF (or any other format) preserving the clarity of the image?