I'm a Canadian based in Berlin, Germany. My day job is a Technical Writer in the API space. I write about topics such as technology, usability, creative writing and Canadian history. All views mine. I tweet at @glennjlea. Read more about me here or at LinkedIn.
Site version: 3.0

LaTeX commands overview

The following sections provide an overview of LaTeX syntax.

Note: File extensions are not necessary in a LaTeX file. For example, mystyles.sty is the same as mystyles to the LaTeX typesetter.

## LaTeX commands begin with a backslash

A backslash lets the LaTeX typesetter know that a particular line is a command.

For example \documentclass, \begin, \include and are all LaTeX commands. They let the LaTeX typesetter know how to handle the information within brackets, curly brackets or default values.

The following shows commands within a LaTeX file. Command arguments are included within curly brackets, while command options, if any, are included within square brackets preceding the argument.

## Font settings

Another example of a command are font settings. The following changes the font style of the text within the curly brackets to emphasis:

LaTeX has hundreds of commands. Don’t worry though. Most of them you wont use. In these topics, we only focus on the most important commands, as I see it, needed to produce technical documentation.

## Command arguments are included within curly brackets

Command arguments are included within curly brackets { }. Here are the first two commands from the example above.

The command \documentclass provides the argument {Book} to tell the LaTeX typesetter to use the {book} package for the document layout. The information within the square brackets are the command options that you give to the LaTeX typesetting to define how to use the argument.

Similarly, The command \usepackage provides a path to a styles file called {mystyles}.

## Commands can act as on-off switches

You can tell the LaTeX typesetter to set a command without a scope. When the LaTeX typesetter encounters a command that does not have a scope, it will set all text that follows the command according to the command. The following is a command without an argument.

This command will make all text that follows the /large command to the font size according to the switch. When the LaTeX typesetter encounters a different switch, then the font size will change.

## Commands can include options

Options are provided within square brackets [ ] immediately after the command name but before the command arguments.

The \documentclass using the book argument includes a set of options are provided to the LaTeX typesetter to indicate the paper size, base font size, document status, and pagination.

## Redefine commands using renewcommand

The \renewcommand{} redefines a command. For example, these two commands changes the default LaTeX settings for rule widths to 0 which essentially removes them from the document.

## Using reserved characters

LaTeX has 10 special (reserved) characters that are used in LATEX commands:

To insert a backslash:

To insert a tilde:

To insert a caret:

Other special characters are entered as text by preceding them with a backslash.

## Using text and line spacing

Extra spacing between words and commands is ignored.

Blank lines indicate a new paragraph.

Comments are added using the % character. Any text or commands following the % character are ignored.

## Environment commands

LaTeX has a number of environment commands that are required by the LaTeX typesetter to know how to handle the lines following the command. These include document environments and list environments.

### Document environments

Environments define structures in LaTeX. For instance, the environment variable \begin with the argument {document} tells the LaTeX typesetter that the document begins at this point and ends at the \end command.

### List environments

Other environment commands include both ordered and unordered lists.

For example:

### Auto-numbered environments (sections and equations)

Some environments are automatically numbered such as sections and equations. Auto-numbering can be switched off using an asterisk (*).

For example: