Creating LaTeX documents

PDF file
(e.g., MyDoc.pdf)

In many cases these days, the best possible format for a document that you wish to share is PDF, Adobe's Portable Document Format. A PDF file can be viewed on almost any computer using Adobe's free Acrobat Reader, and also printed from that Reader. PDF files preserve the full image/font quality of a document at a reduced file size, so it is perfect for putting on web pages.

For example, the file MyDoc.pdf is the product of our sample LaTeX document MyDoc.tex after it has been compiled with LaTeX and converted to PDF. There are basically two ways to get the PDF file.

1. Convert the DVI to PostScript, and PostScript to PDF

For some purposes, especially to include PostScript graphics (and ``PS tricks'') into the document, it is better to convert the DVI file to PostScript first, then use ps2pdf to convert the PostScript to PDF;
unix>   latex MyDoc.tex               (creates MyDoc.dvi)
unix>   dvips -Ppdf MyDoc.dvi -o      (creates MyDoc.ps)
unix>   ps2pdf MyDoc.ps               (creates MyDoc.pdf)
There is a command dvipdf, which actually combines the latter two commands, so the above could be reduced (if you don't need the intermediate PostScript file) to
unix>   latex MyDoc.tex           (creates MyDoc.dvi)
unix>   dvipdf MyDoc.dvi          (creates MyDoc.pdf)
while still allowing PostScript images/tricks.

The negative side of the above methods is that they use ghostscript to interpret and convert the PostScript, and older versions will degrade the quality of the fonts.

2. Convert the DVI directly to PDF: pdflatex

The command pdflatex compiles the LaTeX and immediately converts the result to PDF without using a ghostscript interpreter. It almost always gives better quality results and smaller PDF files.

Another benefit is that you can insert JPEG, PNG and PDF graphics into your document. The negative side of this is that pdflatex will not support some PostScript images or operations. If you want to insert figures, they must be in either PDF, JPEG or PNG format. You can convert your Encapsulated PostScript images to PDF using epstopdf, then include them with the LaTeX macro \includegraphics{}. So, for example, the image included in section 3 must first be converted to PDF, then the inclusion command is \includegraphics{diagram.pdf}. The steps to converting straight to PDF:

unix>  epstopdf diagram.eps            (creates diagram.pdf)
unix>  pdflatex MyDoc.tex              (creates MyDoc.pdf)