summaryrefslogtreecommitdiff
path: root/support/purifyeps/purifyeps.1
blob: 0b3121ab24f9dffd1a826e2613b0bc6f61a2760b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PURIFYEPS 1"
.TH PURIFYEPS 1 "2010-11-28" "v1.1" ""
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
purifyeps \- make an Encapsulated PostScript file work with both dvips and
pdflatex
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
purifyeps
\&\fB\-\-help\fR
.PP
purifyeps
\&\fB\-\-version\fR
.PP
purifyeps
[\fB\-\-fontmap\fR=\fI.fmp file\fR]
[\fI.eps input file\fR [\fI.eps output file\fR]]
.PP
purifyeps
\&\fB\-\-make\-man\fR[=\fIfilename\fR] [\fB\-\-section\fR=\fIsection\fR]
.PP
purifyeps
\&\fB\-\-make\-ps\-man\fR[=\fIfilename\fR] [\fB\-\-section\fR=\fIsection\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
While \fBpdflatex\fR has a number of nice features, its primary
shortcoming relative to standard \fBlatex\fR+\fBdvips\fR is that it is
unable to read ordinary Encapsulated PostScript (\s-1EPS\s0) files, the most
common graphics format in the LaTeX world.  \fBpdflatex\fR can read only
the following types of graphics files:
.IP "\s-1PDF\s0" 4
.IX Item "PDF"
Most people who use \fBpdflatex\fR convert their documents to \s-1PDF\s0 using a
utility such as \fBepstopdf\fR.  This works well and preserves the vector
nature of the original \s-1EPS\s0.  Unfortunately, \fBdvips\fR does not read
\&\s-1PDF\s0, so two versions of the graphic must be maintained if the document
is to be processed with both \fBlatex\fR+\fBdvips\fR and \fBpdflatex\fR.
.IP "\s-1PNG\s0" 4
.IX Item "PNG"
\&\s-1PNG\s0 is a bitmap format and therefore scales poorly.  Also, \fBdvips\fR
does not read \s-1PNG\s0, so two versions of the graphic must be maintained
if the document is to be processed with both \fBlatex\fR+\fBdvips\fR and
\&\fBpdflatex\fR.
.IP "\s-1JPEG\s0" 4
.IX Item "JPEG"
\&\s-1JPEG\s0 is a bitmap format and therefore scales poorly.  Also, \fBdvips\fR
does not read \s-1JPEG\s0, so two versions of the graphic must be maintained
if the document is to be processed with both \fBlatex\fR+\fBdvips\fR and
\&\fBpdflatex\fR.
.IP "\s-1MPS\s0" 4
.IX Item "MPS"
This is probably the least-used \fBpdflatex\fR\-compatible graphics
format.  \s-1MPS\s0 is actually a stylized version of \s-1EPS\s0 that MetaPost
outputs.  Like \s-1PDF\s0, \s-1MPS\s0 is a vector format and remains as such when
imported into a \fBpdflatex\fR document.  Also like \s-1PDF\s0, \fBdvips\fR does
not read \s-1MPS\s0, so two versions of the graphic must be maintained if the
document is to be processed with both \fBlatex\fR+\fBdvips\fR and
\&\fBpdflatex\fR.
.PP
The insight behind \fBpurifyeps\fR is that there are only a few, small
differences between \s-1MPS\s0 and \s-1EPS\s0 and that a file can be converted into
a format that matches both the \s-1MPS\s0 and \s-1EPS\s0 specifications
simultaneously.  \fBpurifyeps\fR inputs an \s-1EPS\s0 file, uses \fBpstoedit\fR's
\&\f(CW\*(C`mpost\*(C'\fR filter to convert the file to MetaPost (\fI.mp\fR), runs
\&\fBmpost\fR on the file to convert it to \s-1MPS\s0, and finally performs some
touchups on the result to convert the file back to \s-1EPS\s0, while
preserving its ability to be parsed by \fBpdflatex\fR.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
Display \*(L"Usage\*(R" and \*(L"Options\*(R" from the \fBpurifyeps\fR documentation.
.IP "\fB\-V\fR, \fB\-\-version\fR" 4
.IX Item "-V, --version"
Display the \fBpurifyeps\fR version number, copyright, and license.
.IP "\fB\-\-fontmap\fR=\fI.fmp file\fR" 4
.IX Item "--fontmap=.fmp file"
Specify the name of a file that tells \fBpurifyeps\fR how to map from TeX
font names to PostScript font names.  [Default: \fImpost.fmp\fR]
.IP "\fB\-\-make\-man\fR [=\fIfilename\fR]] [\fB\-\-section\fR=\fIsection\fR]" 4
.IX Item "--make-man [=filename]] [--section=section]"
Automatically create a Unix man page for \fBpurifyeps\fR.  \fIsection\fR
specifies the section [default: \f(CW1\fR (User Commands)].  \fIfilename\fR
defaults to \fIpurifyeps.1\fR or an analogous filename if \fIsection\fR is
specified.
.IP "\fB\-\-make\-ps\-man\fR [=\fIfilename\fR]] [\fB\-\-section\fR=\fIsection\fR]" 4
.IX Item "--make-ps-man [=filename]] [--section=section]"
Automatically create a PostScript version of the \fBpurifyeps\fR
documentation.  The documentation is formatted like a Unix man page.
\&\fIsection\fR specifies the section [default: \f(CW1\fR (User Commands)].
\&\fIfilename\fR defaults to \fIpurifyeps.ps\fR.
.PP
In normal operation (i.e., when not run with \f(CW\*(C`\-\-help\*(C'\fR, \f(CW\*(C`\-\-make\-man\*(C'\fR,
or \f(CW\*(C`\-\-make\-ps\-man\*(C'\fR), \fBpurifyeps\fR takes the name of an input file and
output file.  The same filename can safely be used for both files.  If
the output filename is omitted, output will go to the standard output
device.  If the input filename is omitted, \fBpurifyeps\fR will read from
the standard input device.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Create a PostScript version of the \fBpurifyeps\fR documentation, but
call it \fIhappydoc.ps\fR instead of the default, \fIpurifyeps.ps\fR:
.PP
.Vb 1
\&    purifyeps \-\-make\-ps\-man=happydoc.ps
.Ve
.PP
Create a Unix man page for \fBpurifyeps\fR (in the usual roff format),
but indicate that it belongs in section \f(CW\*(C`LOCAL\*(C'\fR instead of the
default of section \f(CW1\fR:
.PP
.Vb 1
\&    purifyeps \-\-make\-man \-\-section=LOCAL
.Ve
.PP
Purify \fIsample.eps\fR (\fImpost.fmp\fR is in the current directory):
.PP
.Vb 1
\&    purifyeps sample.eps sample.eps
.Ve
.PP
Purify \fIsample.eps\fR (\fImpost.fmp\fR is in a different location):
.PP
.Vb 1
\&    purifyeps \-\-fontmap=/usr/share/pstoedit/mpost.fmp sample.eps sample.eps
.Ve
.PP
Rename the purified version while purifying:
.PP
.Vb 1
\&    purifyeps sample.eps sample\-pure.eps
.Ve
.PP
Do the same, but in a Unix pipeline:
.PP
.Vb 1
\&    cat sample.eps | purifyeps > sample\-pure.eps
.Ve
.PP
When you run \fBpurifyeps\fR, you should see the output from both
\&\fBpstoedit\fR and \fBmpost\fR, followed by a success message from
\&\fBpurifyeps\fR:
.PP
.Vb 8
\&    % cat sample.eps | purifyeps > sample\-pure.eps
\&    pstoedit: version 3.30 / DLL interface 107 (build Mar 14 2002) :
\&    Copyright (C) 1993 \- 2001 Wolfgang Glunz
\&    Interpreter finished. Return status 0
\&    This is MetaPost, Version 0.641 (Web2C 7.3.1)
\&    (/tmp/purifyeps\-jdeGPkh9.mp [1] )
\&    1 output file written: purifyeps\-jdeGPkh9.1
\&    Transcript written on purifyeps\-jdeGPkh9.log.
\&
\&    File seems to have been purified successfully.
.Ve
.SH "FILES"
.IX Header "FILES"
.IP "\fImpost.fmp\fR" 4
.IX Item "mpost.fmp"
File containing mappings between TeX and PostScript font names.  See
\&\*(L"\s-1NOTES\s0\*(R" for a description of this file's contents.
.SH "BUGS"
.IX Header "BUGS"
Error reporting could definitely stand to be improved.  Error messages
produced by \fBpstoedit\fR and \fBmpost\fR are sometimes silently ignored.
Also, errors sometimes cause \fBpurifyeps\fR to leave temporary files
(\fIpurifyeps\-\fR\fI#####\fR) lying around.
.PP
\&\fBpurifyeps\fR is subject to all of the limitations that affect
\&\fBpstoedit\fR and especially the \f(CW\*(C`mpost\*(C'\fR backend to \fBpstoedit\fR.  As a
result, \fBpurifyeps\fR ignores certain PostScript constructs, such as
nonuniformly scaled text.
.SH "NOTES"
.IX Header "NOTES"
\&\fBpurifyeps\fR needs a file that tells it how to map from TeX font names
to PostScript font names.  This file must contain two, space-separated
columns.  The first lists a PostScript font name, and the second lists
the TeX equivalent.  Blank lines and lines that start with \f(CW\*(C`%\*(C'\fR are
ignored.  The following is a sample \fI.fmp\fR file:
.PP
.Vb 10
\&    % This is a sample font map for purifyeps.
\&    Times\-Bold                           ptmb
\&    Times\-Italic                         ptmri
\&    Times\-Roman                          ptmr
\&    Helvetica                            phvr
\&    Helvetica\-Bold                       phvb
\&    Helvetica\-Oblique                    phvro
\&    Courier                              pcrr
\&    Courier\-Bold                         pcrb
\&    Courier\-Oblique                      pcrro
.Ve
.PP
Note that this is exactly the same format that \fBpstoedit\fR uses.  By
default, \fBpurifyeps\fR looks in the current directory for a font map
called \fImpost.fmp\fR.  The \f(CW\*(C`\-\-fontmap\*(C'\fR command-line option tells
\&\fBpurifyeps\fR to use a different font map, which will typically be the
\&\fImpost.fmp\fR file that comes with \fBpstoedit\fR.
.PP
Once you create purified \s-1EPS\s0 files with \fBpurifyeps\fR, you need to
instruct \fBpdflatex\fR to use them.  The pdfLaTeX configuration of the
\&\f(CW\*(C`graphics\*(C'\fR and \f(CW\*(C`graphicx\*(C'\fR packages (\fIpdftex.def\fR) normally ignores
\&\fI.eps\fR files.  Putting the following LaTeX code in your document's
preamble tells \fBpdflatex\fR that all \fI.eps\fR files are in \s-1MPS\s0 format:
.PP
.Vb 9
\&    % Tell pdfLaTeX that all .eps files were produced by MetaPost.
\&    \eusepackage{graphicx} % or graphics
\&    \eusepackage{ifpdf}
\&    \eifpdf
\&      \eDeclareGraphicsRule{.eps}{mps}{*}{}
\&      \emakeatletter
\&        \eg@addto@macro\eGin@extensions{,.eps}
\&      \emakeatother
\&    \efi
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIdvips\fR\|(1), \fIepstopdf\fR\|(1), \fIlatex\fR\|(1), \fImpost\fR\|(1), \fIpdflatex\fR\|(1), \fIpstoedit\fR\|(1)
.SH "AUTHOR"
.IX Header "AUTHOR"
Scott Pakin, \fIscott+peps@pakin.org\fR