diff options
author | Karl Berry <karl@freefriends.org> | 2009-03-23 01:03:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-03-23 01:03:54 +0000 |
commit | 0d7813a806f9173dbe362878550169f0cad356aa (patch) | |
tree | 026ef4b5b337e6b720b9b7e04418e7f2be4c6cc6 | |
parent | af7d5f20724c4c7556806a2aa71f169789c599af (diff) |
new (old) script purifyeps
git-svn-id: svn://tug.org/texlive/trunk@12489 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/texlive/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/texlive/Makefile.in | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/purifyeps/README | 59 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/purifyeps/purifyeps | 511 | ||||
-rw-r--r-- | Master/texmf/doc/man/man1/purifyeps.1 | 350 | ||||
-rw-r--r-- | Master/texmf/doc/man/man1/purifyeps.pdf | bin | 0 -> 12632 bytes | |||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkginfo | 4 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 33 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-binextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-psutils.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/purifyeps.tlpsrc | 3 | ||||
-rw-r--r-- | TODO | 9 |
13 files changed, 964 insertions, 14 deletions
diff --git a/Build/source/texk/texlive/ChangeLog b/Build/source/texk/texlive/ChangeLog index a962520c401..11c36669b7e 100644 --- a/Build/source/texk/texlive/ChangeLog +++ b/Build/source/texk/texlive/ChangeLog @@ -1,3 +1,7 @@ +2009-03-23 Karl Berry <karl@tug.org> + + * Makefile.in (LINKED_SCRIPTS): add purifyeps. + 2009-03-10 Karl Berry <karl@tug.org> * Makefile.in (install-exec): also make a link to our man diff --git a/Build/source/texk/texlive/Makefile.in b/Build/source/texk/texlive/Makefile.in index 697419356b1..c59f90f3b68 100644 --- a/Build/source/texk/texlive/Makefile.in +++ b/Build/source/texk/texlive/Makefile.in @@ -39,6 +39,7 @@ LINKED_SCRIPTS = \ texmf-dist/scripts/ppower4/ppower4.texlua \ texmf-dist/scripts/pst-pdf/ps4pdf \ texmf-dist/scripts/pst2pdf/pst2pdf.pl \ + texmf-dist/scripts/purifyeps/purifyeps \ texmf-dist/scripts/texcount/TeXcount.pl \ texmf-dist/scripts/texloganalyser/texloganalyser \ texmf-dist/scripts/thumbpdf/thumbpdf.pl \ diff --git a/Master/texmf-dist/doc/support/purifyeps/README b/Master/texmf-dist/doc/support/purifyeps/README new file mode 100644 index 00000000000..25002cef1f7 --- /dev/null +++ b/Master/texmf-dist/doc/support/purifyeps/README @@ -0,0 +1,59 @@ + +---------------------------------------------+ + | PURIFYEPS | + | | + | Convert an ordinary Encapsulated PostScript | + | file (.eps) into one that works with both | + | LaTeX+dvips and pdfLaTeX. | + | | + | By Scott Pakin, scott+peps@pakin.org | + +---------------------------------------------+ + + +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 (EPS) files, the most common graphics format +in the LaTeX world. purifyeps converts EPS files into a "purified" +form that can be read by *both* LaTeX+dvips and pdfLaTeX. The trick +is that the standard LaTeX2e graphics packages can parse +MetaPost-produced EPS directly. Hence, purifyeps need only convert an +arbitrary EPS file into the same stylized format that MetaPost +outputs. + +Documentation is provided in Unix man-page format and in PDF +(U.S. letter-sized). In addition, executing "purifyeps --help" gives +basic command-line usage. + + +Requirements +------------ + +To run purifyeps, you will need the following: + + * Perl (http://www.cpan.org) + + * pstoedit (http://www.pstoedit.net/pstoedit) + + * a LaTeX distribution that includes MetaPost (mpost) + +purifyeps itself is a Perl script. On certain operating systems, you +may need to rename purifyeps (e.g., to purifyeps.pl) to notify the +system that purifyeps is, in fact, a Perl script. + + +Copyright and license +--------------------- + +Copyright (C) 2009 by Scott Pakin + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3c of this license +or (at your option) any later version. The latest version of this +license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3c or later is part of all distributions of LaTeX +version 2006/05/20 or later. diff --git a/Master/texmf-dist/scripts/purifyeps/purifyeps b/Master/texmf-dist/scripts/purifyeps/purifyeps new file mode 100755 index 00000000000..d1916891e3c --- /dev/null +++ b/Master/texmf-dist/scripts/purifyeps/purifyeps @@ -0,0 +1,511 @@ +#! /usr/bin/env perl + +################################################################ +# Convert an ordinary Encapsulated PostScript file (.eps) into # +# one that works with both LaTeX+dvips and pdfLaTeX # +# # +# By Scott Pakin <scott+peps@pakin.org> # +################################################################ + +our $VERSION = "1.0a"; +require 5.006_001; +use English; +use Getopt::Long; +use FindBin qw($Script); +use File::Basename; +use File::Temp qw(tempfile); +use File::Spec; +use Pod::Usage; +use Pod::Man; +use Cwd qw(cwd chdir); +use POSIX; +use warnings; +use strict; + +# Global variables +my $fontmap = "mpost.fmp"; # pstoedit-style font map file +my %TeX_to_PS; # Hash table representing the contents of the above +my $infile = "-"; # Input file (default: stdin) +my $outfile = "-"; # Output file (default: stdout) +my $tempbase; # Base name of temporary files + +######################################################################## + +# At the end of the program's execution, delete all of our temporary files. +END { + if (defined $tempbase) { + foreach my $tempfile ($tempbase, <$tempbase.*>) { + unlink $tempfile; + } + } +} + + +# Extract the first word from the given array. A word is either a +# single token or a quoted set of space-separated tokens. Return the +# first word followed by the remaining tokens. +sub extractName (@) +{ + my @tokens = @_; + my $firstWord; + + # Ensure we have a token to extract. + return (undef, @tokens) if $#tokens==-1; + + # Extract the first word from the token list. + $firstWord = shift @tokens; + if (substr ($firstWord, 0, 1) eq '"') { + while (substr ($firstWord, length($firstWord)-1, 1) ne '"') { + return (undef, @tokens) if $#tokens==-1; + $firstWord .= " " . shift @tokens; + } + $firstWord = substr ($firstWord, 1, length($firstWord)-2); + } + + # Return the word plus the remaining tokens. + return ($firstWord, @tokens); +} + + +# Execute a shell command, and die if it fails. +sub executeCommand ($) +{ + my $command = $_[0]; + if (system "$command 1>&2") { + die "${Script}: The following command failed with exit code @{[int($?/256)]}:\n $command\n"; + } +} + + +# Generate -- and optionally clean up -- a man page. +sub createManPage ($$$) +{ + my $manfile = $_[0]; # Name of file to produce + my $wantPS = $_[1]; # 1=produce PostScript, 0=produce troff + my $section = $_[2]; # Manual section that purifyeps belongs to + + # Produce a (*roff) man page. + my $parser = Pod::Man->new (center => "", + release => "v$VERSION", + section => $section); + $parser->parse_from_file ($PROGRAM_NAME, $manfile); + + # Touch up the man page, and use groff to write + # the result back to disk as a PostScript file. + return unless $wantPS; + open (MANFILE, "<$manfile") or die "${Script}: $! ($manfile)\n"; + my @manlines = <MANFILE>; + close MANFILE; + open (MANFILE, "|groff -man > $manfile") or die "${Script}: $! ($manfile)\n"; + foreach (@manlines) { + s/LaTeX/L\\h'-0.36m'\\v'-0.15'\\s-2A\\s+2\\v'0.15'\\h'-0.15m'TeX/g; + s/TeX/T\\h'-0.1667m'\\v'0.20'E\\v'-0.20'\\h'-0.125m'X/g; + s/\\\*\(--/--/g; + print MANFILE $_; + } + close MANFILE; +} + +######################################################################## + +# Initialize our base temporary filename. +(undef, $tempbase) = tempfile ($Script . "-XXXXXXXX", DIR => File::Spec->tmpdir()); + +# Process the command line. +my ($wanthelp, $wantman, $wantps, $wantversion); +my $versionmsg = "purifyeps version $VERSION + +Copyright (C) 2009 Scott Pakin + +This program may be distributed and/or modified under the conditions +of the LaTeX Project Public License, either version 1.3c of this +license or (at your option) any later version. + +The latest version of this license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3c or later is part of all distributions of LaTeX +version 2006/05/20 or later. +"; +my $man_section = 1; # Section number of man page +GetOptions ("fontmap=s" => \$fontmap, + "make-man:s" => \$wantman, + "make-ps-man:s" => \$wantps, + "section=s" => \$man_section, + "V|version" => \$wantversion, + "help" => \$wanthelp) || pod2usage(2); +do {print $versionmsg; exit 1} if $wantversion; +pod2usage(1) if $wanthelp; +if (defined $wantman) { + # Create a troff manual page. + my $filename = ($wantman eq "" ? + basename ($PROGRAM_NAME, ".pl") . ".$man_section" : + $wantman); + createManPage ($filename, 0, $man_section); + print STDERR "Wrote $filename\n"; + exit 0; +} +if (defined $wantps) { + # Create a PostScript manual page. + my $filename = ($wantps eq "" ? + basename ($PROGRAM_NAME, ".pl") . ".ps" : + $wantps); + createManPage ($filename, 1, $man_section); + print STDERR "Wrote $filename\n"; + exit 0; +} +$infile = shift @ARGV if $#ARGV!=-1; +$outfile = shift @ARGV if $#ARGV!=-1; +pod2usage(2) if $#ARGV!=-1; # Too many arguments. + +# Read the font map file into a hash table. +open (FONTMAP, "<$fontmap") || die "${Script}: $! ($fontmap)\n"; +FONTMAP_LINE: + while (<FONTMAP>) { + # Clean up the line. + chomp; + s/\%.*//; + my $origLine = $_; + next if /^\s*$/; + my @tokens = split " "; + + # Extract the PostScript name, which may be quoted and contain spaces. + my $PSname; + ($PSname, @tokens) = extractName @tokens; + if (!defined $PSname) { + warn "${fontmap}:$NR: warning: incorrect format -- ignoring line\n"; + next FONTMAP_LINE; + } + + # Extract the TeX name, which may also be quoted and contain spaces. + my $TeXname; + ($TeXname, @tokens) = extractName @tokens; + if (!defined $TeXname) { + warn "${fontmap}:$NR: warning: incorrect format -- ignoring line\n"; + next FONTMAP_LINE; + } + + # That should be the end of the line. + if ($#tokens != -1) { + warn "${fontmap}:$NR: warning: incorrect format -- ignoring line\n"; + next FONTMAP_LINE; + } + + # Store the mapping in a hash table. + # HEURISTIC: If the mapping is not unique, map the TeX + # name to the *shortest* PostScript name. + if (!defined $TeX_to_PS{$TeXname} || + length $PSname < length $TeX_to_PS{$TeXname}) { + $TeX_to_PS{$TeXname} = $PSname; + } + } +close FONTMAP; + +# Utilize pstoedit to convert from EPS to MetaPost. +my $mpfile = $tempbase . ".mp"; +executeCommand "pstoedit -ssp -f mpost -fontmap \"$fontmap\" \"$infile\" \"$mpfile\""; + +# Utilize mpost to convert from MetaPost to MPS (stylized EPS). +my $old_cwd = cwd(); +chdir (File::Spec->tmpdir()); # mpost always writes to the current directory. +executeCommand "echo X | mpost $mpfile"; +chdir $old_cwd; + +# Post-process the MPS file into the output file. +my $mpsfile = $tempbase . ".1"; +my @purified_eps; +my $outfile_clean = ($outfile eq "-") ? "stdout" : $outfile; +open (MPSFILE, "<$mpsfile") || die "${Script}: $! ($mpsfile)\n"; +while (<MPSFILE>) { + # Process blank lines. + chomp; + my @tokens = split " "; + if ($#tokens == -1) { + push @purified_eps, "$_\n"; + next; + } + + # Convert the list of document fonts. + if ($tokens[0] eq "%%DocumentFonts:") { + my $outputLine = shift @tokens; + foreach my $TeXname (@tokens) { + my $PSname = $TeX_to_PS{$TeXname}; + if (!defined $PSname) { + warn "${outfile_clean}:$NR: warning: TeX font \"$TeXname\" does not appear in $fontmap\n"; + $outputLine .= " $TeXname"; + } + else { + $outputLine .= " $PSname"; + } + } + push @purified_eps, "$outputLine\n"; + next; + } + + # Convert the font name definitions. + if ($#tokens == 2 && + $tokens[0] eq $tokens[1] && + $tokens[2] eq "def") { + push @purified_eps, sprintf " %s /%s def\n", $tokens[0], $TeX_to_PS{substr($tokens[1],1)}; + next; + } + + # By default, output the line as is. + push @purified_eps, "$_\n"; +} +close MPSFILE; + +# Write the output file. +open (OUTFILE, ">$outfile") || die "${Script}: $! ($outfile_clean)\n"; +print OUTFILE @purified_eps; +close OUTFILE; + +# Finish up. +print STDERR "\nFile seems to have been purified successfully.\n"; +exit 0; + +########################################################################### + +__END__ + + +=head1 NAME + +purifyeps - make an Encapsulated PostScript file work with both dvips and +pdflatex + + +=head1 SYNOPSIS + +purifyeps +B<--help> + +purifyeps +B<--version> + +purifyeps +[B<--fontmap>=I<.fmp file>] +[I<.eps input file> [I<.eps output file>]] + +purifyeps +B<--make-man> [=I<filename>] [B<--section>=I<section>] + +purifyeps +B<--make-ps-man> [=I<filename>] [B<--section>=I<section>] + + +=head1 DESCRIPTION + +While B<pdflatex> has a number of nice features, its primary +shortcoming relative to standard B<latex>+B<dvips> is that it is +unable to read ordinary Encapsulated PostScript (EPS) files, the most +common graphics format in the LaTeX world. B<pdflatex> can read only +the following types of graphics files: + +=over 4 + +=item PDF + +Most people who use B<pdflatex> convert their documents to PDF using a +utility such as B<epstopdf>. This works well and preserves the vector +nature of the original EPS. Unfortunately, B<dvips> does not read +PDF, so two versions of the graphic must be maintained if the document +is to be processed with both B<latex>+B<dvips> and B<pdflatex>. + +=item PNG + +PNG is a bitmap format and therefore scales poorly. Also, B<dvips> +does not read PNG, so two versions of the graphic must be maintained +if the document is to be processed with both B<latex>+B<dvips> and +B<pdflatex>. + +=item JPEG + +JPEG is a bitmap format and therefore scales poorly. Also, B<dvips> +does not read JPEG, so two versions of the graphic must be maintained +if the document is to be processed with both B<latex>+B<dvips> and +B<pdflatex>. + +=item MPS + +This is probably the least-used B<pdflatex>-compatible graphics +format. MPS is actually a stylized version of EPS that MetaPost +outputs. Like PDF, MPS is a vector format and remains as such when +imported into a B<pdflatex> document. Also like PDF, B<dvips> does +not read MPS, so two versions of the graphic must be maintained if the +document is to be processed with both B<latex>+B<dvips> and +B<pdflatex>. + +=back + +The insight behind B<purifyeps> is that there are only a few, small +differences between MPS and EPS and that a file can be converted into +a format that matches both the MPS and EPS specifications +simultaneously. B<purifyeps> inputs an EPS file, uses B<pstoedit>'s +C<mpost> filter to convert the file to MetaPost (F<.mp>), runs +B<mpost> on the file to convert it to MPS, and finally performs some +touchups on the result to convert the file back to EPS, while +preserving its ability to be parsed by B<pdflatex>. + + +=head1 OPTIONS + +=over 4 + +=item B<--help> + +Display L<"Usage"> and L<"Options"> from the B<purifyeps> documentation. + +=item B<-V>, B<--version> + +Display the B<purifyeps> version number, copyright, and license. + +=item B<--fontmap>=I<.fmp file> + +Specify the name of a file that tells B<purifyeps> how to map from TeX +font names to PostScript font names. [Default: F<mpost.fmp>] + +=item B<--make-man> [=I<filename>]] [B<--section>=I<section>] + +Automatically create a Unix man page for B<purifyeps>. I<section> +specifies the section [default: C<1> (User Commands)]. I<filename> +defaults to F<purifyeps.1> or an analogous filename if I<section> is +specified. + +=item B<--make-ps-man> [=I<filename>]] [B<--section>=I<section>] + +Automatically create a PostScript version of the B<purifyeps> +documentation. The documentation is formatted like a Unix man page. +I<section> specifies the section [default: C<1> (User Commands)]. +I<filename> defaults to F<purifyeps.ps>. + +=back + +In normal operation (i.e., when not run with C<--help>, C<--make-man>, +or C<--make-ps-man>), B<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, B<purifyeps> will read from +the standard input device. + + +=head1 EXAMPLES + +Create a PostScript version of the B<purifyeps> documentation, but +call it F<happydoc.ps> instead of the default, F<purifyeps.ps>: + + purifyeps --make-ps-man=happydoc.ps + +Create a Unix man page for B<purifyeps> (in the usual roff format), +but indicate that it belongs in section C<LOCAL> instead of the +default of section C<1>: + + purifyeps --make-man --section=LOCAL + +Purify F<sample.eps> (F<mpost.fmp> is in the current directory): + + purifyeps sample.eps sample.eps + +Purify F<sample.eps> (F<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 B<purifyeps>, you should see the output from both +B<pstoedit> and B<mpost>, followed by a success message from +B<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. + + +=head1 FILES + +=over 4 + +=item F<mpost.fmp> + +File containing mappings between TeX and PostScript font names. See +L<"NOTES"> for a description of this file's contents. + +=back + + +=head1 BUGS + +Error reporting could definitely stand to be improved. Error messages +produced by B<pstoedit> and B<mpost> are sometimes silently ignored. +Also, errors sometimes cause B<purifyeps> to leave temporary files +(F<purifyeps->I<#####>) lying around. + +B<purifyeps> is subject to all of the limitations that affect +B<pstoedit> and especially the C<mpost> backend to B<pstoedit>. As a +result, B<purifyeps> ignores certain PostScript constructs, such as +nonuniformly scaled text. + + +=head1 NOTES + +B<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<%> are +ignored. The following is a sample F<.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 B<pstoedit> uses. By +default, B<purifyeps> looks in the current directory for a font map +called F<mpost.fmp>. The C<--fontmap> command-line option tells +B<purifyeps> to use a different font map, which will typically be the +F<mpost.fmp> file that comes with B<pstoedit>. + +Once you create purified EPS files with B<purifyeps>, you need to +instruct B<pdflatex> to use them. The pdfLaTeX configuration of the +C<graphics> and C<graphicx> packages (F<pdftex.def>) normally ignores +F<.eps> files. Putting the following LaTeX code in your document's +preamble tells B<pdflatex> that all F<.eps> files are in MPS 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 + +=head1 SEE ALSO + +dvips(1), epstopdf(1), latex(1), mpost(1), pdflatex(1), pstoedit(1) + + +=head1 AUTHOR + +Scott Pakin, I<scott+peps@pakin.org> diff --git a/Master/texmf/doc/man/man1/purifyeps.1 b/Master/texmf/doc/man/man1/purifyeps.1 new file mode 100644 index 00000000000..ef4dcc6d5e6 --- /dev/null +++ b/Master/texmf/doc/man/man1/purifyeps.1 @@ -0,0 +1,350 @@ +.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05) +.\" +.\" 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 "2009-03-14" "v1.0a" "" +.\" 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 diff --git a/Master/texmf/doc/man/man1/purifyeps.pdf b/Master/texmf/doc/man/man1/purifyeps.pdf Binary files differnew file mode 100644 index 00000000000..e58831f79c2 --- /dev/null +++ b/Master/texmf/doc/man/man1/purifyeps.pdf diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 05989ee8c4b..2424fc6633a 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -191,7 +191,7 @@ my @WorkingTLP = qw( pst-sigsys pst-solides3d pst-soroban pst-spectra pst-slpe pst-stru pst-support pst-text pst-tree pst-uml pst-vue3d pst2pdf pstool pstricks pstricks-add - psu-thesis ptptex pxfonts + psu-thesis ptptex purifyeps pxfonts qcm qobitree qstest qtree quotmark r_und_s randbild rccol rcs rcsinfo recipe recipecard refman refstyle regcount register resumemac robustcommand diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo index faeabdc3838..ab37221ca84 100755 --- a/Master/tlpkg/bin/tlpkginfo +++ b/Master/tlpkg/bin/tlpkginfo @@ -16,9 +16,9 @@ sub main || die "$0: TEX_CATALOGUE ($CATALOGUE) must point to entries/ subdir" . " of a TeX Catalogue checkout.\n"; - # erroneous tds files (warn Robin about them) + # erroneous tds files (warn Robin about them) or problematic (purifyeps). # list format: pkg1|pkg2|etc - $erroneous_tds = "elsarticle|xetexref"; + $erroneous_tds = "elsarticle|purifyeps|xetexref"; # special packages from latex-tds project (used by prepare()) $corelatex_tds_pkgs = "babel|cyrillic|graphics|latex|psnfss|tools"; diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index a38a7b2b1dd..ea20e7532b3 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1037,6 +1037,7 @@ $standardtex='\.(cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$'; 'plnfss', 'plain', 'psfrag-italian', 'italian', 'pst-cox', 'generic', + 'purifyeps', 'support', 'pxfonts', 'fonts', 'rsfs', 'fonts', 'shapepar', 'generic', @@ -1411,16 +1412,16 @@ $standardxmt='\.xmt'; 'perltex' => '\.pl$', 'pkfix' => '\.pl$', 'pst2pdf' => '\.pl$', + 'purifyeps' => 'purifyeps$', 'texcount' => '\.pl$', 'texloganalyser' => 'texloganalyser', 'vpe' => '\.pl$', ); -# too painful to install in multiple trees just now. -## packages which have man pages to install. Assume section 1 for now. -#%specialmans = ( -# 'mkjobtexmf' => 'mkjobtexmf.man', -#); +# packages which have man pages to install. Assume section 1 for now. +%specialmans = ( + 'purifyeps' => 'purifyeps.1', +); # which suffixes to remove after building. Checked after runins and at @@ -1444,6 +1445,7 @@ $standardclean = '\.head|\.tmp|\.dvi|\.log|\.out|\.aux|\.toc|\.lof|\.lot' 'lshort-spanish'=>'lshort-a5book.pdf', # a4 is enough 'mathexam' => 'sample.tex~', 'notes2bib' => "$standardclean|jawltxdoc.sty", # temp file for doc + 'purifyeps' => 'purifyeps.pdf', 'rsc' => $standardclean . '|jawltxdoc.sty', # temp file for doc 'wsuipa' => $standardclean . '|.*pk$', # premade pk files ); @@ -1745,6 +1747,7 @@ sub donormal &dosource; &dotype1; &doscripts; + &domans; # remove empty directories that we never used. &SYSTEM ("rmdir $DEST/*/$whichformat/$package 2>/dev/null"); @@ -1905,10 +1908,11 @@ sub dotype1{ &install("$DEST/fonts/truetype/public/$package", $ttfpatt); } -# scripts. Build/source/tex/texlive/Makefile.in installs symlinks -# in the bin directories where appropriate. Just for simplicitly, let's -# try keeping DEST as texmf when symlinks get installed; otherwise -# (if it gets called as a subprogram) texmf-dist is ok. +# scripts. Make them executable even if it isn't always necessary. +# Build/source/tex/texlive/Makefile.in installs symlinks in the bin +# directories where needed. That Makefile.in is independently +# maintained, needs to updated by hand when new user-visible scripts are +# added. # sub doscripts { @@ -1918,6 +1922,17 @@ sub doscripts &SYSTEM ("chmod a+x $DEST/scripts/$package/*"); } +# man pages. We also put these in texmf/doc/man/man1. +# Having a man dir in texmf-dist also would imply lots of changes in the +# installer. +# +sub domans +{ + my $manpatt = $specialmans{$package}; + return unless $manpatt; + &install ("$TOPDEST/texmf/doc/man/man1/", $manpatt); +} + # xmltex files sub doxmt{ my $xmtpatt = $specialxmt{$package} || $standardxmt; diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc index 4e7d47b69b5..e6aa5df81dc 100644 --- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc @@ -33,6 +33,7 @@ depend latexmk depend mkind-english depend mkjobtexmf depend pdfcrop +depend purifyeps depend synctex depend texcount depend texloganalyser diff --git a/Master/tlpkg/tlpsrc/collection-psutils.tlpsrc b/Master/tlpkg/tlpsrc/collection-psutils.tlpsrc index 16735335a71..a073250f0a5 100644 --- a/Master/tlpkg/tlpsrc/collection-psutils.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-psutils.tlpsrc @@ -8,3 +8,4 @@ depend bin-lcdftypetools depend bin-pstools depend bin-psutils depend bin-t1utils +depend purifyeps diff --git a/Master/tlpkg/tlpsrc/purifyeps.tlpsrc b/Master/tlpkg/tlpsrc/purifyeps.tlpsrc new file mode 100644 index 00000000000..735f62214e8 --- /dev/null +++ b/Master/tlpkg/tlpsrc/purifyeps.tlpsrc @@ -0,0 +1,3 @@ +name purifyeps +category Package +docpattern f texmf/doc/man/man1/a2ping.* @@ -32,11 +32,16 @@ Public domain. TODO: not done already. - kpsewhich default to "TeX system documentation" for *.pdf, *.html. - add epspdf to doc/info/dir (should not be in bin-kpathsea, either). -- enable binpattern in texloganalyser.tlpsrc +- enable binpattern in {texloganalyser,purifyeps}.tlpsrc. - add luatex-plain.mem generation per elie. - review comments in context.tlpsrc. - move pkfix (and other scripts?) to texmf-dist, get symlinks right. - + and make pkfix its own package, not part of bin-dvipsk. +- remove bin-* prefixes from package names where possible. +- merge collection-ttfutils and collection-psutils into + collection-fontbin. better name? +- move purifyeps, pdfcrop, bin-pdftools, others? from binextra to a + collection-pdftools? some other name? 1. Package updates ================== |