purifyeps-1.1/0002775000175000001440000000000011475431302012421 5ustar hilleuserspurifyeps-1.1/purifyeps0000775000175000001440000004141611474541004014401 0ustar hilleusers#! /usr/bin/env perl ################################################################ # Convert an ordinary Encapsulated PostScript file (.eps) into # # one that works with both LaTeX+dvips and pdfLaTeX # # # # By Scott Pakin # ################################################################ our $VERSION = "1.1"; 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 File::Which; 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 my @fontmappath = ( # Where to look for $fontmap "/usr/share/pstoedit/", "/usr/local/share/pstoedit/"); ######################################################################## # 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 = ; 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()); # Try to determine the full filename of the font-map file. foreach my $dir (@fontmappath) { my $newfontmap = File::Spec->catfile($dir, $fontmap); if (-e $newfontmap) { $fontmap = $newfontmap; last; } } # Process the command line. my ($wanthelp, $wantman, $wantps, $wantversion); my $versionmsg = "purifyeps version $VERSION Copyright (C) 2010 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. # Ensure that pstoedit is installed. Give a helpful error message if it isn't. if (!defined which("pstoedit")) { die "${Script}: pstoedit must be installed and must appear in the executable search path\n"; } # Read the font map file into a hash table. open (FONTMAP, "<$fontmap") || die "${Script}: $! ($fontmap); specify an alternative with --fontmap\n"; FONTMAP_LINE: while () { # 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 () { # 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] [B<--section>=I
] purifyeps B<--make-ps-man>[=I] [B<--section>=I
] =head1 DESCRIPTION While B has a number of nice features, its primary shortcoming relative to standard B+B is that it is unable to read ordinary Encapsulated PostScript (EPS) files, the most common graphics format in the LaTeX world. B can read only the following types of graphics files: =over 4 =item PDF Most people who use B convert their documents to PDF using a utility such as B. This works well and preserves the vector nature of the original EPS. Unfortunately, B does not read PDF, so two versions of the graphic must be maintained if the document is to be processed with both B+B and B. =item PNG PNG is a bitmap format and therefore scales poorly. Also, B does not read PNG, so two versions of the graphic must be maintained if the document is to be processed with both B+B and B. =item JPEG JPEG is a bitmap format and therefore scales poorly. Also, B does not read JPEG, so two versions of the graphic must be maintained if the document is to be processed with both B+B and B. =item MPS This is probably the least-used B-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 document. Also like PDF, B does not read MPS, so two versions of the graphic must be maintained if the document is to be processed with both B+B and B. =back The insight behind B 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 inputs an EPS file, uses B's C filter to convert the file to MetaPost (F<.mp>), runs B 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. =head1 OPTIONS =over 4 =item B<--help> Display L<"Usage"> and L<"Options"> from the B documentation. =item B<-V>, B<--version> Display the B version number, copyright, and license. =item B<--fontmap>=I<.fmp file> Specify the name of a file that tells B how to map from TeX font names to PostScript font names. [Default: F] =item B<--make-man> [=I]] [B<--section>=I
] Automatically create a Unix man page for B. I
specifies the section [default: C<1> (User Commands)]. I defaults to F or an analogous filename if I
is specified. =item B<--make-ps-man> [=I]] [B<--section>=I
] Automatically create a PostScript version of the B documentation. The documentation is formatted like a Unix man page. I
specifies the section [default: C<1> (User Commands)]. I defaults to F. =back In normal operation (i.e., when not run with C<--help>, C<--make-man>, or C<--make-ps-man>), B 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 will read from the standard input device. =head1 EXAMPLES Create a PostScript version of the B documentation, but call it F instead of the default, F: purifyeps --make-ps-man=happydoc.ps Create a Unix man page for B (in the usual roff format), but indicate that it belongs in section C instead of the default of section C<1>: purifyeps --make-man --section=LOCAL Purify F (F is in the current directory): purifyeps sample.eps sample.eps Purify F (F 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, you should see the output from both B and B, followed by a success message from B: % 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 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 and B are sometimes silently ignored. Also, errors sometimes cause B to leave temporary files (FI<#####>) lying around. B is subject to all of the limitations that affect B and especially the C backend to B. As a result, B ignores certain PostScript constructs, such as nonuniformly scaled text. =head1 NOTES B 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 uses. By default, B looks in the current directory for a font map called F. The C<--fontmap> command-line option tells B to use a different font map, which will typically be the F file that comes with B. Once you create purified EPS files with B, you need to instruct B to use them. The pdfLaTeX configuration of the C and C packages (F) normally ignores F<.eps> files. Putting the following LaTeX code in your document's preamble tells B 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 purifyeps-1.1/purifyeps.pdf0000664000175000001440000006616111475431230015152 0ustar hilleusers%PDF-1.6 % 22 0 obj <> endobj 35 0 obj <>/Filter/FlateDecode/ID[]/Index[22 26]/Info 21 0 R/Length 73/Prev 27424/Root 23 0 R/Size 48/Type/XRef/W[1 2 1]>>stream hbbd``b`$A`b̓@DH LH>stream hb```" >ʰ!I3d&00`pb^H/E_c 58}zF@@aNgR `D=;P4TE+Ė*(<> l endstream endobj 23 0 obj <> endobj 24 0 obj <>/Font<>/ProcSet[/PDF/Text]>>/Rotate 0/Thumb 8 0 R/Type/Page>> endobj 25 0 obj <>stream hެWmo6aHODEhuvQh[,&Hv݆˝=0q"g,ߜ ~(JY,,/% JG8,Qf: T&]Yt6mt m0!ӜʭT#R8\u-y5pֹ1t!8y2v܄*OKB|oRwfwZ?lzLɝ4B,됎H"~#S4ËEB*4i ׎@3Rsth Q PHU!{CjG (k8m9{`7pC|!${!jùd E;p1م~|qsq##2"`lnLH2Zˋ烛x#|nkk0hͯ/UaKhCe=砡 :7թ[>P ӊ.o@~i,㳿]멁K8i 3h* pb# uU n}G'n>cp i4DX^PA( 2(Dty{U{Hޛ7*&۵mcd[ǿ? ɾ N endstream endobj 26 0 obj <>stream H_O0h2&"`h6M%1ڴuv2x D3 G ߇j4cc3QjmM-2_scrosF.$=\*\.+5P$62=.IvDyd) \6 R->`7oRO2)SRyi wz囌0 :#>ebM-Kku=ўw&EWq07 U4y|Ǝ> )FաFS 01|ˆR.,A]NkZsldWzP'~IM[L'DA1MM}Fk{?= Sbo6& endstream endobj 27 0 obj <>stream HSn0}Ẉ#Xq.H< HE\V4HroQR@ %Q4sSJ^S)r83uiP5n7z86fԎvve D"qRa3剁p 9#vKv 4s. m =v7LjljzG|Bz+.4ws1G_2dRxf]C8tē$^W]` ؖ|yL.כ8i!O0t^:utV5JD{{ *mߞ`,NQpl ȓbe?- endstream endobj 28 0 obj <>stream HK  rFʌ*M&O:`̨"v˹=aXqnF NcA.@j㠳ClqW]DVO&%.A+̡-EkA0T%)%6X%R L&<-4>x_ӟ(ԛÍ*"=`nsԑ[#\,(Q5>{Ŕ*/+`Iq ~{뾇f`tk?m&LN֙34+HTI$BO7ߓK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sWhmjR{c ffHy` /k3H?iq=`vD}B:z胂M`e+yЛF8ga^n$?!r|0,՛+^% SKڷaMeUCsٮJ :Q`9C_AqUg8 joW\jϙFzQlL~"s 뼨Ms` W(&p;ĵ_l!9s>4tY9~@Sr𹊫]SKX[ux?AM yΗGeiCۑ6޹>1HQ?}Œ[ld6[ЫPPDV%reE(y*[%?RjJveOqCEDuШB}NX?7`(]5`믊 X&C!$f. cwR<4 $dU'RLpmH,H^u@T5ՂvE _>}J3%`̚2HYy3ﳸ endstream endobj 3 0 obj <>/Font<>/ProcSet[/PDF/Text]>>/Rotate 0/Thumb 10 0 R/Type/Page>> endobj 4 0 obj <>stream HW]o}ؗTkm\)ɭhk#VMl^\\1E)7nȊw83{̙wϾ[2js#$Cς?ßW뀯dYȨ"\sW4jc":&2KbZ[ٔقppJP2* 1əxQnPv6!xN}nKDO%)J_t NQHTą2y0yp!]Mɳْ0atOIf|JVT$LR|á: Hca(ym!rZs(R^enibcbٮg@k7Lme?u@B"SWSB4D1C1 Szh!HcVn ;8VN:.bZt?$%%rXC'=!BS2(6V/ >QݜإӠA.C?oCXұ)kcNu,_md/$*=ZV<=FfpI1*T`C^ַEG okbEAmZEiY`؁6T *VKe^)%nkp0N)KR>W/;{4QLL?`6S@]RTIFl;/Uh&49\VqtX+=G")F¬!mgmvL~6\.v_Bel ?mj\l \]5`ht߶Pӷ-ZS-dERw^bʇ KlS-9_8oB endstream endobj 5 0 obj <>stream HR[BA ,`X XB,` dz^|qc endstream endobj 6 0 obj <>stream h24S0PKIHMwI-LN rwR025U0v endstream endobj 7 0 obj <>stream h24W0Pw/+Q0,H/-K-0 endstream endobj 8 0 obj <>stream HWr slH.ien4mc I;?+8bÞj8Wm^DCW쮲]~G io班h1){2"?frʼce^;r89_)Ĝ.yeb3e>*Pļz_tqF/#ޞ̰PEmb Ja[ˬJK^Qχb8GiTnjX68M& ͟.ox6^;h)U/Q롐43DfZO ,~Y s=ʋL%ox&g>QCxԄ64 5"(tZ]vi@hWuuCJ4/v6T{W}D 9\atN򙙖쩇1ȹTNs;,,WraTgB]2Lk@Ok h94yׅ~Azo@T|lZJ Vצ >u޽ jlX=ҽ_jw>>,/R0"=El !án:̙oY6T)fABq Nm +P-!}a6B‡)Ю>stream HW0?]kdNI,;m?~zX~,^~$o#~\~7dž(Eo%8X5$̢YǿKk1 hHΧ\ yyלGj6̮ Uet㞩^ ~`~^=]Fku m2 [AkdCj==;\|kc>(g<=>QCU)_NbRDbN˂ KDLLpOru(aS;c{ƹ7闷`Y_+Ǐ$skf CF`Gb"i^0tvr<}Ǔ3 b,~'{chL| mۏϞ1;4olQ#3܎k~`lE'2;5&j ),=RW{SZZr=[r; ֎/pLrxR~~N܊ug̲zl?Fm\E[a1vJk>u%O*"\TRuTS=ljstɀ<@K A-vcHŅkV`Y)oA#MKPoܦ|Ezn0A1YcM GivB"F_r(?& sǔHB<] endstream endobj 10 0 obj <>stream HW0 >ڇpu &R%tmѠ%Zbo3u}U-"Ɛ$3y2L7l8VhƹT3ݭ wqrU˫&ҏ/"d<\_W/q*%JEʘ@)WYT 4˼YI*&p#o- ebTMøB6pPO 'L[`s%ކT5ZU^ σ9Ubŏ։ŶXe4ؔ$֚a6 *4fS]I.Vو,>hz׊{1eoy3o'lJE&Ewpz|UWrZ:k(Z:Vm;~Xc\L=Šq!%R3e$NvlFM7}`#^?/k"KL02'Ͽo9e;eSTIӱDU國 7l̔Q3+v5=="ۘgL-]kO`C.XNu%\r%\r%Kb벫Z Pf endstream endobj 11 0 obj <>stream h2P0P0!}h0@!((bg`H endstream endobj 12 0 obj <>stream 2010-12-01T10:30:45-07:00 groff version 1.20.1 2010-12-01T10:33:03-07:00 2010-12-01T10:33:03-07:00 Acrobat Distiller 9.4.0 (Windows) utility; tool; script; EPS; PDF; MetaPost; convert; LaTeX; graphics; utility; tool; script; EPS; PDF; MetaPost; convert; LaTeX; graphics application/pdf purifyeps -- make an Encapsulated PostScript file work with both dvips and pdflatex Scott Pakin <scott+peps@pakin.org> Command-line utility for graphics import utility tool script EPS PDF MetaPost convert LaTeX graphics utility tool script EPS PDF MetaPost convert LaTeX graphics Copyright (C) 2010 Scott Pakin uuid:e019456f-4b2d-4e08-831a-334d3254929c uuid:6ddccf18-ca41-4083-8914-87694e73c0ee True http://www.latex-project.org/lppl/ Scott Pakin <scott+peps@pakin.org> Print endstream endobj 13 0 obj <>stream h22P0Pw/+Q0L)62 )IcRYZlg`gz endstream endobj 14 0 obj <>stream hެPn0 ~h5Miڊe RQx.m8Y.AŏÝU?al'䤢ir 'a*06 y:figrF'}ԓn5] Ķ/T ʗ֊x>@7Q-|@gkM䖨r({\w>c:Mlwm$6}*AڨQhݔAwFS";\!IGn} ODht <gMa(8H̀oSB endstream endobj 15 0 obj <>/Filter/FlateDecode/ID[]/Info 21 0 R/Length 82/Root 23 0 R/Size 22/Type/XRef/W[1 2 1]>>stream hbb&F L '3HpXXSAD`hg@r hb`f DF ,`q = endstream endobj startxref 116 %%EOF purifyeps-1.1/purifyeps.10000664000175000001440000003132411475425330014536 0ustar hilleusers.\" 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 purifyeps-1.1/README0000664000175000001440000000407711474537432013321 0ustar hilleusers +---------------------------------------------+ | 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) 2010 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.