Home General LaTeX tips and tricks → PDF versions [Previous Page] [Question index] [Next Page]

27. How can you create a PDF version of a document?


Answer

Use pdflatex.

Compiling your LaTeX source file to Adobe's PDF with pdflatex generally yields much better results than using post-processing utilities such as ps2pdf, but can also take a bit more tweaking to get it right, although I must say that with the advent of the teTeX 2.0 distribution the process (in my case at least) has become almost painless.

Ideally, you can just run e.g. pdflatex thesis.tex, and everything will happen automatically. In practice, there are a number of considerations.


Things to watch out for: Figures

You might think (or at least I did), that with PDF being so closely related to PostScript, pdflatex would know how to incorporate EPS pictures, but it does not (in contrast to LaTeX itself, which has no problem with EPS files).

All your EPS figures must therefore be converted to PDF format, for which you can use the eps2pdf utility. In my thesis sources you will find Makefile examples that can show you how to automate the process. In your LaTeX file, don't ever specify an .eps or .pdf extension explicitly; just specify files as follows:


\includegraphics[width=\textwidth]{sor-v}

and the program will automatically load either sor-v.eps or sor-v.pdf, depending on whether you invoked latex or pdflatex.

Note that in versions of teTeX prior to 2.0 I experienced severe difficulties getting the EPS to PDF conversion to work correctly. In particular, there was a problem where the converted pictures would end up rotated 90 degrees no matter what I tried. In teTeX 2.0 everything works flawlessly.


Things to watch out for: Auxiliary files

Running pdflatex is no different from using LaTeX itself directly, in that you must run it (or LaTeX) sufficiently often on your document for all the .aux and other generated files to reach their correct contents. If you make mistakes here, you may for instance find that the page numbers in the Table of Contents for the PDF version are incorrect.


Things to watch out for: Fonts

Once you have successfully generated a PDF version of your document, the single most important thing to ascertain is that the file contains scalable fonts and no bitmapped fonts. If you ever experience difficulties of the kind where the PDF looks horrible on the screen, but prints okay on a laserprinter, or vice versa, this is likely to be caused by the presence of bitmapped fonts, and this is a must-fix situation.

Font problems (and how to try to identify and fix them) is something I could probably spend dozens of pages writing about — and your specific problem would likely still be entirely different from anything I could come up with. So I will not even try — you will have to use your common sense and the existing documentation and web pages Out There.

One good general tip I can mention, however, is that if you use LaTeX's default Computer Modern fonts in your document then explicitly installing scalable versions of those fonts may go a long way towards solving PDF/font problems.

A second tip is to open your PDF file in Acrobat Reader (or some equivalent PDF viewer, such as KPDF or Evince) and use the File > DocumentProperties > Fonts... menu option to check your document's fonts. Everything listed as ‘Type 1’ is just fine, but something listed as ‘Type 3’ indicates a bitmapped font, and likely means trouble, sooner or later.

The Acrobat Reader font info for a healthy thesis will look somewhat like this:

Acrobat Font Info Screenshot

Updates

21 May 2004

Regarding the issue of including graphics, I have received email feedback recommending the use of METAPOST (.mps extension) figures. Not only can pdflatex handle these without conversion, but they can also be generated directly from within the newer versions of Dia. I have no personal experience with this format, however.

1 Nov 2008

I also received a recommendation for abandoning pdflatex altogether, and instead using DviPdfM to generate PDF. DviPdfM is included in all major TeX distributions, and allows the inclusion of EPS graphics without the need for conversion. That certainly sounds like a winning feature, but again, I have no personal experience with this tool.


[Previous page] [Question index] [Next page]

Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016