SYNOPSIS

purifyeps --help

purifyeps --version

purifyeps [--fontmap=.fmp file] [.eps input file [.eps output file]]

purifyeps --make-man[=filename] [--section=section]

purifyeps --make-ps-man[=filename] [--section=section]

DESCRIPTION

While pdflatex has a number of nice features, its primary shortcoming relative to standard latex+dvips is that it is unable to read ordinary Encapsulated PostScript (\s-1EPS\s0) files, the most common graphics format in the LaTeX world. pdflatex can read only the following types of graphics files:

\s-1PDF\s0

Most people who use pdflatex convert their documents to \s-1PDF\s0 using a utility such as epstopdf. This works well and preserves the vector nature of the original \s-1EPS\s0. Unfortunately, dvips does not read \s-1PDF\s0, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex.

\s-1PNG\s0

\s-1PNG\s0 is a bitmap format and therefore scales poorly. Also, dvips does not read \s-1PNG\s0, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex.

\s-1JPEG\s0

\s-1JPEG\s0 is a bitmap format and therefore scales poorly. Also, dvips does not read \s-1JPEG\s0, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex.

\s-1MPS\s0

This is probably the least-used pdflatex-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 pdflatex document. Also like \s-1PDF\s0, dvips does not read \s-1MPS\s0, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex.

The insight behind purifyeps 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. purifyeps inputs an \s-1EPS\s0 file, uses pstoedit's \*(C`mpost\*(C' filter to convert the file to MetaPost (.mp), runs mpost 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 pdflatex.

OPTIONS

--help

Display \*(L"Usage\*(R" and \*(L"Options\*(R" from the purifyeps documentation.

-V, --version

Display the purifyeps version number, copyright, and license.

--fontmap=.fmp file

Specify the name of a file that tells purifyeps how to map from TeX font names to PostScript font names. [Default: mpost.fmp]

--make-man [=filename]] [--section=section]

Automatically create a Unix man page for purifyeps. section specifies the section [default: 1 (User Commands)]. filename defaults to purifyeps.1 or an analogous filename if section is specified.

--make-ps-man [=filename]] [--section=section]

Automatically create a PostScript version of the purifyeps documentation. The documentation is formatted like a Unix man page. section specifies the section [default: 1 (User Commands)]. filename defaults to purifyeps.ps.

In normal operation (i.e., when not run with \*(C`--help\*(C', \*(C`--make-man\*(C', or \*(C`--make-ps-man\*(C'), purifyeps 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, purifyeps will read from the standard input device.

EXAMPLES

Create a PostScript version of the purifyeps documentation, but call it happydoc.ps instead of the default, purifyeps.ps:

    purifyeps --make-ps-man=happydoc.ps

Create a Unix man page for purifyeps (in the usual roff format), but indicate that it belongs in section \*(C`LOCAL\*(C' instead of the default of section 1:

purifyeps --make-man --section=LOCAL

Purify sample.eps (mpost.fmp is in the current directory):

purifyeps sample.eps sample.eps

Purify sample.eps (mpost.fmp is in a different location):

purifyeps --fontmap=/usr/share/pstoedit/mpost.fmp sample.eps sample.eps

Rename the purified version while purifying:

purifyeps sample.eps sample-pure.eps

Do the same, but in a Unix pipeline:

cat sample.eps | purifyeps > sample-pure.eps

When you run purifyeps, you should see the output from both pstoedit and mpost, followed by a success message from purifyeps:

% 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.

FILES

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.

BUGS

Error reporting could definitely stand to be improved. Error messages produced by pstoedit and mpost are sometimes silently ignored. Also, errors sometimes cause purifyeps to leave temporary files (purifyeps-#####) lying around.

purifyeps is subject to all of the limitations that affect pstoedit and especially the \*(C`mpost\*(C' backend to pstoedit. As a result, purifyeps ignores certain PostScript constructs, such as nonuniformly scaled text.

NOTES

purifyeps 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 \*(C`%\*(C' are ignored. The following is a sample .fmp file:

% 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

Note that this is exactly the same format that pstoedit uses. By default, purifyeps looks in the current directory for a font map called mpost.fmp. The \*(C`--fontmap\*(C' command-line option tells purifyeps to use a different font map, which will typically be the mpost.fmp file that comes with pstoedit.

Once you create purified \s-1EPS\s0 files with purifyeps, you need to instruct pdflatex to use them. The pdfLaTeX configuration of the \*(C`graphics\*(C' and \*(C`graphicx\*(C' packages (pdftex.def) normally ignores .eps files. Putting the following LaTeX code in your document's preamble tells pdflatex that all .eps files are in \s-1MPS\s0 format:

% Tell pdfLaTeX that all .eps files were produced by MetaPost. \usepackage{graphicx} % or graphics \usepackage{ifpdf} \ifpdf \DeclareGraphicsRule{.eps}{mps}{*}{} \makeatletter \g@addto@macro\Gin@extensions{,.eps} \makeatother \fi

RELATED TO purifyeps…

dvips\|(1), epstopdf\|(1), latex\|(1), mpost\|(1), pdflatex\|(1), pstoedit\|(1)

AUTHOR

Scott Pakin, [email protected]