I recently submitted a paper in a journal that was accepted but the editor is requesting all the Figures to be exported in an .eps format. My figures are using different eps files every time but most of my figures have subfigures that have different scales, minipages and so on. For instance Figure 1 has 4 subfigures (each of them is already an eps image) but the editor requires an eps image that has those subfigures placed the way I want them to be placed in the article. I know how to export a LaTeX file as a pdf but I do not know if it is possible to export a LaTeX file as eps file. Also I want to keep the quality of the images intact so I would like to save them with the highest resolution possible. Does anyone know how to do that?
[Tex/LaTex] Create eps files from LaTeX figures
epsfloatspdftex
Related Solutions
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}
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.
Method A: Dealing directly with PostScript
Since you're dealing with PostScript images, one option might be to use GhostView; I've done so successfully in the past. As an example, consider tiger.eps
.
Open
tiger.eps
using GhostView.Show the bounding box if you wish to see the extent of the existing whitespace:
Position the cursor on to identify the left, bottom, right and top coordinates. In my example, these are l b r t = 15 175 564 743.
Open
tiger.eps
and find the lines starting with%%BoundingBox
in the "preamble":%!PS-Adobe-2.0 EPSF-1.2 %%BoundingBox: 1 2 611 792
Update this to incorporate the new bounding box:
%!PS-Adobe-2.0 EPSF-1.2 %%BoundingBox: 15 175 564 743
There may also be a
%%HiResBoundingBox
entry, which you can update accordingly.Refresh the view in GhostView which now shows the cropped bounding box:
Include as usual via
\includegraphics
, since the bounding box has been permanently updated. If you don't want to update the EPS permanently, you can also use\includegraphics[...,bb=15 175 564 743, clip=true...]{tiger}
in your document.
Method B: Cropping via PDF
Use the command-line conversion
epstopdf tiger.eps
which produces
tiger.pdf
.Use
pdfcrop
pdfcrop tiger.pdf
which produces
tiger-crop.pdf
.Convert back to EPS using
pdftops -eps tiger-crop.pdf tiger.eps
to overwrite
tiger.eps
with a now-cropped version:New bounding box resembles
%%BoundingBox: 0 0 548 576
which is marginally different to the manual way described in Method A (which yielded a width of 564 - 15 = 549; height of 743 - 175 = 568).
Best Answer
If you don't mind doing it manually, you can open the paper PDF using inkscape (a vector graphics editor), where you will be prompted to select one of the pages to edit.
From there, you can select the vector objects corresponding to the figure, go to
File > Document Properties > Resize page to content ...
. You should probably delete the other objects, in case the journal eps rendering doesn't respect the new bounding box. ThenFile > Save As
and selectEPS
in the file type.MWE
Code
Result
Aside: sounds like this journal needs to update their toolchain. This feels very wrong...