# How to create .pdf files from TeX

by Donu Arapura

Click on RELOAD now. This page is frequently updated and you might be looking at an old version saved by your netscape cache.

Here is the easiest way to create a PDF file from a TeX file. Suppose you have a TeX file called

something.tex

First, tex the file by typing

amstex something.tex

if it is in AMS-TeX, or

latex something.tex

(twice) if it is in LaTeX. These commands create a file called

something.dvi

To convert this DVI file into a PDF file, type

dvipdf something.dvi

This will create the file

something.pdf

You can view this PDF file by typing

acroread something.pdf

Another way to create PDF from DVI uses a couple extra commands:

dvips -Pweb something.dvi
distill something.ps
rm something.ps

The first command creates a large PostScript file called something.ps and the second command creates a file called something.pdf

NOTE: This page is rather outdated. The new Linux servers support the commands pdflatex and pdftex that create a PDF file directly from the TeX source file. If you run TeX to create a DVI file, you can then run dvipdf, which will create a PDF file from the DVI file. There is also ps2pdf that will convert a PostScript file to PDF.

The last command removes the overly large PostScript file.

If you have embedded eps graphics in your TeX output, these should get converted to pdf nicely by either method above. If you are happy with this, stop reading. However, if you want hyperlinks, bookmarks, embedded jpg files, etc., read on.

# How to compile source to pdf

It's possible to compile tex or latex straight into pdf, and this typically results in a richer document. Unfortunately, the default version of the pdflatex command is broken (at least for complicated documents). Before you do anything else, set the newer version of tex as default by adding these lines:

```set path = (/pkgs/teTeX-2.0/bin/sparc-sun-solaris2.9/  \$path)
setenv TEXMF /pkgs/teTeX-2.0/texmf/
```

in your .cshrc to be executed automatically next time you log in. (This is assuming you use the standard shells, csh or tcsh.)

Now you are ready to type:

pdftex something.tex

for plain or AMS-TeX, or

pdflatex something.tex

(twice) for latex. These commands create something.pdf

### A few additional notes:

If you want hyperlinks, try putting

\usepackage{hyperref}

into your latex file.

One small annoyance about pdflatex is that it can't handle eps graphics. The solution is to convert eps files to pdf first by typing

epstopdf picture.eps

for each embedded graphic. If you use the "graphicx" package, then change all references of

\includegraphics{picture.eps}

to

\includegraphics{picture}

Back to the Network News Index Page