1PURIFYEPS(1) PURIFYEPS(1)
2
3
4
6 purifyeps - make an Encapsulated PostScript file work with both dvips
7 and pdflatex
8
10 purifyeps --help
11
12 purifyeps --version
13
14 purifyeps [--fontmap=.fmp file] [.eps input file [.eps output file]]
15
16 purifyeps --make-man[=filename] [--section=section]
17
18 purifyeps --make-ps-man[=filename] [--section=section]
19
21 While pdflatex has a number of nice features, its primary shortcoming
22 relative to standard latex+dvips is that it is unable to read ordinary
23 Encapsulated PostScript (EPS) files, the most common graphics format in
24 the LaTeX world. pdflatex can read only the following types of
25 graphics files:
26
27 PDF Most people who use pdflatex convert their documents to PDF using a
28 utility such as epstopdf. This works well and preserves the vector
29 nature of the original EPS. Unfortunately, dvips does not read
30 PDF, so two versions of the graphic must be maintained if the
31 document is to be processed with both latex+dvips and pdflatex.
32
33 PNG PNG is a bitmap format and therefore scales poorly. Also, dvips
34 does not read PNG, so two versions of the graphic must be
35 maintained if the document is to be processed with both latex+dvips
36 and pdflatex.
37
38 JPEG
39 JPEG is a bitmap format and therefore scales poorly. Also, dvips
40 does not read JPEG, so two versions of the graphic must be
41 maintained if the document is to be processed with both latex+dvips
42 and pdflatex.
43
44 MPS This is probably the least-used pdflatex-compatible graphics
45 format. MPS is actually a stylized version of EPS that MetaPost
46 outputs. Like PDF, MPS is a vector format and remains as such when
47 imported into a pdflatex document. Also like PDF, dvips does not
48 read MPS, so two versions of the graphic must be maintained if the
49 document is to be processed with both latex+dvips and pdflatex.
50
51 The insight behind purifyeps is that there are only a few, small
52 differences between MPS and EPS and that a file can be converted into a
53 format that matches both the MPS and EPS specifications simultaneously.
54 purifyeps inputs an EPS file, uses pstoedit's "mpost" filter to convert
55 the file to MetaPost (.mp), runs mpost on the file to convert it to
56 MPS, and finally performs some touchups on the result to convert the
57 file back to EPS, while preserving its ability to be parsed by
58 pdflatex.
59
61 --help
62 Display "Usage" and "Options" from the purifyeps documentation.
63
64 -V, --version
65 Display the purifyeps version number, copyright, and license.
66
67 --fontmap=.fmp file
68 Specify the name of a file that tells purifyeps how to map from TeX
69 font names to PostScript font names. [Default: mpost.fmp]
70
71 --make-man [=filename]] [--section=section]
72 Automatically create a Unix man page for purifyeps. section
73 specifies the section [default: 1 (User Commands)]. filename
74 defaults to purifyeps.1 or an analogous filename if section is
75 specified.
76
77 --make-ps-man [=filename]] [--section=section]
78 Automatically create a PostScript version of the purifyeps
79 documentation. The documentation is formatted like a Unix man
80 page. section specifies the section [default: 1 (User Commands)].
81 filename defaults to purifyeps.ps.
82
83 In normal operation (i.e., when not run with "--help", "--make-man", or
84 "--make-ps-man"), purifyeps takes the name of an input file and output
85 file. The same filename can safely be used for both files. If the
86 output filename is omitted, output will go to the standard output
87 device. If the input filename is omitted, purifyeps will read from the
88 standard input device.
89
91 Create a PostScript version of the purifyeps documentation, but call it
92 happydoc.ps instead of the default, purifyeps.ps:
93
94 purifyeps --make-ps-man=happydoc.ps
95
96 Create a Unix man page for purifyeps (in the usual roff format), but
97 indicate that it belongs in section "LOCAL" instead of the default of
98 section 1:
99
100 purifyeps --make-man --section=LOCAL
101
102 Purify sample.eps (mpost.fmp is in the current directory):
103
104 purifyeps sample.eps sample.eps
105
106 Purify sample.eps (mpost.fmp is in a different location):
107
108 purifyeps --fontmap=/usr/share/pstoedit/mpost.fmp sample.eps sample.eps
109
110 Rename the purified version while purifying:
111
112 purifyeps sample.eps sample-pure.eps
113
114 Do the same, but in a Unix pipeline:
115
116 cat sample.eps | purifyeps > sample-pure.eps
117
118 When you run purifyeps, you should see the output from both pstoedit
119 and mpost, followed by a success message from purifyeps:
120
121 % cat sample.eps | purifyeps > sample-pure.eps
122 pstoedit: version 3.30 / DLL interface 107 (build Mar 14 2002) :
123 Copyright (C) 1993 - 2001 Wolfgang Glunz
124 Interpreter finished. Return status 0
125 This is MetaPost, Version 0.641 (Web2C 7.3.1)
126 (/tmp/purifyeps-jdeGPkh9.mp [1] )
127 1 output file written: purifyeps-jdeGPkh9.1
128 Transcript written on purifyeps-jdeGPkh9.log.
129
130 File seems to have been purified successfully.
131
133 mpost.fmp
134 File containing mappings between TeX and PostScript font names.
135 See "NOTES" for a description of this file's contents.
136
138 Error reporting could definitely stand to be improved. Error messages
139 produced by pstoedit and mpost are sometimes silently ignored. Also,
140 errors sometimes cause purifyeps to leave temporary files
141 (purifyeps-#####) lying around.
142
143 purifyeps is subject to all of the limitations that affect pstoedit and
144 especially the "mpost" backend to pstoedit. As a result, purifyeps
145 ignores certain PostScript constructs, such as nonuniformly scaled
146 text.
147
149 purifyeps needs a file that tells it how to map from TeX font names to
150 PostScript font names. This file must contain two, space-separated
151 columns. The first lists a PostScript font name, and the second lists
152 the TeX equivalent. Blank lines and lines that start with "%" are
153 ignored. The following is a sample .fmp file:
154
155 % This is a sample font map for purifyeps.
156 Times-Bold ptmb
157 Times-Italic ptmri
158 Times-Roman ptmr
159 Helvetica phvr
160 Helvetica-Bold phvb
161 Helvetica-Oblique phvro
162 Courier pcrr
163 Courier-Bold pcrb
164 Courier-Oblique pcrro
165
166 Note that this is exactly the same format that pstoedit uses. By
167 default, purifyeps looks in the current directory for a font map called
168 mpost.fmp. The "--fontmap" command-line option tells purifyeps to use
169 a different font map, which will typically be the mpost.fmp file that
170 comes with pstoedit.
171
172 Once you create purified EPS files with purifyeps, you need to instruct
173 pdflatex to use them. The pdfLaTeX configuration of the "graphics" and
174 "graphicx" packages (pdftex.def) normally ignores .eps files. Putting
175 the following LaTeX code in your document's preamble tells pdflatex
176 that all .eps files are in MPS format:
177
178 % Tell pdfLaTeX that all .eps files were produced by MetaPost.
179 \usepackage{graphicx} % or graphics
180 \usepackage{ifpdf}
181 \ifpdf
182 \DeclareGraphicsRule{.eps}{mps}{*}{}
183 \makeatletter
184 \g@addto@macro\Gin@extensions{,.eps}
185 \makeatother
186 \fi
187
189 dvips(1), epstopdf(1), latex(1), mpost(1), pdflatex(1), pstoedit(1)
190
192 Scott Pakin, scott+peps@pakin.org
193
194
195
196v1.1 2010-11-28 PURIFYEPS(1)