Introduction to LaTeX

Producing a LaTeX (or TeX) document on a UNIX/Linux system requires a few stages. The commands below (tex, latex, xdvi, dvips, dvipdf, etc.) have to be issued in a shell. For many of them one need not include the extension in the file name.

Here is the basic sequence (see details below):

create the LaTeX file, say FILE.tex:
use any text editor
process the file:
latex FILE    (will use FILE.tex and produce FILE.dvi)
view the result on screen:
xdvi FILE &    (will use FILE.dvi)
printing (using a PostScript version)
dvips FILE    (will use FILE.dvi and produce
    followed by
A few extra features:
If you need a PDF version. e.g. to post on the Internet, there are a few choices. The extension is indicated to emphasize the file that is used.
  • dvipdf FILE.dvi    (will produce FILE.pdf); this is similar to dvips, and might produce first and convert it to PDF with ps2pdf
  • pdflatex FILE.tex    (will produce FILE.pdf); the figures should be available as PDF files. See more in the Pictures section.
  • vlatex FILE.tex    (will produce FILE.pdf); handles pictures too, but vlatex is not part of the default installation
    [by now dvipdf works for most cases, so no need for vlatex]
Hyperlinks in DVI, PDF, etc.
To add (click-able) hyperlinks for formula numbers, references etc., you could include \usepackage{hyperref} (preferably as the last package to be loaded). Often no other change is needed in the file. See the Fancy-stuff section.
  1. Creating the ASCII (i.e., text) file containing the document. This file has customarily the extension .tex, and can be written with any text-editor.

  2. "Compiling" it, with the command latex latex_file[.tex] (or, tex tex_file[.tex] if it is a TeX of AmSTeX file). This will produce a DVI (DeVice Independent) file, whose extension is ".dvi".

  3. On a graphic display the DVI file can be seen with the command xdvi dvi_file[.dvi].

  4. Transforming the DVI file into a PS (PostScript) file, with the command dvips dvi_file[.dvi]. One can arrange that the PS file be sent directly to the printer, instead of being saved on the disk.