Skip to Main Content

How to Use LaTeX

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

Writing a \(\LaTeX\) Document

LaTeX allows users to create a near-endless variety of documents, so it's impossible to give anything like a comprehensive introduction to writing in LaTeX. However, nearly all LaTeX documents follow the same, fairly simple structure:

Basic LaTeX Document Structure

All LaTeX documents are divided into two basic sections

  1. The preamble, which provides its visual style and structure
  2. The body, which provides the content

1. Preamble

The preamble specifies the class of document being written (e.g., article, book, slides, etc.), any packages required, and any options for the document class and packages:

\documentclass[options]{class}
 \usepackage[options]{package1}
 \usepackage[options]{package2}
 ⋮

2. Body

The body directly follows the last line of the preamble. Its general format is fairly simple, with all of the document's visible content written between two lines of code which specify the beginning and end of the document's body:

\begin{document}
 ⋮
 \end{document}

An Incredibly Basic .tex File

Links on Learning to Write in LaTeX

LaTeX Editors

Writing a LaTeX document can either be done in a general text editor or in a LaTeX-specific editor. Below are just a few examples of what's available.

General Text Editors

LaTeX Editors

Browser-Based LaTeX

Because of the sheer volume of packages available for LaTeX and difficulties translating them to an HTML environment, browser-based options are less flexible but more accessible, with the added benefit that they allow collaboration on documents.