User Tools

Site Tools


latex

LaTeX Tutorial

TeX is a powerful typesetting system that is the current standard for creating mathematical documents. A system called LaTeX, which includes TeX along with many “macros” to make your life easier, is used by most mathematicians and many professionals in other scientific fields.

The LaTeX Wikibook is an excellent, readable reference on LaTeX fundamentals. It also includes a quick, easy intro to the beamer document class, which is used for slide presentations.

Getting Started

Decide whether you're going to use the department computers (Linux) or your own (Windows, Mac, or Linux). Getting LaTeX working on your computer takes two steps: (1) installing LaTeX, and (2) getting an editor. Once you've completed these two steps, download an example TeX file (see below) and try compiling the TeX file into a PDF. Congratulations, you are now a LaTeX user!

– Insert link to a basic TeX file template here –

Installation

Macintosh

Install MacTeX, which includes TeXShop. Open a LaTeX file in TeXShop and click the “Typeset” button. You can make changes in the editing window and view the results in the PDF preview window.

Windows

Install proTeXt.

Linux

Using a terminal, change into the directory where your LaTeX file is. If your file is called myfile.tex, then run the command pdflatex myfile.tex. In the same directory should be myfile.pdf. You can make changes using any text editor (or retransfer / download your updated LaTeX file) and rerun pdflatex.

If you get a command doesn't exist error, some of the “local machines” (like the math department computers in the grab lab) don't have TeX/LaTeX installed. First, SSH into one point/round/line/tangent, cd to the right directory, and try again. If you're running Linux on your own computer at home, you might need to first install tetex.

Escaping from Error Messages on Linux

An error message indicates invalid LaTeX. When you get a message like,

! LaTeX Error: Bad math environment delimiter.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.12 \begin{displaymath}
?

enter either q or x to get out. LaTeX suggests the error is at line 12. In reality, it may be on some line nearby.

Editors

There are many programs available for editing TeX files. Here are a few:

  • Overleaf – real-time collaborative writing and publishing tools
  • Sublime Text – general code editor, has good packages for TeX editing
  • Add your favorite editor here!

Packages

Everything before the command \begin{document} is called the preamble. You may have noticed that some LaTeX preambles contain lines starting with \usepackage. This is how you load packages, which contain even more macros that work on top of the basic LaTeX setup. For example, the diagrams package enables simple commands to create commutative diagrams.

Some of these packages may already be installed in your version of TeX.

Package Description
mathtools Don't fly without it. Includes the amsmath package while adding bug fixes, useful settings, more symbols, and new environments.
amssymb Adds math symbols.
mathrsfs More math symbols.
geometry Used to easily control page size and page margins.
parskip Replaces paragraph indentation by vertical whitespace between paragraphs.
color, xcolor Add text coloring commands.
hyperref Adds commands to create internal and external hyperlinks in your documents, including page links in a table of contents.
setspace Use this to create one-and-a-half spacing, double-spacing, etc.
diagrams.sty This is Paul Taylor's commutative diagrams package.

Templates

– Insert a link here to a TeX template for a qual proposal –

– Insert link(s) here to the dissertation template(s) –

Additional Resources

latex.txt · Last modified: 2017/05/20 22:23 by jgcorliss