[OS X TeX] converting pdf to eps ... where can I find pdf2eps?

Maarten Sneep maarten.sneep at xs4all.nl
Wed Jul 7 05:14:28 EDT 2004


On 7 jul 2004, at 11:05, George Nurser wrote:

> I've been using TeXShop with pdf figures for a paper. The journal now
> want the figures in eps format for typesetting. They claim rather
> strangely that they cannot resize pdf figures.
>
> So ... how do I convert the pdf figures to eps? There is supposed to
> be a program pdf2eps, but  I don't seem to have it (Panther +
> Image magick). Anybody know where I can get it from?

I had a discussion about this with an editor from Elsevier Science. 
Your best
bet is to use gs, and while you're at it: replace all letters with 
their outlines.
You don't mention how you generate the figures, but in some cases it is 
the
only real way forward. Just for the archives, I copy some instructions 
I once
wrote down for my colleagues.

the guy from Elsevier claimed that they could handle pdf, but preferred 
eps,
if possible without fonts to prevent issues there. The figures 
generated with
the instructions provided below were tested and appeared to be working
without trouble. You'll need option 2, and pay some attention to the 
remarks
after the instructions.

Regards,

Maarten

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Submitting figures for publication.

One of the areas where things may go wrong when submitting an article
for publication can be the figures. This has (mainly) to do with the
fonts. There are two solutions to this problem. One solution (if the
journal supports it) is to use pdf-files, as all fonts -- or rather the
glyphs actually used in the figure -- are included in the file. This
leads to very predictable results. the other solution requires removal
of the use of all fonts from a file. This leaves no lettering that can
go wrong. I'll explain both methods -- and especially the last one -- in
more detail below, including some useful commands to get the files.

Option 1: use pdf.

There are several options to obtain pdf-files. xmgrace (shudder) has an
option to export to pdf directly, Illustrator can export to pdf (in fact
its native format is an elaborate form of pdf). I have created all my
figures in MetaPost, and for that format the programs mpost and mptopdf
take care of the conversion to pdf.

You can verify that your pdf is functioning correctly, by opening it in
Acrobat Reader, and select the font information in the document info
window (in acrobat 5 under linux: the small triangle in the top-right
corner of the window). If all fonts are listed as "Type 1, embedded
sub-set", you're golden.

For personal use, I advice you to translate all your figures into pdf,
if needed with the epstopdf tool on the command-line. The pdf-format
allows for much easier and consistent verification of the final output.


Option 2: use eps, without the use of fonts for the glyphs.

This may sound nuts: how can you label anything, without using any
fonts? Letters are just small but complicated drawings, and instead of
instructing the printer to use the letter "a" from font "Times", you put
the curves and lines for that letter in your file. This is called
replacing text by its outlines, and can be done by using ghostscript.
Note that there is one drawback: the text disappears from the file, and
can no longer be easily editted (say with Illustrator). Also the
instructions in a font are compressed, so the final file will be
somewhat bigger. If you need to put equations into an Illustrator file,
or in any drawing application that supports eps files, this trick may be
applied to snippets for LaTeX code, an example follows below.

For submitting metapost based figures as eps, it is imperative to
replace all fonts by their outlines, as the raw eps code produced by
metapost is fundamentally unusable by most applications (notably
Illustrator, which is used by Elsevier to touch up and check incoming
files). The method discussed below generates the eps files that Elsevier
(and possibly others) can use without trouble. Elsevier accepts
pdf-files for most journals, but likes eps files better.

Whether you have a figure in eps or in pdf format, if the journal
requires you to deliver an eps file, you can use ghostscript to create
this file, and remove font-dependencies at the same time:

	gs -dNOPAUSE -dNOCACHE -dBATCH -sDEVICE=epswrite \
		-sOutputFile=your-output-file.eps \
		your-source-file.eps

A few notes:
- Do not give the input- and output files the same name.
- you can translate the result into pdf (with epstopdf) to verify that
   there are indeed no fonts used in the result.
- replace the file-names with actual names.
- When something is involved that uses LaTeX in any way, start from a
   known good pdf.
- Ghostscript can read pdf-files, so your-source-file.eps may be 
replaced
   by your-source-file.pdf

Now the bonus subject: getting LaTeX formatted equations into another
drawing application. I'll just give an example, you figure it out.

%%% sample file: rayleigh-dist.tex
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath} % slightly more advanced mathematical typesetting.
\usepackage{txfonts} % most journals require times or similar.
\pagestyle{empty}    % you do not want to include a pagenumber...
\begin{document}
\begin{equation*} % no equation number
	I_{\text{\scriptsize n}}\left(\vartheta\right) =
	\left( {\frac{9 \pi^2 \bar\nu^4}{2 N^2}} \right)
	\left( {\frac{n_{\bar\nu}^2-1}{n_{\bar\nu}^2+2}} \right)^{\!2}
	\left( 1 + \cos^2 \vartheta \right)
\end{equation*} % the Rayleigh intensity distribution.
\end{document}
%%% end of sample file

- run the above file through latex and dvips:

	elatex rayleigh-dist
	dvips -o rayleigh-dist.tmp.eps -E rayleigh-dist.dvi

- run the eps through ghostscript, translating all letters into
   outlines:

	gs -dNOPAUSE -dNOCACHE -dBATCH -sDEVICE=epswrite \
		-sOutputFile=rayleigh-dist.eps \
		rayleigh-dist.tmp.eps

Full steps for producing metapost based eps for submitting to a journal.

- make your metapost source file.
- turn your description into metapost output:
	mpost -tex=latex source.mp
- turn the metapost-output into pdf (repeat for all figures in this
   input file):
	mptopdf source.0
- turn the pdf into eps with font-outlines:
	gs -dNOPAUSE -dNOCACHE -dBATCH -sDEVICE=epswrite \
		-sOutputFile=source.eps \
		source-0.pdf

%%% Begin of sample metapost file
%%% In case you're wondering: this is the angular distribution of 
scattered radiation
%%% from a molecule (Rayleigh scattering).
verbatimtex
%&latex
\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
etex

prologues := 2 ; % create structures PS.

beginfig(0) ;
	picture myDash;
	myDash := dashpattern( on 4pt off 2pt );
	
	%% a graph of the intensity distribution of the scattered light 
(natural light version)
	draw (0,0) -- (3.2cm,0) withpen pencircle scaled 0.5pt withcolor black;
	draw (0,-1.676cm) -- (0,1.676cm) withpen pencircle scaled 0.5pt 
withcolor black;
	drawarrow (-3.2cm,0) -- (-4pt,0) withpen pencircle scaled 1pt 
withcolor black;
	draw (-4pt,0) -- (0,0)  withpen pencircle scaled 0.5pt withcolor black 
;
	draw btex light etex shifted (-2.5cm,2mm);
		
	draw for i=0 step 5 until 360:
		1.524cm * ((sind(i))**2) * (sind(i), cosd(i)) ..
	endfor cycle dashed myDash withpen pencircle scaled 0.5pt ; % 
withcolor 0.5*white;
	draw for i=0 step 5 until 360:
		1.524cm * (sind(i), cosd(i)) ..
	endfor cycle dashed myDash withpen pencircle scaled 0.5pt ; % 
withcolor 0.5*white;
	draw for i=0 step 5 until 360:
		1.524cm * (1 + ((sind(i))**2)) * (sind(i), cosd(i)) ..
	endfor cycle withpen pencircle scaled 0.5pt withcolor black;
	
	draw origin -- (3.2cm,0) rotated 20 withpen pencircle scaled 0.5pt 
withcolor black;
	drawarrow for i=0 step 4 until 16:
		((2.2857cm,0) rotated i) ..
	endfor ((2.2857cm,0) rotated 20) withpen pencircle scaled 0.5pt 
withcolor black;
	draw btex $\vartheta$ etex rotated -10 shifted (2.438cm,-3pt) rotated 
10;
	
	fill fullcircle scaled 3pt withcolor black;
endfig ;

verbatimtex
\end{document}
etex

end
%%% end of sample metapost file

Note that pdflatex can include metapost output directly, although it 
might
be a good idea to replace the extension (.0, .1, ...) by .mps, otherwise
latex may not recognize the format. This has the advantage that any 
fonts
that are used in the figures will not be included multiple times. Pdftex
inserts the figure files without alterations, and fonts can thus be 
included
multiple times. Having pdftex do the translation merges the characters 
used
in the whole file, and thus prevents this double inclusion. The 
disadvantage
is that the translation is relatively slow, and you may run out of some 
types
of memory in latex (and you cannot enlarge those sizes any further) -- 
you
need to be pretty extreme here though. For draft usage, I'd advice to
pre-translate the metapost output into pdf, as it dramatically reduces 
the
latex run-time.

-----------------------------------------------------
Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the MacOSX-TeX mailing list