Converting Latex to pdf

or
Why Do My Documents Look So Crappy?

by Rick Groff

Latex attractively renders text and mathematics to Postscript. However, naively converting the Postscript output to Adobe's Portable Document Format (pdf) using Acrobat Distiller or ps2pdf yields a document that displays poorly electronically, though it will look fine when printed. Nevertheless, it is possible to convert a latex document into a high quality pdf. Below is a brief discussion of the problem and solution, along with some relevant links.



The Problem:
The key to the problem lies in the difference between Postscript Type 1 and Type 3 fonts. Type 1 fonts are stored as curves, which can be scaled to whatever size is desired. Modern Type 1 fonts also include "hints" for rendering the fonts at low resolutions (e.g. your monitor). Type 3 fonts, on the other hand, are stored as bitmaps at the appropriate resolution for the print medium. Type 3 fonts rendered by Acrobat Reader look "fuzzy." The trick is to embed Type 1 rather than Type 3 fonts in your document.

Latex, the typesetting system developed by Donald Knuth, uses Computer Modern fonts stored in the Metafont format by default. Metafont is another scalable format. The problem is the conversion of the dvi file to Postscript. By default, when you run dvips, (or when you view using xdvi) it converts the Computer Modern Metafonts into Postscript Type 3 fonts, at the appropriate resolution of your printing device. (The resolution may be controlled by the "-D" command line option to dvips) While ghostview (a Postscript viewer) does a good job of rendering Type 3 fonts at low resolution, Adobe Acrobat does not. Moreover, the document is not as portable when using Type 3 fonts. If the bitmaps were generated for 300dpi, then the document will not look any better when printed on a 600dpi printer.


The Solution
The key is to embed Type 1 (rather than Type 3) fonts in your Postscript document. Luckily, there are freely available Type 1 versions of the Computer Modern fonts used by Latex. (Called BaKoMa and bluesky, available on CTAN)

If you're lucky:     If you're using RedHat 6.x and later (or many other Linuxes or mktex for Windows), you're in luck. The Blue Sky fonts, along with all the necessary configuration files are already installed on your system. (Typically at /usr/share/texmf/fonts/type1/bluesky/cm) You can embed Type 1 fonts using dvips with the command line option:
      dvips -Ppdf yourdvi.dvi
This creates a Postscript file (*not* a pdf file) with embedded Type 1 fonts, which can be converted to pdf using Acrobat Distiller or ps2pdf. That's all there is to it! Some suggested setting for Distiller are listed below.

The "-Ppdf" option may look like a print command, but really it just tells dvips to use the configuration file config.pdf, usually located at /usr/share/texmf/dvips/config/config.pdf. The original was that each printer would have a configuration, specifying, for example, what resolution to make the bitmapped fonts. You could make your own configuration, config.whatever, if you don't like the defaults of config.pdf.

A note of caution:   It is possible to use standard Postscript Type 1 fonts rather than the Computer Modern Fonts in Latex (for example, by using the packages times.sty, palatino.sty, newcent.sty, bookman.sty, avant.sty, or helvet.sty). If you use the -Ppdf option in this case, it causes weird things to happen. The most noticable is that the ligatures (two character that are drawn differently when typeset next to each other, for example "fi", "fl", "ff", and so on, get replaced with other symbols. This has something to do with the "G" option regarding Character Shifting in config.pdf. The only workaround I know is not to use "-Ppdf". (The text will be Type 1, but equations may end up being Type 3)

If you're not:    If your system doesn't already have fonts installed, you have a bit more work ahead of you. The relevant steps are:

More details on setting up fonts are available through the links below.

Acrobat Distiller     If you are using Acrobat Distiller, I suggest the following settings under Job Options:



Another Approach
The program pdftex and pdflatex allow a tex or latex source, respectively, to be compile directly to pdf, without going through Postscript. This sounds great, however there appear to still be a few bugs in pdflatex. (Some problems with properly rendering mathematics, doesn't always look the same as the Postscript, etc.) For this reason, I suggest sticking with using Distiller or ps2pdf on the Postscript output. Happy pdf'ing!

Helpful Links