I have followed the instructions for exporting to an .eps
file from a TikZ drawing provided here: https://tex.stackexchange.com/a/8646/8078. However, I cannot get any of the methods to produce an .eps
file successfully.
I am working on a MAC, OS 10.6.8, running MacTeX via TexShop.
When I use the following code, a .pdf
is created, but no .eps
file is created. Here is the code:
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzset{external/system call={pdflatex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" &&
pdftops -eps "\image".pdf}}
\tikzexternalize
\begin{document}
\tikzset{external/force remake}
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\end{document}
As suggested in https://tex.stackexchange.com/a/8646/8078, I also try alternative ways to create the .eps
, namely, using the following code, where the system call is changed, and latex
is used to compile, rather than pdflatex
:
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource";
dvips -o "\image".ps "\image".dvi;
ps2eps "\image.ps"}}
\tikzexternalize
\begin{document}
\tikzset{external/force remake}
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\end{document}
In this case, I get the following error message:
./tikz_eps2.tex:55: Package tikz Error: Sorry, the system call 'latex -shell-es cape -halt-on-error -interaction=batchmode -jobname "tikz_eps2-figure0" "\def\t ikzexternalrealjob{tikz_eps2}\input{tikz_eps2}"; dvips -o "tikz_eps2-figure0".p s "tikz_eps2-figure0".dvi; ps2eps "tikz_eps2-figure0.ps"' did NOT result in a u sable output file 'tikz_eps2-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflat ex -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 'tikz_eps2 -figure0.log'. If you continue now, I'll try to typeset the picture.
I hit return, latex continues to compile a .pdf
. As a result, a .ps
is created that I can open, but the .eps
file that is created is "empty." That is, when I try to open the .eps
it with Preview
, I get the error "Warning: Empty Job. No PDF file produced." Or, if I open the .eps
file in Adobe Illustrator, all that shows is a blank canvace.
Finally, I also use this syntax for the extranlize command:
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" &&
dvips -o "\image".ps "\image".dvi &&
ps2eps "\image.ps"}}
\tikzexternalize[shell escape=-enable-write18]
After this, I get the same result as in the second case.
I should also mention that I try to directly use ps2eps
to convert the .ps
an .eps
in OS X Terminal. I get the following message in Terminal:
Input files: /Users/nomad/Dropbox/tex_remote/TiKz/tikz_eps2-figure0.ps Processing: /Users/nomad/Dropbox/tex_remote/TiKz/tikz_eps2-figure0.ps Rendering with existing %%BoundingBox: 0 0 345 225 Calculating Bounding Box...ready. %%BoundingBox: 4 3 332 225 Creating output file /Users/nomad/Dropbox/tex_remote/TiKz/tikz_eps2-figure0.eps ... ready.
However, the resulting .eps
is still "blank" as in the previous cases.
--shell-escape
enabled in yourpdflatex
command in TeXShop? Your first example works fine for me, with the same setup. In the TeXShop preferences, under the Engines tab, the command forpdflatex
should bepdflatex --file-line-error --synctex=1 --shell-escape
. This was a recent change in TeXShop preferences.--shell-escape
used to be enabled by default, but now it's not.--shell-escape
is enabled in my TeXShop preferences. I must also make a correction to my question. When I run the first example, no.eps
is output, only a.pdf
file. Can you confirm that running this on your system produces a well-functioning.eps
version of the graphic?latex --shell-escape
I get the expected result (Mac OS X, 10.5, though; it shouldn't make any difference).foo.tex
I get 3 output files: afoo.pdf
file and two image files:foo-figure0.pdf
andfoo-figure0.eps
. The.eps
file opens fine with Preview (which converts it to pdf) or for that matter, Adobe Illustrator (albeit with font substitutions).