Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem with image converting for scientific manuscript. I have been using gnuplot to make graphs, using TikZ terminal, and finally generating the figure as a PDF with LaTeX. It results in a nice vector graphic image, in PDF file format (PDFLaTeX). The problem is that publishers ask for images in EPS format. When I try to convert my PDF with Imagemagick or pdf2ps, I get a low resolution rasterized image. But as far as I know eps is also a vector graphic format. I tried to set the resolution for conversion, but I get the same low resolution image. Is there a way to convert my vector graphic PDF to vector graphic EPS? Or anyone knows a way to export in eps from gnuplot with LaTeX typesetting/fonts?

Thanks,

share|improve this question
1  
I thought, the TikZ terminal should also allow to compile to eps, but that doesn't work for me. Otherwise you can use the epslatex and the cairolatex eps terminal to generate eps output graphics with LaTeX text. –  Christoph Sep 22 '13 at 17:15
3  
Use pdftops rather than convert (from ImageMagick). –  cyanide-based food Sep 22 '13 at 17:17

1 Answer 1

up vote 5 down vote accepted

Use pdftops rather than convert (from ImageMagick). The command is

pdftops -f <first-page> -l <last-page> -eps <input.pdf> <output.eps>

For example,

pdftops -f 4 -l 4 -eps input.pdf output.pdf

Simulator

Try the following to diagnose your problem.

% simulator.tex
\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}

\begin{filecontents*}{input.tex}
\documentclass[preview,border=12pt]{standalone}
\usepackage{tikz}
\begin{document}
This is a TikZ output.
\begin{tikzpicture}
    \draw (0,0) circle (2);
\end{tikzpicture}
\tikz\fill[red] (0,0) ellipse (3pt and 5pt); is an ellipse. 
\end{document}
\end{filecontents*}

\immediate\write18{pdflatex input}
\immediate\write18{pdftops -f 1 -l 1 -eps input.pdf output.eps}

\usepackage{graphicx}
\begin{document}
I am importing EPS image.\\
\includegraphics{output}
\end{document}

enter image description here

Compile the code above with

latex -shell-escape simulator
dvips simulator
ps2pdf -dAutoRotatePages=/None simulator.ps

As ps2pdf sometimes rotates the output automatically, please use -dAutoRotatePages=/None to prevent it from doing such an unwanted rotation.

If you are using Windows, use # instead of = in -dAutoRotatePages=/None because = has a special meaning for batch files in Windows.

Very important notes

If you use opacity in your TikZ code (PSTricks code as well), for example,

\documentclass[preview,border=12pt]{standalone}
\usepackage{tikz}
\begin{document}
This is a TikZ output.
\begin{tikzpicture}
    \draw (0,0) circle (2);
\end{tikzpicture}
\tikz\fill[red,fill opacity=.5] (0,0) ellipse (3pt and 5pt); is an ellipse. 
\end{document}

then you will get a rasterized output as follows.

enter image description here

share|improve this answer
    
I have the same problem with pdftops or pdf2ps as with convert. –  Balazs Sep 22 '13 at 17:29
    
Ok, it works. pdftops is the solution. Thank you very much. I thought pdftops is not working because I only looked at the eps in an image viewer. When I included it in a latex file and generated the pdf with pdflatex, I got perfect result. Thanks again! –  Balazs Sep 22 '13 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.