Skip to Main Content

How to Use LaTeX

A guide for installing and using the typesetting program \(\LaTeX\).

Options for Comipling a LaTeX Document

A LaTeX document, saved as a .tex file, must be compiled in order to turn it into a readable document. A compiled .tex file will output either a .dvi, .ps (PostScript), or .pdf document. Most TeX distributions' default output is .dvi, but .ps or .pdf documents are relatively easy to produce as well.

There two general ways to compile a LaTeX document:

  • Using a LaTeX editor/compiler
  • Using the command line/terminal

Using a LaTeX Editor/Compiler

A LaTeX editor such as TeXmaker or TeXworks includes the functionality to compile a LaTeX document with the push of a button. The specific editor being used should include information on how this is done, so it is best to refer directly to the website of the chosen editor for information on its operation.

Using the Command Line/Terminal

The commands listed below should work equally well in a Windows, Unix/Linux, or Mac environment.

In the command line or terminal, first navigate to the location where your .tex file is saved. The following commands can then be used:

  • latex [filename].tex will compile [filename].tex and output the file [filename].dvi
  • pdflatex [filename].tex will compile [filename].tex and output the file [filename].pdf

You can also use the command line/terminal to convert between different file types. For example:

  • dvips -o [filename].ps [filename].dvi will convert [filename].dvi into a PostScript file named [filename].ps
  • dvipdfm [filename].dvi will convert [filename].dvi into a PDF file named [filename].pdf

Preparing a Basic LaTeX Document

The extremely basic examples below can be used to create a functioning LaTeX document, which can then be compiled using one of the methods listed elsewhere on this page.

Links on Compiling