How to Produce Portable PDF Files from LaTeX
Heartfelt thanks to Jason Flinn, Andreas Haeberlen, Joshua LeVasseur, Barton Massey, and Erez Zadok for their contributions to these instructions.
- Use dvips to produce a postscript file from your DVI, and then ps2pdf to
produce the final PDF. Tools that produce PDF directly from DVI/TEX files
don't always do a good job.
- Check to make sure your installation of ps2pdf invokes ps2pdf14. If not, invoke it explicitly, like this:
ps2pdf14 -dPDFSETTINGS=/prepress -dEmbedAllFonts=true
The first parameter is essential; the second alone may leave out some basic system fonts.
- Be sure to use appropriate fonts. Times Roman is best, and it is included in the
- If you are generating figures as EPS from a Microsoft application:
- Use portrait orientation. Landscape generates visuals outside the EPS bounding box, which prevents the files from printing in Quark.
- Force the EPS files to embed all fonts, via the Windows printer dialog boxes.
- Force your gnuplot EPS files to embed fonts, using the fontfile command. Example:
set terminal postscript eps enhanced "NimbusSanL-Regu" fontfile "uhvr8a.pfb"
embeds gnuplot's default Helvetica font in the output.
The name of the font is NimbusSanL-Regu, and the font file is
uhvr8a.pfb. The Nimbus fonts are a family of free fonts
distributed with LaTeX.
The font file has a line near the top which defines the abbreviated font
/FontName /NimbusSanL-Regu def
Look for similar lines in other font files if you want to change the font. Some
families, for example, the
Adobe afm fonts, may be incompatible with gnuplot.
Alex Snoeren offers this workaround: Run the pdf through ghostscript with the pre-press option and output to pdf. The command line might be more complex than it needs to be ($1 is the name of the input file, and tmp.pdf is the name of the output):
gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=tmp.pdf -dCompatibilityLevel=1.3 -dPDFSETTINGS=/prepress -c .setpdfwrite -f $1
- Most latex distributions contain a dvips tool that by default
formats the postscript file for A4 paper. YTo force dvips to
produce a format for U.S. letter style, first try:
dvips -Ppdf -Pcmz -Pamz -t letter -D 600 -G0
If that doesn't work, try -G1 instead of -G0:
dvips -Ppdf -Pcmz -Pamz -t letter -D 600 -G1
You may try pdflatex, which avoids the dvi step altogether. However,
pdflatex under Mac OS X sometimes produces files that are incompatible with
the USENIX typesetting system.
- dvips may not include bitmapped fonts in the produced PS correctly.
If you then produce a PDF file, you may get errors from acroread or xpdf,
because it will miss those fonts. When latex formats the round bullets
for lists, it uses such a bitmapped font. The solution is to tell
dvips to include bitmapped fonts in the PS file, as follows:
dvips -Pcmz -t letter -o foo.ps foo.dvi
If you don't use -Pcmz, or you use another -P option, you may find odd
font problems in your paper (for example, "f" followed by "i" becomes one
character or is replaced with the British Sterling character).