# LaTeX2e unofficial reference manual (July 2021)

This is an unofficial reference manual for LaTeX. See below for the Table of Contents. If you want a tutorial then please instead visit learnlatex.org or this list.

This manual has two versions. One has separate web pages for each section or subsection. It's also available as a single web page and as a pdf.

This document is not official. It has not been reviewed by the LaTeX maintainers. Our goal is to cover all (non-private) LaTeX commands. Your comments and contributions, including bug reports, are very welcome. See our project page for more, including license information and information on how you can contribute to this manual as well as mirror it.

Next: , Up: (dir)   [Contents][Index]

# LaTeX2e: An unofficial reference manual

This document is an unofficial reference manual (version of July 2021) for LaTeX2e, a document preparation system.

Next: , Previous: , Up: Top   [Contents][Index]

This is an unofficial reference manual for the LaTeX2e document preparation system, which is a macro package for the TeX typesetting program (see Overview).

This document’s home page is https://latexref.xyz; it has separate web pages for each topic. Alternatively. https://latexref.xyz/dev/latex2e.html has the entire document on a single page. For other output formats, the sources, and plenty more information, see https://latexref.xyz/dev/.

In this document, we will mostly just use ‘LaTeX’ rather than ‘LaTeX2e’, since the previous version of LaTeX (2.09) was frozen decades ago.

LaTeX is maintained by a group of volunteers (https://latex-project.org). The official documentation written by the LaTeX project is available from their web site. The present document is completely unofficial and has not been written or reviewed by the LaTeX maintainers. Do not send bug reports or anything else about this document to them. Instead, please send all comments to latexrefman@tug.org.

This document is a reference, not a tutorial. There is a vast array of other information available about LaTeX, at all levels. Here are a few introductions.

https://ctan.org/pkg/latex-doc-ptr

Two pages of recommended references to LaTeX documentation.

https://ctan.org/pkg/first-latex-doc

Writing your first document, with a bit of both text and math.

https://ctan.org/pkg/lshort

A longer introduction to LaTeX, translated to many languages.

https://tug.org/begin.html

Introduction to the TeX system, including LaTeX, with further references.

Next: , Previous: , Up: Top   [Contents][Index]

## 2 Overview of LaTeX

LaTeX is a system for typesetting documents. It was originally created by Leslie Lamport in 1984, but has been maintained by a group of volunteers for many years now (https://latex-project.org). It is widely used, particularly but not exclusively for mathematical and technical documents.

A LaTeX user writes an input file containing text to be typeset along with interspersed commands. The default encoding for the text is UTF-8 (as of 2018). The commands specify, for example, how the text should be formatted.

LaTeX is implemented as a set of related so-called “macros” which use Donald E. Knuth’s TeX typesetting program or one of its derivatives, collectively known as “engines”. Thus, the user produces output, typically PDF, by giving the input file to a TeX engine. (The following sections describe all this in more detail.)

The term LaTeX is also sometimes used to mean the language in which the input document is marked up, that is, to mean the set of commands available to a LaTeX user.

The name LaTeX is short for “Lamport TeX”. It is pronounced LAH-teck or LAY-teck, or sometimes LAY-tecks. Inside a document, produce the logo with \LaTeX. Where use of the logo is not sensible, such as in plain text, write it as ‘LaTeX’.

Next: , Up: Overview   [Contents][Index]

### 2.1 Starting and ending

LaTeX files have a simple global structure, with a standard beginning and ending. This is a small example.

\documentclass{article}
\begin{document}
Hello, \LaTeX\ world.
\end{document}


Every LaTeX document has a \begin{document} line and an \end{document} line.

Here, the ‘article’ is the document class. It is implemented in a file article.cls. You can use any document class on your system. A few document classes are defined by LaTeX itself, and vast array of others are widely available. See Document classes.

You can include other LaTeX commands between the \documentclass and the \begin{document} commands. This area is called the preamble.

The \begin{document}, \end{document} pair defines an environment; the ‘document’ environment (and no others) is required in all LaTeX documents (see document). LaTeX make available to you many environments that are documented here (see Environments). Many more are available to you from external packages, most importantly those available at CTAN (see CTAN).

The following sections discuss how to produce PDF or other output from a LaTeX input file.

Next: , Previous: , Up: Overview   [Contents][Index]

### 2.2 Output files

LaTeX produces a main output file and at least two auxiliary files. The main output file’s name ends in either .dvi or .pdf.

.dvi

If LaTeX is invoked with the system command latex then it produces a DeVice Independent file, with extension .dvi. You can view this file with a command such as xdvi, or convert it to a PostScript .ps file with dvips or to a Portable Document Format .pdf file with dvipdfmx. The contents of the file can be dumped in human-readable form with dvitype. A vast array of other DVI utility programs are available (https://mirror.ctan.org/dviware).

.pdf

If LaTeX is invoked via the system command pdflatex, among other commands (see TeX engines), then the main output is a Portable Document Format (PDF) file. Typically this is a self-contained file, with all fonts and images included.

LaTeX always produces at least two additional files.

.log

This transcript file contains summary information such as a list of loaded packages. It also includes diagnostic messages and perhaps additional information for any errors.

.aux

Auxiliary information is used by LaTeX for things such as cross references. For example, the first time that LaTeX finds a forward reference—a cross reference to something that has not yet appeared in the source—it will appear in the output as a doubled question mark ??. When the referred-to spot does eventually appear in the source then LaTeX writes its location information to this .aux file. On the next invocation, LaTeX reads the location information from this file and uses it to resolve the reference, replacing the double question mark with the remembered location.

LaTeX may produce yet more files, characterized by the filename ending. These include a .lof file that is used to make a list of figures, a .lot file used to make a list of tables, and a .toc file used to make a table of contents (see Table of contents etc.). A particular class may create others; the list is open-ended.

Next: , Previous: , Up: Overview   [Contents][Index]

### 2.3 TeX engines

LaTeX is a large set of commands that is executed by a TeX program (see Overview). Such a set of commands is called a format, and is embodied in a binary .fmt file, which can be read much more quickly than the corresponding TeX source.

This section gives a terse overview of the TeX programs that are commonly available (see also Command line interface).

latex
pdflatex

In TeX Live (https://tug.org/texlive), if LaTeX is invoked via either the system command latex or pdflatex, then the pdfTeX engine is run (https://ctan.org/pkg/pdftex). When invoked as latex, the main output is a .dvi file; as pdflatex, the main output is a .pdf file.

pdfTeX incorporates the e-TeX extensions to Knuth’s original program (https://ctan.org/pkg/etex), including additional programming features and bi-directional typesetting, and has plenty of extensions of its own. e-TeX is available on its own as the system command etex, but this is plain TeX (and produces .dvi).

In other TeX distributions, latex may invoke e-TeX rather than pdfTeX. In any case, the e-TeX extensions can be assumed to be available in LaTeX.

lualatex

If LaTeX is invoked via the system command lualatex, the LuaTeX engine is run (https://ctan.org/pkg/luatex). This program allows code written in the scripting language Lua (http://luatex.org) to interact with TeX’s typesetting. LuaTeX handles UTF-8 Unicode input natively, can handle OpenType and TrueType fonts, and produces a .pdf file by default. There is also dvilualatex to produce a .dvi file.

xelatex

If LaTeX is invoked with the system command xelatex, the XeTeX engine is run (https://tug.org/xetex). Like LuaTeX, XeTeX natively supports UTF-8 Unicode and TrueType and OpenType fonts, though the implementation is completely different, mainly using external libraries instead of internal code. XeTeX produces a .pdf file as output; it does not support DVI output.

Internally, XeTeX creates an .xdv file, a variant of DVI, and translates that to PDF using the (x)dvipdfmx program, but this process is automatic. The .xdv file is only useful for debugging.

platex
uplatex

These commands provide significant additional support for Japanese and other languages; the u variant supports Unicode. See https://ctan.org/pkg/ptex and https://ctan.org/pkg/uptex.

As of 2019, there is a companion -dev command and format for all of the above:

dvilualatex-dev
latex-dev
lualatex-dev
pdflatex-dev
platex-dev
uplatex-dev
xelatex-dev

These are candidates for an upcoming LaTeX release. The main purpose is to find and address compatibility problems before an official release.

These -dev formats make it easy for anyone to help test documents and code: you can run, say, pdflatex-dev instead of pdflatex, without changing anything else in your environment. Indeed, it is easiest and most helpful to always run the -dev versions instead of bothering to switch back and forth. During quiet times after a release, the commands will be equivalent.

These are not daily snapshots or untested development code. They undergo the same extensive regression testing by the LaTeX team before being released.

For more information, see “The LaTeX release workflow and the LaTeX dev formats” by Frank Mittelbach, TUGboat 40:2, https://tug.org/TUGboat/tb40-2/tb125mitt-dev.pdf.

Next: , Previous: , Up: Overview   [Contents][Index]

### 2.4 LaTeX command syntax

In the LaTeX input file, a command name starts with a backslash character, \. The name itself then consists of either (a) a string of letters or (b) a single non-letter.

LaTeX commands names are case sensitive so that \pagebreak differs from \Pagebreak (the latter is not a standard command). Most command names are lowercase, but in any event you must enter all commands in the same case as they are defined.

A command may be followed by zero, one, or more arguments. These arguments may be either required or optional. Required arguments are contained in curly braces, {...}. Optional arguments are contained in square brackets, [...]. Generally, but not universally, if the command accepts an optional argument, it comes first, before any required arguments.

Inside of an optional argument, to use the character close square bracket (]) hide it inside curly braces, as in \item[closing bracket {]}]. Similarly, if an optional argument comes last, with no required argument after it, then to make the first character of the following text be an open square bracket, hide it inside curly braces.

LaTeX has the convention that some commands have a * form that is related to the form without a *, such as \chapter and \chapter*. The exact difference in behavior varies from command to command.

This manual describes all accepted options and *-forms for the commands it covers (barring unintentional omissions, a.k.a. bugs).

As of the 2020-10-01 release of LaTeX, the expl3 and xparse packages are part of the LaTeX2e format. They provide a completely different underlying programming language syntax. We won’t try to cover them in this document; see the related package documentation and other LaTeX manuals.

Next: , Previous: , Up: Overview   [Contents][Index]

### 2.5 Environment

Synopsis:

\begin{environment-name}
...
\end{environment-name}


An environment is an area of LaTeX source, inside of which there is a distinct behavior. For instance, for poetry in LaTeX put the lines between \begin{verse} and \end{verse}.

\begin{verse}
There once was a man from Nantucket \\
...
\end{verse}


See Environments, for a list of environments. Particularly notable is that every LaTeX document must have a document environment, a \begin{document} ... \end{document} pair.

The environment-name at the beginning must exactly match that at the end. This includes the case where environment-name ends in a star (*); both the \begin and \end texts must include the star.

Environments may have arguments, including optional arguments. This example produces a table. The first argument is optional (and causes the table to be aligned on its top row) while the second argument is required (it specifies the formatting of columns).

\begin{tabular}[t]{r|l}
... rows of table ...
\end{tabular}


Previous: , Up: Overview   [Contents][Index]

### 2.6 CTAN: The Comprehensive TeX Archive Network

The Comprehensive TeX Archive Network, CTAN, is the TeX and LaTeX community’s repository of free material. It is a set of Internet sites around the world that offer material related to LaTeX for download. Visit CTAN on the web at https://ctan.org.

This material is organized into packages, discrete bundles that typically offer some coherent functionality and are maintained by one person or a small number of people. For instance, many publishers have a package that allows authors to format papers to that publisher’s specifications.

In addition to the massive holdings, the ctan.org web site offers features such as search by name or by functionality.

CTAN is not a single host, but instead is a set of hosts, one of which is the so-called “master”. The master host actively manages the material, for instance, by accepting uploads of new or updated packages. For many years, it has been hosted by the German TeX group, DANTE e.V.

Other sites around the world help out by mirroring, that is, automatically syncing their collections with the master site and then in turn making their copies publicly available. This gives users close to their location better access and relieves the load on the master site. The list of mirrors is at https://ctan.org/mirrors.

Next: , Previous: , Up: Top   [Contents][Index]

## 3 Document classes

The document’s overall class is defined with this command, which is normally the first command in a LaTeX source file.

\documentclass[options]{class}


The following document class names are built into LaTeX. (Many other document classes are available as separate packages; see Overview.)

article

For a journal article, a presentation, and miscellaneous general use.

book

Full-length books, including chapters and possibly including front matter, such as a preface, and back matter, such as an appendix (see Front/back matter).

letter

Mail, optionally including mailing labels (see Letters).

report

For documents of length between an article and a book, such as technical reports or theses, which may contain several chapters.

slides

For slide presentations—rarely used nowadays. The beamer package is perhaps the most prevalent (https://ctan.org/pkg/beamer). See beamer template, for a small template for a beamer document.

Standard options are described in the next section.

Next: , Up: Document classes   [Contents][Index]

### 3.1 Document class options

You can specify global options or class options to the \documentclass command by enclosing them in square brackets. To specify more than one option, separate them with a comma.

\documentclass[option1,option2,...]{class}


Here is the list of the standard class options.

All of the standard classes except slides accept the following options for selecting the typeface size (default is 10pt):

10pt  11pt  12pt


All of the standard classes accept these options for selecting the paper size (these show height by width):

a4paper

210 by 297mm (about 8.25 by 11.75 inches)

a5paper

148 by 210mm (about 5.8 by 8.3 inches)

b5paper

176 by 250mm (about 6.9 by 9.8 inches)

executivepaper

7.25 by 10.5 inches

legalpaper

8.5 by 14 inches

letterpaper

8.5 by 11 inches (the default)

When using one of the engines pdfLaTeX, LuaLaTeX, or XeLaTeX (see TeX engines), options other than letterpaper set the print area but you must also set the physical paper size. One way to do that is to put \pdfpagewidth=\paperwidth and \pdfpageheight=\paperheight in your document’s preamble.

The geometry package provides flexible ways of setting the print area and physical page size.

Miscellaneous other options:

draft
final

Mark (draft) or do not mark (final) overfull boxes with a black box in the margin; default is final.

fleqn

Put displayed formulas flush left; default is centered.

landscape

Selects landscape format; default is portrait.

leqno

Put equation numbers on the left side of equations; default is the right side.

openbib

Use “open” bibliography format.

titlepage
notitlepage

Specifies whether there is a separate page for the title information and for the abstract also, if there is one. The default for the report class is titlepage, for the other classes it is notitlepage.

The following options are not available with the slides class.

onecolumn
twocolumn

Typeset in one or two columns; default is onecolumn.

oneside
twoside

Selects one- or two-sided layout; default is oneside, except that in the book class the default is twoside.

For one-sided printing, the text is centered on the page. For two-sided printing, the \evensidemargin (\oddsidemargin) parameter determines the distance on even (odd) numbered pages between the left side of the page and the text’s left margin, with \oddsidemargin being 40% of the difference between \paperwidth and \textwidth, and \evensidemargin is the remainder.

openright
openany

Determines if a chapter should start on a right-hand page; default is openright for book, and openany for report.

The slides class offers the option clock for printing the time at the bottom of each note.

Next: , Previous: , Up: Document classes   [Contents][Index]

Load a package pkg, with the package options given in the comma-separated list options, as here.

\usepackage[options]{pkg}.


To specify more than one package you can separate them with a comma, as in \usepackage{pkg1,pkg2,...}, or use multiple \usepackage commands.

Any options given in the \documentclass command that are unknown to the selected document class are passed on to the packages loaded with \usepackage.

Previous: , Up: Document classes   [Contents][Index]

### 3.3 Class and package construction

You can create new document classes and new packages. For instance, if your memos must satisfy some local requirements, such as a standard header for each page, then you could create a new class smcmemo.cls and begin your documents with \documentclass{smcmemo}.

What separates a package from a document class is that the commands in a package are useful across classes while those in a document class are specific to that class. Thus, a command to set page headers is for a package while a command to make the page headers say Memo from the SMC Math Department is for a class.

Inside of a class or package file you can use the at-sign @ as a character in command names without having to surround the code containing that command with \makeatletter and \makeatother. See \makeatletter & \makeatother. This allow you to create commands that users will not accidentally redefine. Another technique is to preface class- or package-specific commands with some string to prevent your class or package from interfering with others. For instance, the class smcmemo might have commands \smc@tolist, \smc@fromlist, etc.

#### 3.3.1 Class and package structure

A class file or package file typically has four parts.

1. In the identification part, the file says that it is a LaTeX package or class and describes itself, using the \NeedsTeXFormat and \ProvidesClass or \ProvidesPackage commands.
2. The preliminary declarations part declares some commands and can also load other files. Usually these commands will be those needed for the code used in the next part. For example, an smcmemo class might be called with an option to read in a file with a list of people for the to-head, as \documentclass[mathto]{smcmemo}, and therefore needs to define a command \newcommand{\setto}[1]{\def\@tolist{#1}} used in that file.
3. In the handle options part the class or package declares and processes its options. Class options allow a user to start their document as \documentclass[option list]{class name}, to modify the behavior of the class. An example is when you declare \documentclass[11pt]{article} to set the default document font size.
4. Finally, in the more declarations part the class or package usually does most of its work: declaring new variables, commands and fonts, and loading other files.

Here is a starting class file, which should be saved as stub.cls where LaTeX can find it, for example in the same directory as the .tex file.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{stub}[2017/07/06 stub to start building classes from]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax


It identifies itself, handles the class options via the default of passing them all to the article class, and then loads the article class to provide the basis for this class’s code.

For more, see the official guide for class and package writers, the Class Guide, at https://www.latex-project.org/help/documentation/clsguide.pdf (much of the descriptions here derive from this document), or the tutorial https://www.tug.org/TUGboat/tb26-3/tb84heff.pdf.

Previous: , Up: Class and package construction   [Contents][Index]

#### 3.3.2 Class and package commands

These are the commands designed to help writers of classes or packages.

\AtBeginDvi{specials}

Save in a box register things that are written to the .dvi file at the beginning of the shipout of the first page of the document.

\AtEndOfClass{code}
\AtEndOfPackage{code}

Hook to insert code to be executed when LaTeX finishes processing the current class or package. You can use these hooks multiple times; the code will be executed in the order that you called it. See also \AtBeginDocument.

\CheckCommand{cmd}[num][default]{definition}
\CheckCommand*{cmd}[num][default]{definition}


\ClassError{class name}{error text}{help text}
\PackageError{package name}{error text}{help text}
\ClassWarning{class name}{warning text}
\PackageWarning{package name}{warning text}
\ClassWarningNoLine{class name}{warning text}
\PackageWarningNoLine{package name}{warning text}
\ClassInfo{class name}{info text}
\PackageInfo{package name}{info text}
\ClassInfoNoLine{class name}{info text}
\PackageInfoNoLine{package name}{info text}

Produce an error message, or warning or informational messages.

For \ClassError and \PackageError the message is error text, followed by TeX’s ? error prompt. If the user then asks for help by typing h, they see the help text.

The four warning commands are similar except that they write warning text on the screen with no error prompt. The four info commands write info text only in the transcript file. The NoLine versions do not show the number of the line generating the message, while the other versions do show that number.

To format the messages, including the help text: use \protect to stop a command from expanding, get a line break with \MessageBreak, and get a space with \space when a space character does not allow it, like after a command. Note that LaTeX appends a period to the messages.

\CurrentOption

Expands to the name of the currently-being-processed option. Can only be used within the code argument of either \DeclareOption or \DeclareOption*.

\DeclareOption{option}{code}
\DeclareOption*{code}

Make an option available to a user to invoke in their \documentclass command. For example, the smcmemo class could have an option \documentclass[logo]{smcmemo} allowing users to put the institutional logo on the first page. The class file must contain \DeclareOption{logo}{code} (and later, \ProcessOptions).

If you request an option that has not been declared, by default this will produce a warning like Unused global option(s): [badoption]. Change this behavior with the starred version \DeclareOption*{code}. For example, many classes extend an existing class, using a command such as \LoadClass{article}, and for passing extra options to the underlying class use code such as this.

\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}%
}


Another example is that the class smcmemo may allow users to keep lists of memo recipients in external files. Then the user could invoke \documentclass[math]{smcmemo} and it will read the file math.memo. This code handles the file if it exists and otherwise passes the option to the article class.

\DeclareOption*{\InputIfFileExists{\CurrentOption.memo}{}{%
\PassOptionsToClass{\CurrentOption}{article}}}

\DeclareRobustCommand{cmd}[num][default]{definition}
\DeclareRobustCommand*{cmd}[num][default]{definition}




1. They use the low-level e-TeX protection mechanism rather than the higher level LaTeX \protect mechanism, so they do not incur the slight loss of performance mentioned above, and
2. They make the same distinction between \new…, \renew…, and \provide…, as the standard commands, so they do not just make a log message when you redefine cmd that already exists, in that case you need to use either \renew… or \provide… or you get an error.
\IfFileExists{filename}{true code}{false code}
\InputIfFileExists{filename}{true code}{false code}

Execute true code if LaTeX finds the file file name or false code otherwise. In the first case it executing true code and then inputs the file. Thus the command

\IfFileExists{img.pdf}{%


will include the graphic img.pdf if it is found and otherwise give a warning.

This command looks for the file in all search paths that LaTeX uses, not only in the current directory. To look only in the current directory do something like \IfFileExists{./filename}{true code}{false code}. If you ask for a filename without a .tex extension then LaTeX will first look for the file by appending the .tex; for more on how LaTeX handles file extensions see \input.

\LoadClass[options list]{class name}[release date]
\LoadClassWithOptions{class name}[release date]

Load a class, as with \documentclass[options list]{class name}[release info]. An example is \LoadClass[twoside]{article}.

The options list, if present, is a comma-separated list. The release date is optional. If present it must have the form YYYY/MM/DD.

If you request a release date and the date of the package installed on your system is earlier, then you get a warning on the screen and in the log like this.

You have requested, on input line 4, version 2038/01/19' of
document class article, but only version 2014/09/29 v1.4h
Standard LaTeX document class' is available.


The command version \LoadClassWithOptions uses the list of options for the current class. This means it ignores any options passed to it via \PassOptionsToClass. This is a convenience command that lets you build classes on existing ones, such as the standard article class, without having to track which options were passed.

\ExecuteOptions{options-list}

For each option option in the options-list, in order, this command executes the command \ds@option. If this command is not defined then that option is silently ignored.

It can be used to provide a default option list before \ProcessOptions. For example, if in a class file you want the default to be 11pt fonts then you could specify \ExecuteOptions{11pt}\ProcessOptions\relax.

\NeedsTeXFormat{format}[format date]

Specifies the format that this class must be run under. Often issued as the first line of a class file, and most often used as: \NeedsTeXFormat{LaTeX2e}. When a document using that class is processed, the format name given here must match the format that is actually being run (including that the format string is case sensitive). If it does not match then execution stops with an error like ‘This file needs format LaTeX2e' but this is xxx'.

To specify a version of the format that you know to have certain features, include the optional format date on which those features were implemented. If present it must be in the form YYYY/MM/DD. If the format version installed on your system is earlier than format date then you get a warning like this.

You have requested release 2038/01/20' of LaTeX, but only
release 2016/02/01' is available.

\OptionNotUsed

Adds the current option to the list of unused options. Can only be used within the code argument of either \DeclareOption or \DeclareOption*.

\PassOptionsToClass{option list}{class name}
\PassOptionsToPackage{option list}{package name}

Adds the options in the comma-separated list option list to the options used by any future \RequirePackage or \usepackage command for package package name or the class class name.

The reason for these commands is: you may load a package any number of times with no options but if you want options then you may only supply them when you first load the package. Loading a package with options more than once will get you an error like Option clash for package foo. (LaTeX throws an error even if there is no conflict between the options.)

If your own code is bringing in a package twice then you can collapse that to once, for example replacing the two \RequirePackage[landscape]{geometry} and \RequirePackage[margins=1in]{geometry} with the single command \RequirePackage[landscape,margins=1in]{geometry}.

However, imagine that you are loading firstpkg and inside that package it loads secondpkg, and you need the second package to be loaded with option draft. Then before doing the first package you must queue up the options for the second package, like this.

\PassOptionsToPackage{draft}{secondpkg}
\RequirePackage{firstpkg}


(If firstpkg.sty loads an option in conflict with what you want then you may have to alter its source.)

These commands are useful for general users as well as class and package writers. For instance, suppose a user wants to load the graphicx package with the option draft and also wants to use a class foo that loads the graphicx package, but without that option. The user could start their LaTeX file with \PassOptionsToPackage{draft}{graphicx}\documentclass{foo}.

\ProcessOptions
\ProcessOptions*\@options

Execute the code for each option that the user has invoked. Include it in the class file as \ProcessOptions\relax (because of the existence of the starred command).

Options come in two types. Local options have been specified for this particular package in the options argument of \PassOptionsToPackage{options}, \usepackage[options], or \RequirePackage[options]. Global options are those given by the class user in \documentclass[options] (If an option is specified both locally and globally then it is local.)

When \ProcessOptions is called for a package pkg.sty, the following happens:

1. For each option option so far declared with \DeclareOption, it looks to see if that option is either a global or a local option for pkg. If so then it executes the declared code. This is done in the order in which these options were given in pkg.sty.
2. For each remaining local option, it executes the command \ds@option if it has been defined somewhere (other than by a \DeclareOption); otherwise, it executes the default option code given in \DeclareOption*. If no default option code has been declared then it gives an error message. This is done in the order in which these options were specified.

When \ProcessOptions is called for a class it works in the same way except that all options are local, and the default code for \DeclareOption* is \OptionNotUsed rather than an error.

The starred version \ProcessOptions* executes the options in the order specified in the calling commands, rather than in the order of declaration in the class or package. For a package this means that the global options are processed first.

\ProvidesClass{class name}[release date brief additional information]
\ProvidesClass{class name}[release date]
\ProvidesPackage{package name}[release date brief additional information]
\ProvidesPackage{package name}[release date]

Identifies the class or package, printing a message to the screen and the log file.

When you load a class or package, for example with \documentclass{smcmemo} or \usepackage{test}, LaTeX inputs a file. If the name of the file does not match the class or package name declared in it then you get a warning. Thus, if you invoke \documentclass{smcmemo}, and the file smcmemo.cls has the statement \ProvidesClass{xxx} then you get a warning like You have requested document class smcmemo', but the document class provides 'xxx'. This warning does not prevent LaTeX from processing the rest of the class file normally.

If you include the optional argument then you must include a date, before any spaces, of the form YYYY/MM/DD. The rest of the optional argument is free-form, although it traditionally identifies the class, and is written to the screen during compilation and to the log file. Thus, if your file smcmemo.cls contains the line \ProvidesClass{smcmemo}[2008/06/01 v1.0 SMC memo class] and your document’s first line is \documentclass{smcmemo} then you will see Document Class: smcmemo 2008/06/01 v1.0 SMC memo class.

The date in the optional argument allows class and package users to ask to be warned if the version of the class or package is earlier than release date. For instance, a user could enter \documentclass{smcmemo}[2018/10/12] or \usepackage{foo}[[2017/07/07]] to require a class or package with certain features by specifying that it must be released no earlier than the given date. (Although, in practice package users only rarely include a date, and class users almost never do.)

\ProvidesFile{filename}[additional information]

Declare a file other than the main class and package files, such as configuration files or font definition files. Put this command in that file and you get in the log a string like File: test.config 2017/10/12 config file for test.cls for filename equal to ‘test.config’ and additional information equal to ‘2017/10/12 config file for test.cls’.

\RequirePackage[option list]{package name}[release date]
\RequirePackageWithOptions{package name}[release date]

Load a package, like the command \usepackage (see Additional packages). The LaTeX development team strongly recommends use of these commands over Plain TeX’s \input; see the Class Guide. An example is \RequirePackage[landscape,margin=1in]{geometry}.

The option list, if present, is a comma-separated list. The release date, if present, must have the form YYYY/MM/DD. If the release date of the package as installed on your system is earlier than release date then you get a warning like You have requested, on input line 9, version 2017/07/03' of package jhtest, but only version 2000/01/01' is available.

The \RequirePackageWithOptions version uses the list of options for the current class. This means it ignores any options passed to it via \PassOptionsToClass. This is a convenience command to allow easily building classes on existing ones without having to track which options were passed.

The difference between \usepackage and \RequirePackage is small. The \usepackage command is intended for the document file while \RequirePackage is intended for package and class files. Thus, using \usepackage before the \documentclass command causes LaTeX to give error like \usepackage before \documentclass, but you can use \RequirePackage there.

Next: , Previous: , Up: Top   [Contents][Index]

## 4 Fonts

LaTeX comes with powerful font capacities. For one thing, its New Font Selection Scheme allows you to work easily with the font families in your document (for instance, see Font styles). And, LaTeX documents can use most fonts that are available today, including versions of Times Roman, Helvetica, Courier, etc. (Note, though, that many fonts do not have support for mathematics.)

The first typeface in the TeX world was the Computer Modern family, developed by Donald Knuth. It is the default for LaTeX documents and is still the most widely used. But changing to another font often only involves a few commands. For instance, putting the following in your preamble gives you a Palatino-like font, which is handsome and more readable online than many other fonts, while still allowing you to typeset mathematics. (This example is from Michael Sharpe, https://math.ucsd.edu/~msharpe/RcntFnts.pdf.)

\usepackage[osf]{newpxtext} % osf for text, not math
\usepackage{cabin} % sans serif
\usepackage[varqu,varl]{inconsolata} % sans serif typewriter
\usepackage[bigdelims,vvarbb]{newpxmath} % bb from STIX
\usepackage[cal=boondoxo]{mathalfa} % mathcal


In addition, the xelatex or lualatex engines allow you to use any fonts on your system that are in OpenType or TrueType format (see TeX engines).

The LaTeX Font Catalogue (https://tug.org/FontCatalogue) shows font sample graphics and copy-and-pasteable source to use many fonts, including many with support for mathematics. It aims to cover all Latin alphabet free fonts available for easy use with LaTeX.

More information is also available from the TeX Users Group, at https://www.tug.org/fonts/.

Next: , Up: Fonts   [Contents][Index]

### 4.1 fontenc package

Synopsis:

\usepackage[font_encoding]{fontenc}


or

\usepackage[font_encoding1, font_encoding2, ...]{fontenc}


Specify the font encodings. A font encoding is a mapping of the character codes to the font glyphs that are used to typeset your output.

This package only applies if you use the pdflatex engine (see TeX engines). If you use the xelatex or lualatex engine then instead use the fontspec package.

TeX’s original font family, Computer Modern, has a limited character set. For instance, to make common accented characters you must use \accent (see \accent) but this disables hyphenation. TeX users have agreed on a number of standards to access the larger sets of characters provided by modern fonts. If you are using pdflatex then this in the preamble

\usepackage[T1]{fontenc}


gives you support for the most widespread European languages, including French, German, Italian, Polish, and others. In particular, if you have words with accented letters then LaTeX will hyphenate them and your output can be copied and pasted. (The optional second line allows you to directly enter accented characters into your source file.)

If you are using an encoding such as T1 and the characters appear blurry or do not magnify well then your fonts may be bitmapped, sometimes called raster or Type 3. You want vector fonts. Use a package such as lmodern or cm-super to get a font that extends LaTeX’s default using vector fonts.

For each font_encoding given as an option but not already declared, this package loads the encoding definition files, named font_encodingenc.def. It also sets \encodingdefault to be the last encoding in the option list.

These are the common values for font_encoding.

OT1

The original encoding for TeX. Limited to mostly English characters.

OMS, OML

Math symbols and math letters encoding.

T1

TeX text extended. Sometimes called the Cork encoding for the Users Group meeting where it was developed. Gives access to most European accented characters. The most common option for this package.

TS1

Text Companion encoding.

LaTeX’s default is to load OML, T1, OT1, and then OMS, and set the default to OT1.

Even if you do not use accented letters, you may need to specify a font encoding if your font requires it.

If you use T1 encoded fonts other than the default Computer Modern family then you may need to load the package that selects your fonts before loading fontenc, to prevent the system from loading any T1 encoded fonts from the default.

The LaTeX team reserve encoding names starting with: ‘T’ for the standard text encodings with 256 characters, ‘TS’ for symbols that extend the corresponding T encodings, ‘X’ for test encodings, ‘M’ for standard math encodings with 256 characters, ‘A’ for special applications, ‘OT’ for standard text encodings with 128 characters, and ‘OM’ for standard math encodings with 128 characters (‘O’ stands for ‘obsolete’).

This package provides a number of commands, detailed below. Many of them are encoding-specific, so if you have defined a command that works for one encoding but the current encoding is different then the command is not in effect.

Next: , Up: fontenc package   [Contents][Index]

#### 4.1.1 \DeclareFontEncoding

Synopsis:

\DeclareFontEncoding{encoding}{text-settings}{math-settings}


Declare the font encoding encoding. It also saves the value of encoding in \LastDeclaredEncoding (see \LastDeclaredEncoding).

The file t1enc.def contains this line (followed by many others).

\DeclareFontEncoding{T1}{}{}


The text-settings are the commands that LaTeX will run every time it switches from one encoding to another with the \selectfont or \fontencoding command. The math-settings are the commands that LaTeX will use whenever the font is accessed as a math alphabet.

LaTeX ignores any space characters inside text-settings and math-settings, to prevent unintended spaces in the output.

If you invent an encoding you should pick a two or three letter name starting with ‘L’ for ‘local’, or ‘E’ for ‘experimental’.

Note that output encoding files may be read several times by LaTeX so using, e.g., \newcommand may cause an error. In addition, such files should contain \ProvidesFile line (see Class and package commands).

Note also that you should use the \...Default commands only in a package, not in the encoding definition files, since those files should only contain declarations specific to that encoding.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.2 \DeclareTextAccent

Synopsis:

\DeclareTextAccent{cmd}{encoding}{slot}


Define an accent, to be put on top of other glyphs, in the encoding encoding at the location slot.

This line from t1enc.def declares that to make a circumflex accent as in \^A, the system will put the accent in slot 2 over the ‘A’ character, which is represented in ASCII as 65. (This holds unless there is a relevant DeclareTextComposite or \DeclareTextCompositeCommand declaration; see \DeclareTextComposite.)

\DeclareTextAccent{\^}{T1}{2}


If cmd has already been defined then \DeclareTextAccent does not give an error but it does log the redefinition in the transcript file.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.3 \DeclareTextAccentDefault

Synopsis:

\DeclareTextAccentDefault{cmd}{encoding}


If there is an encoding-specific accent command cmd but there is no associated \DeclareTextAccent for that encoding then this command will pick up the slack, by saying to use it as described for encoding.

For example, to make the encoding OT1 be the default encoding for the accent \", declare this.

\DeclareTextAccentDefault{\"}{OT1}


If you issue a \" when the current encoding does not have a definition for that accent then LaTeX will use the definition from OT1

That is, this command is equivalent to this call (see \UseTextSymbol & \UseTextAccent).

\DeclareTextCommandDefault[1]{cmd}
{\UseTextAccent{encoding}{cmd}{#1}}


Note that \DeclareTextAccentDefault works for any one-argument fontenc command, not just the accent command.

#### 4.1.4 \DeclareTextCommand & \ProvideTextCommand

Synopsis, one of:

\DeclareTextCommand{cmd}{encoding}{defn}
\DeclareTextCommand{cmd}{encoding}[nargs]{defn}
\DeclareTextCommand{cmd}{encoding}[nargs][optargdefault]{defn}


or one of:

\ProvideTextCommand{cmd}{encoding}{defn}
\ProvideTextCommand{cmd}{encoding}[nargs]{defn}
\ProvideTextCommand{cmd}{encoding}[nargs][optargdefault]{defn}


Define the command cmd, which will be specific to one encoding. The command name cmd must begin with a backslash, \. These commands can only appear in the preamble. Redefining cmd does not cause an error. The defined command will be robust even if the code in defn is fragile (see \protect).

For example, the file t1enc.def contains this line.

\DeclareTextCommand{\textperthousand}{T1}{\%\char 24 }


With that, you can express parts per thousand.

\usepackage[T1]{fontenc}  % in preamble
...
Legal limit is $$0.8$$\textperthousand.


If you change the font encoding to OT1 then you get an error like ‘LaTeX Error: Command \textperthousand unavailable in encoding OT1’.

The \ProvideTextCommand variant does the same, except that it does nothing if cmd is already defined. The \DeclareTextSymbol command is faster than this one for simple slot-to-glyph association (see \DeclareTextSymbol)


Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.5 \DeclareTextCommandDefault & \ProvideTextCommandDefault 

Synopsis:

\DeclareTextCommandDefault{cmd}{defn}


or:

\ProvideTextCommandDefault{cmd}{defn}


Give a default definition for cmd, for when that command is not defined in the encoding currently in force. This default should only use encodings known to be available.

This makes \copyright available.

\DeclareTextCommandDefault{\copyright}{\textcircled{c}}


It uses only an encoding (OMS) that is always available.

The \DeclareTextCommandDefault should not occur in the encoding definition files since those files should declare only commands for use when you select that encoding. It should instead be in a package.

As with the related non-default commands, the \ProvideTextCommandDefault has exactly the same behavior as \DeclareTextCommandDefault except that it does nothing if cmd is already defined (see \DeclareTextCommand & \ProvideTextCommand). So, packages can use it to provide fallbacks that other packages can improve upon.

#### 4.1.6 \DeclareTextComposite

Synopsis:

\DeclareTextComposite{cmd}{encoding}{simple_object}{slot}


Access an accented glyph directly, that is, without having to put an accent over a separate character.

This line from t1enc.def means that \^o will cause LaTeX to typeset lowercase ‘o’ by taking the character directly from location 224 in the font.

\DeclareTextComposite{\^}{T1}{o}{244}


See fontenc package, for a list of common encodings. The simple_object should be a single character or a single command. The slot argument is usually a positive integer represented in decimal (although octal or hexadecimal are possible). Normally cmd has already been declared for this encoding, either with \DeclareTextAccent or with a one-argument \DeclareTextCommand. In t1enc.def, the above line follows the \DeclareTextAccent{\^}{T1}{2} command.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.7 \DeclareTextCompositeCommand

Synopsis:

\DeclareTextCompositeCommand{cmd}{encoding}{arg}{code}


A more general version of \DeclareTextComposite that runs arbitrary code with cmd.

This allows accents on ‘i’ to act like accents on dotless i, \i.

\DeclareTextCompositeCommand{\'}{OT1}{i}{\'\i}


See fontenc package, for a list of common encodings. Normally cmd will have already been declared with \DeclareTextAccent or as a one argument \DeclareTextCommand.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.8 \DeclareTextSymbol

Synopsis:

\DeclareTextSymbol{cmd}{encoding}{slot}


Define a symbol in the encoding encoding at the location slot. Symbols defined in this way are for use in text, not mathematics.

For example, this line from t1enc.def declares the number of the glyph to use for «, the left guillemet.

\DeclareTextSymbol{\guillemotleft}{T1}{19}


The command \DeclareTextCommand{\guillemotleft}{T1}{\char 19} has the same effect but is slower (see \DeclareTextCommand & \ProvideTextCommand).

See fontenc package, for a list of common encodings. The slot can be specified in decimal, or octal (as in '023), or hexadecimal (as in "13), although decimal has the advantage that single quote or double quote could be redefined by another package.

If cmd has already been defined then \DeclareTextSymbol does not give an error but it does log the redefinition in the transcript file.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.9 \DeclareTextSymbolDefault

Synopsis:

\DeclareTextSymbolDefault{cmd}{encoding}


If there is an encoding-specific symbol command cmd but there is no associated \DeclareTextSymbol for that encoding, then this command will pick up the slack, by saying to get the symbol as described for encoding.

For example, to declare that if the current encoding has no meaning for \textdollar then use the one from OT1, declare this.

\DeclareTextSymbolDefault{\textdollar}{OT1}


That is, this command is equivalent to this call (see \UseTextSymbol & \UseTextAccent).

\DeclareTextCommandDefault{cmd}
{\UseTextSymbol{encoding}{cmd}}


Note that \DeclareTextSymbolDefault can be used to define a default for any zero-argument fontenc command.

Next: , Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.10 \LastDeclaredEncoding

Synopsis:

\LastDeclaredEncoding


Get the name of the most recently declared encoding. The \DeclareFontEncoding command stores the name so that it can be retrieved with this command (see \DeclareFontEncoding).

This relies on \LastDeclaredEncoding rather than give the name of the encoding explicitly.

\DeclareFontEncoding{JH1}{}{}
\DeclareTextAccent{\'}{\LastDeclaredEncoding}{0}


Previous: , Up: fontenc package   [Contents][Index]

#### 4.1.11 \UseTextSymbol & \UseTextAccent

Synopsis:

\UseTextSymbol{encoding}{cmd}


or:

\UseTextAccent{encoding}{cmd}{text}


Use a symbol or accent not from the current encoding.

In general, to use a fontenc command in an encoding where it is not defined, and if the command has no arguments, then you can use it like this:

\UseTextSymbol{OT1}{\ss}


which is equivalent to this (note the outer braces form a group, so LaTeX reverts back to the prior encoding after the \ss):

{\fontencoding{OT1}\selectfont\ss}


Similarly, to use a fontenc command in an encoding where it is not defined, and if the command has one argument, you can use it like this:

\UseTextAccent{OT1}{\'}{a}


which is equivalent to this (again note the outer braces forming a group):

{fontencoding{OT1}\selectfont\'{\fontencoding{enc_in_use}\selectfont a}}


Here, enc_in_use is the encoding in force before this sequence of commands, so that ‘a’ is typeset using the current encoding and only the accent is taken from OT1.

Next: , Previous: , Up: Fonts   [Contents][Index]

### 4.2 Font styles

The following type style commands are supported by LaTeX.

In the table below the listed commands, the \text... commands, are used with an argument as in \textit{text}. This is the preferred form. But shown after it in parenthesis is the corresponding declaration form, which is often useful. This form takes no arguments, as in {\itshape text}. The scope of the declaration form lasts until the next type style command or the end of the current group. In addition, each has an environment form such as \begin{itshape}...\end{itshape}, which we’ll describe further at the end of the section.

These commands, in any of the three forms, are cumulative; for instance you can get bold sans serif by saying either of \sffamily\bfseries or \bfseries\sffamily.

One advantage of these commands is that they automatically insert italic corrections if needed (see \/). Specifically, they insert the italic correction unless the following character is in the list \nocorrlist, which by default consists of period and comma. To suppress the automatic insertion of italic correction, use \nocorr at the start or end of the command argument, such as \textit{\nocorr text} or \textsc{text \nocorr}.

\textrm (\rmfamily)

Roman.

\textit (\itshape)

Italics.

\textmd (\mdseries)

Medium weight (default).

\textbf (\bfseries)

Boldface.

\textup (\upshape)

Upright (default).

\textsl (\slshape)

Slanted.

\textsf (\sffamily)

Sans serif.

\textsc (\scshape)

Small caps.

\texttt (\ttfamily)

Typewriter.

\textnormal (\normalfont)

Main document font.

Although it also changes fonts, the \emph{text} command is semantic, for text to be emphasized, and should not be used as a substitute for \textit. For example, \emph{start text \emph{middle text} end text} will result in the start text and end text in italics, but middle text will be in roman.

LaTeX also provides the following commands, which unconditionally switch to the given style, that is, are not cumulative. They are used as declarations: {\cmd...} instead of \cmd{...}.

(The unconditional commands below are an older version of font switching. The earlier commands are an improvement in most circumstances. But sometimes an unconditional font switch is what is needed.)

\bf

Switch to bold face.

\cal

Switch to calligraphic letters for math.

\it

Italics.

\rm

Roman.

\sc

Small caps.

\sf

Sans serif.

\sl

Slanted (oblique).

\tt

Typewriter (monospace, fixed-width).

The \em command is the unconditional version of \emph.

The following commands are for use in math mode. They are not cumulative, so \mathbf{\mathit{symbol}} does not create a boldface and italic symbol; instead, it will just be in italics. This is because typically math symbols need consistent typographic treatment, regardless of the surrounding environment.

\mathrm

Roman, for use in math mode.

\mathbf

Boldface, for use in math mode.

\mathsf

Sans serif, for use in math mode.

\mathtt

Typewriter, for use in math mode.

\mathit
(\mit)

Italics, for use in math mode.

\mathnormal

For use in math mode, e.g., inside another type style declaration.

\mathcal

Calligraphic letters, for use in math mode.

In addition, the command \mathversion{bold} can be used for switching to bold letters and symbols in formulas. \mathversion{normal} restores the default.

Finally, the command \oldstylenums{numerals} will typeset so-called “old-style” numerals, which have differing heights and depths (and sometimes widths) from the standard “lining” numerals, which all have the same height as uppercase letters. LaTeX’s default fonts support this, and will respect \textbf (but not other styles; there are no italic old-style numerals in Computer Modern). Many other fonts have old-style numerals also; sometimes package options are provided to make them the default. FAQ entry: https://www.texfaq.org/FAQ-osf.

Next: , Previous: , Up: Fonts   [Contents][Index]

### 4.3 Font sizes

The following standard type size commands are supported by LaTeX. The table shows the command name and the corresponding actual font size used (in points) with the ‘10pt’, ‘11pt’, and ‘12pt’ document size options, respectively (see Document class options).

Command10pt11pt12pt
\tiny566
\scriptsize788
\footnotesize8910
\small91010.95
\normalsize (default)1010.9512
\large121214.4
\Large14.414.417.28
\LARGE17.2817.2820.74
\huge20.7420.7424.88
\Huge24.8824.8824.88

The commands are listed here in declaration (not environment) form, since that is how they are typically used. For example.

\begin{quotation} \small
The Tao that can be named is not the eternal Tao.
\end{quotation}


Here, the scope of the \small lasts until the end of the quotation environment. It would also end at the next type style command or the end of the current group, so you could enclose it in curly braces {\small This text is typeset in the small font.}.

An environment form of each of these commands is also defined; for instance, \begin{tiny}...\end{tiny}. However, in practice this form can easily lead to unwanted spaces at the beginning and/or end of the environment without careful consideration, so it’s generally less error-prone to stick to the declaration form.

(Aside: Technically, due to the way LaTeX defines \begin and \end, nearly every command that does not take an argument technically has an environment form. But in almost all cases, it would only cause confusion to use it. The reason for mentioning the environment form of the font size declarations specifically is that this particular use is not rare.)

Previous: , Up: Fonts   [Contents][Index]

### 4.4 Low-level font commands

These commands are primarily intended for writers of macros and packages. The commands listed here are only a subset of the available ones.

\fontencoding{encoding}

Select the font encoding, the encoding of the output font. There are a large number of valid encodings. The most common are OT1, Knuth’s original encoding for Computer Modern (the default), and T1, also known as the Cork encoding, which has support for the accented characters used by the most widespread European languages (German, French, Italian, Polish and others), which allows TeX to hyphenate words containing accented letters. For more, see https://ctan.org/pkg/encguide.

\fontfamily{family}

Select the font family. The web page https://tug.org/FontCatalogue/ provides one way to browse through many of the fonts easily used with LaTeX. Here are examples of some common families.

 pag Avant Garde fvs Bitstream Vera Sans pbk Bookman bch Charter ccr Computer Concrete cmr Computer Modern cmss Computer Modern Sans Serif cmtt Computer Modern Typewriter pcr Courier phv Helvetica fi4 Inconsolata lmr Latin Modern lmss Latin Modern Sans lmtt Latin Modern Typewriter pnc New Century Schoolbook ppl Palatino ptm Times uncl Uncial put Utopia pzc Zapf Chancery
\fontseries{series}

Select the font series. A series combines a weight and a width. Typically, a font supports only a few of the possible combinations. Some common combined series values include:

 m Medium (normal) b Bold c Condensed bc Bold condensed bx Bold extended

The possible values for weight, individually, are:

 ul Ultra light el Extra light l Light sl Semi light m Medium (normal) sb Semi bold b Bold eb Extra bold ub Ultra bold

The possible values for width, individually, are (the meaning and relationship of these terms varies with individual typefaces):

 uc Ultra condensed ec Extra condensed c Condensed sc Semi condensed m Medium sx Semi expanded x Expanded ex Extra expanded ux Ultra expanded

When forming the series string from the weight and width, drop the m that stands for medium weight or medium width, unless both weight and width are m, in which case use just one (‘m’).

\fontshape{shape}

Select font shape. Valid shapes are:

 n Upright (normal) it Italic sl Slanted (oblique) sc Small caps ui Upright italics ol Outline

The two last shapes are not available for most font families, and small caps are often missing as well.

\fontsize{size}{skip}

Set the font size and the line spacing. The unit of both parameters defaults to points (pt). The line spacing is the nominal vertical space between lines, baseline to baseline. It is stored in the parameter \baselineskip. The default \baselineskip for the Computer Modern typeface is 1.2 times the \fontsize. Changing \baselineskip directly is inadvisable since its value is reset every time a size change happens; instead use \baselinestretch. (see \baselineskip & \baselinestretch).

\linespread{factor}

Equivalent to \renewcommand{\baselinestretch}{factor}, and therefore must be followed by \selectfont to have any effect. Best specified in the preamble, or use the setspace package, as just described.

\selectfont

The effects of the font commands described above do not happen until \selectfont is called, as in \fontfamily{familyname}\selectfont. It is often useful to put this in a macro:
\newcommand*{\myfont}{\fontfamily{familyname}\selectfont}

\usefont{enc}{family}{series}{shape}

The same as invoking \fontencoding, \fontfamily, \fontseries and \fontshape with the given parameters, followed by \selectfont. For example:

\usefont{ot1}{cmr}{m}{n}


Next: , Previous: , Up: Top   [Contents][Index]

## 5 Layout

Commands for controlling the general page layout.

Next: , Up: Layout   [Contents][Index]

### 5.1 \onecolumn

Synopsis:

\onecolumn


Start a new page and produce single-column output. If the document is given the class option onecolumn then this is the default behavior (see Document class options). This command is fragile (see \protect).

Next: , Previous: , Up: Layout   [Contents][Index]

### 5.2 \twocolumn

Synopses:

\twocolumn
\twocolumn[prelim one column text]


Start a new page and produce two-column output. If the document is given the class option twocolumn then this is the default (see Document class options). This command is fragile (see \protect).

If the optional prelim one column text argument is present, it is typeset in one-column mode before the two-column typesetting starts.

These parameters control typesetting in two-column output:

\columnsep

The distance between columns. The default is 35pt. Change it with a command such as \setlength{\columnsep}{40pt}. You must change it before the two column mode starts; in the preamble is a good place.

\columnseprule

The width of the rule between columns. The default is 0pt, meaning that there is no rule. Otherwise, the rule appears halfway between the two columns. Change it with a command such as \setlength{\columnseprule}{0.4pt}, before the two-column mode starts.

\columnwidth

The width of a single column. In one-column mode this is equal to \textwidth. In two-column mode by default LaTeX sets the width of each of the two columns, \columnwidth, to be half of \textwidth minus \columnsep.

In a two-column document, the starred environments table* and figure* are two columns wide, whereas the unstarred environments table and figure take up only one column (see figure and see table). LaTeX places starred floats at the top of a page. The following parameters control float behavior of two-column output.

\dbltopfraction

The maximum fraction at the top of a two-column page that may be occupied by two-column wide floats. The default is 0.7, meaning that the height of a table* or figure* environment must not exceed 0.7\textheight. If the height of your starred float environment exceeds this then you can take one of the following actions to prevent it from floating all the way to the back of the document:

• Use the [tp] location specifier to tell LaTeX to try to put the bulky float on a page by itself, as well as at the top of a page.
• Use the [t!] location specifier to override the effect of \dbltopfraction for this particular float.
• Increase the value of \dbltopfraction to a suitably large number, to avoid going to float pages so soon.

You can redefine it, as with \renewcommand{\dbltopfraction}{0.9}.

\dblfloatpagefraction

For a float page of two-column wide floats, this is the minimum fraction that must be occupied by floats, limiting the amount of blank space. LaTeX’s default is 0.5. Change it with \renewcommand.

\dblfloatsep

On a float page of two-column wide floats, this length is the distance between floats, at both the top and bottom of the page. The default is 12pt plus2pt minus2pt for a document set at 10pt or 11pt, and 14pt plus2pt minus4pt for a document set at 12pt.

\dbltextfloatsep

This length is the distance between a multi-column float at the top or bottom of a page and the main text. The default is 20pt plus2pt minus4pt.

\dbltopnumber

On a float page of two-column wide floats, this counter gives the maximum number of floats allowed at the top of the page. The LaTeX default is 2.

This example uses \twocolumn’s optional argument of to create a title that spans the two-column article:

\documentclass[twocolumn]{article}
\newcommand{\authormark}[1]{\textsuperscript{#1}}
\begin{document}
\twocolumn[{% inside this optional argument goes one-column text
\centering

(Aside: The construct $$math$$ from Plain TeX is sometimes mistakenly used as a synonym for displaymath. It is not a synonym, and is not officially supported in LaTeX at all;  doesn’t support the fleqn option (see Document class options), has different vertical spacing, and doesn’t perform consistency checks.)

The output from this example is centered and alone on its line.

\begin{displaymath}
\int_1^2 x^2\,dx=7/3
\end{displaymath}


Also, the integral sign is larger than the inline version $$\int_1^2 x^2\,dx=7/3$$ produces.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.6 document

The document environment encloses the entire body of a document. It is required in every LaTeX document. See Starting and ending.

Next: , Up: document   [Contents][Index]

#### 8.6.1 \AtBeginDocument

Synopsis:

\AtBeginDocument{code}


Save code and execute it when \begin{document} is executed, at the very end of the preamble. The code is executed after the font selection tables have been set up, so the normal font for the document is the current font. However, the code is executed as part of the preamble so you cannot do any typesetting with it.

You can issue this command more than once; the successive code lines will be executed in the order that you gave them.

Previous: , Up: document   [Contents][Index]

#### 8.6.2 \AtEndDocument

Synopsis:

\AtEndDocument{code}


Save code and execute it near the end of the document. Specifically, it is executed when \end{document} is executed, before the final page is finished and before any leftover floating environments are processed. If you want some of the code to be executed after these two processes then include a \clearpage at the appropriate point in code.

You can issue this command more than once; the successive code lines will be executed in the order that you gave them.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.7 enumerate

Synopsis:

\begin{enumerate}
\item[optional label of first item] text of first item
\item[optional label of second item] text of second item
...
\end{enumerate}


Environment to produce a numbered list of items. The format of the label numbering depends on the nesting level of this environment; see below. The default top-level numbering is ‘1.’, ‘2.’, etc. Each enumerate list environment must have at least one item; having none causes the LaTeX error ‘Something's wrong--perhaps a missing \item’.

This example gives the first two finishers in the 1908 Olympic marathon. As a top-level list the labels would come out as ‘1.’ and ‘2.’.

\begin{enumerate}
\item Johnny Hayes (USA)
\item Charles Hefferon (RSA)
\end{enumerate}


Start list items with the \item command (see \item). If you give \item an optional argument by following it with square brackets, as in \item[Interstitial label], then the next item will continue the interrupted sequence (see \item). That is, you will get labels like ‘1.’, then ‘Interstitial label’, then ‘2.’. Following the \item is optional text, which may contain multiple paragraphs.

Enumerations may be nested within other enumerate environments, or within any paragraph-making environment such as itemize (see itemize), up to four levels deep. This gives LaTeX’s default for the format at each nesting level, where 1 is the top level, the outermost level.

1. arabic number followed by a period: ‘1.’, ‘2.’, …
2. lowercase letter inside parentheses: ‘(a)’, ‘(b)’ …
3. lowercase roman numeral followed by a period: ‘i.’, ‘ii.’, …
4. uppercase letter followed by a period: ‘A.’, ‘B.’, …

The enumerate environment uses the counters \enumi through \enumiv (see Counters).

For other major LaTeX labeled list environments, see description and itemize. For information about list layout parameters, including the default values, and for information about customizing list layout, see list. The package enumitem is useful for customizing lists.


\renewcommand{\labelenumi}{\textbf{\Alph{enumi}}}
\begin{enumerate}
\item Shows as boldface A
\item Shows as boldface B
\end{enumerate}


For a list of counter-labeling commands see \alph \Alph \arabic \roman \Roman \fnsymbol.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.8 eqnarray

The eqnarray environment is obsolete. It has infelicities, including spacing that is inconsistent with other mathematics elements. (See “Avoid eqnarray!” by Lars Madsen https://tug.org/TUGboat/tb33-1/tb103madsen.pdf). New documents should include the amsmath package and use the displayed mathematics environments provided there, such as the align environment. We include a description only for completeness and for working with old documents.

Synopsis:

\begin{eqnarray}
first formula left  &first formula middle  &first formula right \\
...
\end{eqnarray}


or

\begin{eqnarray*}
first formula left  &first formula middle  &first formula right \\
...
\end{eqnarray*}


Display a sequence of equations or inequalities. The left and right sides are typeset in display mode, while the middle is typeset in text mode.

It is similar to a three-column array environment, with items within a row separated by an ampersand (&), and with rows separated by double backslash  \\). The starred form of line break (\\*) can also be used to separate equations, and will disallow a page break there (see \\).

The unstarred form eqnarray places an equation number on every line (using the equation counter), unless that line contains a \nonumber command. The starred form eqnarray* omits equation numbering, while otherwise being the same.

The command \lefteqn is used for splitting long formulas across lines. It typesets its argument in display style flush left in a box of zero width.

This example shows three lines. The first two lines make an inequality, while the third line has not entry on the left side.

\begin{eqnarray*}
\lefteqn{x_1+x_2+\cdots+x_n}     \\
&\leq &y_1+y_2+\cdots+y_n      \\
&=    &z+y_3+\cdots+y_n
\end{eqnarray*}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.9 equation

Synopsis:


mathematical text



The same as a displaymath environment (see displaymath) except that LaTeX puts an equation number flush to the right margin. The equation number is generated using the equation counter.

You should have no blank lines between and , or LaTeX will tell you that there is a missing dollar sign.

The package amsmath package has extensive displayed equation facilities. New documents should include this package.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.10 figure

Synopsis:

\begin{figure}[placement]
figure body
\caption[loftitle]{title}  % optional
\label{label}              % optional
\end{figure}


or:

\begin{figure*}[placement]
figure body
\caption[loftitle]{title}  % optional
\label{label}              % optional
\end{figure*}


Figures are for material that is not part of the normal text. An example is material that you cannot have split between two pages, such as a graphic. Because of this, LaTeX does not typeset figures in sequence with normal text but instead “floats” them to a convenient place, such as the top of a following page (see Floats).

The figure body can consist of imported graphics (see Graphics), or text, LaTeX commands, etc. It is typeset in a parbox of width \textwidth.

The possible values of placement are h for ‘here’, t for ‘top’, b for ‘bottom’, and p for ‘on a separate page of floats’. For the effect of these options on the float placement algorithm, see Floats.

The starred form figure* is used when a document is in double-column mode (see \twocolumn). It produces a figure that spans both columns, at the top of the page. To add the possibility of placing at a page bottom see the discussion of placement b in Floats.

The label is optional; it is used for cross references (see Cross references). The optional \caption command specifies caption text for the figure. By default it is numbered. If loftitle is present, it is used in the list of figures instead of title (see Table of contents etc.).

This example makes a figure out of a graphic. LaTeX will place that graphic and its caption at the top of a page or, if it is pushed to the end of the document, on a page of floats.

\usepackage{graphicx}  % in preamble
...
\begin{figure}[t]
\centering
\includegraphics[width=0.5\textwidth]{CTANlion.png}
\caption{The CTAN lion, by Duane Bibby}
\end{figure}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.11 filecontents

Synopsis:

\begin{filecontents}[option]{filename}
text
\end{filecontents}


or

\begin{filecontents*}[option]{filename}
text
\end{filecontents*}


Create a file named filename in the current directory (or the output directory, if specified; see output directory) and write text to it. By default, an existing file is not overwritten.

The unstarred version of the environment filecontents prefixes the content of the created file with a header of TeX comments; see the example below. The starred version filecontents* does not include the header.

The possible options are:

force
overwrite

Overwrite an existing file.

noheader

Omit the header. Equivalent to using filecontents*.

nosearch

Only check the current directory (and the output directory, if specified) for an existing file, not the entire search path.

These options were added in a 2019 release of LaTeX.

This environment can be used anywhere in the preamble, although it often appears before the \documentclass command. It is commonly used to create a .bib or other such data file from the main document source, to make the source file self-contained. Similarly, it can be used to create a custom style or class file, again making the source self-contained.

For example, this document:

\documentclass{article}
\begin{filecontents}{JH.sty}
\newcommand{\myname}{Jim Hef{}feron}
\end{filecontents}
\usepackage{JH}
\begin{document}
Article by \myname.
\end{document}


produces this file JH.sty:

%% LaTeX2e file JH.sty'
%% generated by the filecontents' environment
%% from source test' on 2015/10/12.
%%
\newcommand{\myname}{Jim Hef{}feron}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.12 flushleft

Synopsis:

\begin{flushleft}
line1 \\
line2 \\
...
\end{flushleft}


An environment that creates a paragraph whose lines are flush to the left-hand margin, and ragged right. If you have lines that are too long then LaTeX will linebreak them in a way that avoids hyphenation and stretching or shrinking interword spaces. To force a new line use a double backslash, \\. For the declaration form see \raggedright.

This creates a box of text that is at most 3 inches wide, with the text flush left and ragged right.

\noindent\begin{minipage}{3in}
\begin{flushleft}
A long sentence that will be broken by \LaTeX{}
at a convenient spot. \\
And, a fresh line forced by the double backslash.
\end{flushleft}
\end{minipage}


Up: flushleft   [Contents][Index]

#### 8.12.1 \raggedright

Synopses:

{\raggedright  ... }


or

\begin{environment} \raggedright
...
\end{environment}


A declaration which causes lines to be flush to the left margin and ragged right. It can be used inside an environment such as quote or in a parbox. For the environment form see flushleft.

Unlike the flushleft environment, the \raggedright command does not start a new paragraph; it only changes how LaTeX formats paragraph units. To affect a paragraph unit’s format, the scope of the declaration must contain the blank line or \end command that ends the paragraph unit.

Here \raggedright in each second column keeps LaTeX from doing very awkward typesetting to fit the text into the narrow column. Note that \raggedright is inside the curly braces {...} to delimit its effect.

\begin{tabular}{rp{2in}}
Team alpha  &{\raggedright This team does all the real work.} \\
Team beta   &{\raggedright This team ensures that the water
cooler is never empty.}                         \\
\end{tabular}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.13 flushright

\begin{flushright}
line1 \\
line2 \\
...
\end{flushright}


An environment that creates a paragraph whose lines are flush to the right-hand margin and ragged left. If you have lines that are too long to fit the margins then LaTeX will linebreak them in a way that avoids hyphenation and stretching or shrinking inter-word spaces. To force a new line use a double backslash, \\. For the declaration form see \raggedleft.

For an example related to this environment, see flushleft, where one just have mutatis mutandis to replace flushleft by flushright.

Up: flushright   [Contents][Index]

#### 8.13.1 \raggedleft

Synopses:

{\raggedleft  ... }


or

\begin{environment} \raggedleft
...
\end{environment}


A declaration which causes lines to be flush to the right margin and ragged left. It can be used inside an environment such as quote or in a parbox. For the environment form see flushright.

Unlike the flushright environment, the \raggedleft command does not start a new paragraph; it only changes how LaTeX formats paragraph units. To affect a paragraph unit’s format, the scope of the declaration must contain the blank line or \end command that ends the paragraph unit.

For an example related to this environment, see \raggedright, where one just have mutatis mutandis to replace \raggedright by \raggedleft.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.14 itemize

Synopsis:

\begin{itemize}
\item[optional label of first item] text of first item
\item[optional label of second item] text of second item
...
\end{itemize}


Produce an unordered list, sometimes called a bullet list. There must be at least one \item within the environment; having none causes the LaTeX error ‘Something's wrong--perhaps a missing \item’.

This gives a two-item list.

\begin{itemize}
\item Pencil and watercolor sketch by Cassandra
\item Rice portrait
\end{itemize}


With the default locale—without loading e.g. babel package with another language than USenglish—as a top-level list each label would come out as a bullet, •. The format of the labeling depends on the nesting level; see below.

Start list items with the \item command (see \item). If you give \item an optional argument by following it with square brackets, as in \item[Optional label], then by default Optional label will appear in bold and be flush right, so it could extend into the left margin. For labels that are flush left see the description environment. Following the \item is the text of the item, which may be empty or contain multiple paragraphs.

Unordered lists can be nested within one another, up to four levels deep. They can also be nested within other paragraph-making environments, such as enumerate (see enumerate).

The itemize environment uses the commands \labelitemi through \labelitemiv to produce the default label (note the convention of lowercase roman numerals at the end of the command names that signify the nesting level). These are the default marks at each level.

1. • (bullet, from \textbullet)
2. -- (bold en-dash, from \normalfont\bfseries\textendash)
3. * (asterisk, from \textasteriskcentered)
4. . (vertically centered dot, rendered here as a period, from \textperiodcentered)

Change the labels with \renewcommand. For instance, this makes the first level use diamonds.

\renewcommand{\labelitemi}{$\diamond$}


The distance between the left margin of the enclosing environment and the left margin of the itemize list is determined by the parameters \leftmargini through \leftmarginvi. (This also uses the convention of using lowercase roman numerals a the end of the command name to denote the nesting level.) The defaults are: 2.5em in level 1 (2em in two-column mode), 2.2em in level 2, 1.87em in level 3, and 1.7em in level 4, with smaller values for more deeply nested levels.

For other major LaTeX labeled list environments, see description and enumerate. The itemize, enumerate and description environment use the same list layout parameters. For a description, including the default values, and for information about customizing list layout, see list. The package enumitem is useful for customizing lists.

This example greatly reduces the margin space for outermost itemized lists.

\setlength{\leftmargini}{1.25em} % default 2.5em


Especially for lists with short items, it may be desirable to elide space between items. Here is an example defining an itemize* environment with no extra spacing between items, or between paragraphs within a single item (\parskip is not list-specific, see \parindent & \parskip):

\newenvironment{itemize*}%
{\begin{itemize}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}}%
\setlength{\parskip}{0pt}}%
{\end{itemize}}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.15 letter environment: writing letters

This environment is used for creating letters. See Letters.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.16 list

Synopsis:

\begin{list}{labeling}{spacing}
\item[optional label of first item] text of first item
\item[optional label of second item] text of second item
...
\end{list}


An environment for constructing lists.

Note that this environment does not typically appear in the document body. Most lists created by LaTeX authors are the ones that come standard: the description, enumerate, and itemize environments (see description, enumerate, and itemize).

Instead, the list environment is most often used in macros. For example, many standard LaTeX environments that do not immediately appear to be lists are in fact constructed using list, including quotation, quote, and center (see quotation & quote, see center).

This uses the list environment to define a new custom environment.

\newcounter{namedlistcounter}  % number the items
\newenvironment{named}
{\begin{list}
{Item~\Roman{namedlistcounter}.} % labeling
{\usecounter{namedlistcounter}   % set counter
\setlength{\leftmargin}{3.5em}} % set spacing
}
{\end{list}}

\begin{named}
\item Shows as Item~I.''
\item[Special label.] Shows as Special label.''
\item Shows as Item~II.''
\end{named}


The mandatory first argument labeling specifies the default labeling of list items. It can contain text and LaTeX commands, as above where it contains both ‘Item’ and ‘\Roman{…}’. LaTeX forms the label by putting the labeling argument in a box of width \labelwidth. If the label is wider than that, the additional material extends to the right. When making an instance of a list you can override the default labeling by giving \item an optional argument by including square braces and the text, as in the above \item[Special label.]; see \item.

The mandatory second argument spacing has a list of commands. This list can be empty. A command that can go in here is \usecounter{countername} (see \usecounter). Use this to tell LaTeX to number the items using the given counter. The counter will be reset to zero each time LaTeX enters the environment, and the counter is incremented by one each time LaTeX encounters an \item that does not have an optional argument.

Another command that can go in spacing is \makelabel, which constructs the label box. By default it puts the contents flush right. Its only argument is the label, which it typesets in LR mode (see Modes). One example of changing its definition is that to the above named example, before the definition of the environment add \newcommand{\namedmakelabel}[1]{\textsc{#1}}, and between the \setlength command and the parenthesis that closes the spacing argument also add \let\makelabel\namedmakelabel. Then the labels will be typeset in small caps. Similarly, changing the second code line to \let\makelabel\fbox puts the labels inside a framed box. Another example of the \makelabel command is below, in the definition of the redlabel environment.

Also often in spacing are commands to redefine the spacing for the list. Below are the spacing parameters with their default values. (Default values for derived environments such as itemize can be different than the values shown here.) See also the figure that follows the list. Each is a length (see Lengths). The vertical spaces are normally rubber lengths, with plus and minus components, to give TeX flexibility in setting the page. Change each with a command such as \setlength{itemsep}{2pt plus1pt minus1pt}. For some effects these lengths should be zero or negative.

\itemindent

Extra horizontal space indentation, beyond leftmargin, of the first line each item. Its default value is 0pt.

\itemsep

Vertical space between items, beyond the \parsep. The defaults for the first three levels in LaTeX’s ‘article’, ‘book’, and ‘report’ classes at 10 point size are: 4pt plus2pt minus1pt, \parsep (that is, 2pt plus1pt minus1pt), and \topsep (that is, 2pt plus1pt minus1pt). The defaults at 11 point are: 4.5pt plus2pt minus1pt, \parsep (that is, 2pt plus1pt minus1pt), and \topsep (that is, 2pt plus1pt minus1pt). The defaults at 12 point are: 5pt plus2.5pt minus1pt, \parsep (that is, 2.5pt plus1pt minus1pt), and \topsep (that is, 2.5pt plus1pt minus1pt).

\labelsep

Horizontal space between the label and text of an item. The default for LaTeX’s ‘article’, ‘book’, and ‘report’ classes is 0.5em.

\labelwidth

Horizontal width. The box containing the label is nominally this wide. If \makelabel returns text that is wider than this then the first line of the item will be indented to make room for this extra material. If \makelabel returns text of width less than or equal to \labelwidth then LaTeX’s default is that the label is typeset flush right in a box of this width.

The left edge of the label box is \leftmargin+\itemindent-\labelsep-\labelwidth from the left margin of the enclosing environment.

The default for LaTeX’s ‘article’, ‘book’, and ‘report’ classes at the top level is \leftmargini-\labelsep, (which is 2em in one column mode and 1.5em in two column mode). At the second level it is \leftmarginii-\labelsep, and at the third level it is \leftmarginiii-\labelsep. These definitions make the label’s left edge coincide with the left margin of the enclosing environment.

\leftmargin

Horizontal space between the left margin of the enclosing environment (or the left margin of the page if this is a top-level list), and the left margin of this list. It must be non-negative.

In the standard LaTeX document classes, a top-level list has this set to the value of \leftmargini, while a list that is nested inside a top-level list has this margin set to \leftmarginii. More deeply nested lists get the values of \leftmarginiii through \leftmarginvi. (Nesting greater than level five generates the error message ‘Too deeply nested’.)

The defaults for the first three levels in LaTeX’s ‘article’, ‘book’, and ‘report’ classes are: \leftmargini is 2.5em (in two column mode, 2em), \leftmarginii is 2.2em, and \leftmarginiii is 1.87em.

\listparindent

Horizontal space of additional line indentation, beyond \leftmargin, for second and subsequent paragraphs within a list item. A negative value makes this an “outdent”. Its default value is 0pt.

\parsep

Vertical space between paragraphs within an item. The defaults for the first three levels in LaTeX’s ‘article’, ‘book’, and ‘report’ classes at 10 point size are: 4pt plus2pt minus1pt, 2pt plus1pt minus1pt, and 0pt. The defaults at 11 point size are: 4.5pt plus2pt minus1pt, 2pt plus1pt minus1pt, and 0pt. The defaults at 12 point size are: 5pt plus2.5pt minus1pt, 2.5pt plus1pt minus1pt, and 0pt.

\partopsep

Vertical space added, beyond \topsep+\parskip, to the top and bottom of the entire environment if the list instance is preceded by a blank line. (A blank line in the LaTeX source before the list changes spacing at both the top and bottom of the list; whether the line following the list is blank does not matter.)

The defaults for the first three levels in LaTeX’s ‘article’, ‘book’, and ‘report’ classes at 10 point size are: 2pt plus1 minus1pt, 2pt plus1pt minus1pt, and 1pt plus0pt minus1pt. The defaults at 11 point are: 3pt plus1pt minus1pt, 3pt plus1pt minus1pt, and 1pt plus0pt minus1pt). The defaults at 12 point are: 3pt plus2pt minus3pt, 3pt plus2pt minus2pt, and 1pt plus0pt minus1pt.

\rightmargin

Horizontal space between the right margin of the list and the right margin of the enclosing environment. Its default value is 0pt. It must be non-negative.

\topsep

Vertical space added to both the top and bottom of the list, in addition to \parskip (see \parindent & \parskip). The defaults for the first three levels in LaTeX’s ‘article’, ‘book’, and ‘report’ classes at 10 point size are: 8pt plus2pt minus4pt, 4pt plus2pt minus1pt, and 2pt plus1pt minus1pt. The defaults at 11 point are: 9pt plus3pt minus5pt, 4.5pt plus2pt minus1pt, and 2pt plus1pt minus1pt. The defaults at 12 point are: 10pt plus4pt minus6pt, 5pt plus2.5pt minus1pt, and 2.5pt plus1pt minus1pt.

This shows the horizontal and vertical distances.

The lengths shown are listed below. The key relationship is that the right edge of the bracket for h1 equals the right edge of the bracket for h4, so that the left edge of the label box is at h3+h4-(h0+h1).

v0

\topsep + \parskip if the list environment does not start a new paragraph, and \topsep+\parskip+\partopsep if it does

v1

\parsep

v2

\itemsep+\parsep

v3

Same as v0. (This space is affected by whether a blank line appears in the source above the environment; whether a blank line appears in the source below the environment does not matter.)

h0

\labelwidth

h1

\labelsep

h2

\listparindent

h3

\leftmargin

h4

\itemindent

h5

\rightmargin

The list’s left and right margins, shown above as h3 and h5, are with respect to the ones provided by the surrounding environment, or with respect to the page margins for a top-level list. The line width used for typesetting the list items is \linewidth (see Page layout parameters). For instance, set the list’s left margin to be one quarter of the distance between the left and right margins of the enclosing environment with \setlength{\leftmargin}{0.25\linewidth}.

Page breaking in a list structure is controlled by the three parameters below. For each, the LaTeX default is -\@lowpenalty, that is, -51. Because it is negative, it somewhat encourages a page break at each spot. Change it with, e.g., \@beginparpenalty=9999; a value of 10000 prohibits a page break.

\@beginparpenalty

The page breaking penalty for breaking before the list (default -51).

\@itempenalty

The page breaking penalty for breaking before a list item (default -51).

\@endparpenalty

The page breaking penalty for breaking after a list (default -51).

The package enumitem is useful for customizing lists.

This example has the labels in red. They are numbered, and the left edge of the label lines up with the left edge of the item text. See \usecounter.

\usepackage{color}
\newcounter{cnt}
\newcommand{\makeredlabel}[1]{\textcolor{red}{#1.}}
\newenvironment{redlabel}
{\begin{list}
{\arabic{cnt}}
{\usecounter{cnt}
\setlength{\labelwidth}{0em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{1.5em}
\setlength{\itemindent}{0.5em} % equals \labelwidth+\labelsep
\let\makelabel=\makeredlabel
}
}
{\end{list}}


Next: , Up: list   [Contents][Index]

#### 8.16.1 \item: An entry in a list

Synopsis:

\item text of item


or

\item[optional-label] text of item


An entry in a list. The entries are prefixed by a label, whose default depends on the list type.

Because the optional label is surrounded by square brackets ‘[...]’, if you have an item whose text starts with [, you have to hide the bracket inside curly braces, as in: \item {[} is an open square bracket; otherwise, LaTeX will think it marks the start of an optional label.

Similarly, if the item does have the optional label and you need a close square bracket inside that label, you must hide it in the same way: \item[Close square bracket, {]}]. See LaTeX command syntax.

In this example the enumerate list has two items that use the default label and one that uses the optional label.

\begin{enumerate}
\item Moe
\item[sometimes] Shemp
\item Larry
\end{enumerate}


The first item is labelled ‘1.’, the second item is labelled ‘sometimes’, and the third item is labelled ‘2.’. Because of the optional label in the second item, the third item is not labelled ‘3.’.

Previous: , Up: list   [Contents][Index]

#### 8.16.2 trivlist: A restricted form of list

Synopsis:

\begin{trivlist}
...
\end{trivlist}


A restricted version of the list environment, in which margins are not indented and an \item without an optional argument produces no text. It is most often used in macros, to define an environment where the \item command is part of the environment’s definition. For instance, the center environment is defined essentially like this:

\newenvironment{center}
{\begin{trivlist}\centering\item\relax}
{\end{trivlist}}


Using trivlist in this way allows the macro to inherit some common code: combining vertical space of two adjacent environments; detecting whether the text following the environment should be considered a new paragraph or a continuation of the previous one; adjusting the left and right margins for possible nested list environments.

Specifically, trivlist uses the current values of the list parameters (see list), except that \parsep is set to the value of \parskip, and \leftmargin, \labelwidth, and \itemindent are set to zero.

This example outputs the items as two paragraphs, except that (by default) they have no paragraph indent and are vertically separated.

\begin{trivlist}
\item The \textit{Surprise} is not old; no one would call her old.
\item She has a bluff bow, lovely lines.
\end{trivlist}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.17 math

Synopsis:

\begin{math}
math
\end{math}


The math environment inserts given math material within the running text. $$...$$ and $...$ are synonyms. See Math formulas.

Next: , Previous: , Up: Environments   [Contents][Index]

### 8.18 minipage

Synopses:

\begin{minipage}{width}
contents
\end{minipage}


or

\begin{minipage}[position][height][inner-pos]{width}
contents
\end{minipage}


Put contents into a box that is width wide. This is like a small version of a page; it can contain its own footnotes, itemized lists, etc. (There are some restrictions, including that it cannot have floats.) This box will not be broken across pages. So minipage is similar to \parbox (see \parbox) but here you can have paragraphs.

This example will be 3 inches wide, and has two paragraphs.

\begin{minipage}{3in}
Stephen Kleene was a founder of the Theory of Computation.

He was a student of Church, wrote three influential texts,
was President of the Association for Symbolic Logic,
and won the National Medal of Science.
\end{minipage}


See below for a discussion of the paragraph indent inside a minipage.

The required argument width is a rigid length (see Lengths). It gives the width of the box into which contents are typeset.

There are three optional arguments, position, height, and inner-pos. You need not include all three. For example, get the default position and set the height with \begin{minipage}[c][2.54cm]{\columnwidth} contents \end{minipage}. (Get the natural height with an empty argument, [].)

The optional argument position governs how the minipage vertically aligns with the surrounding material.

c

(synonym m) Default. Positions the minipage so its vertical center lines up with the center of the adjacent text line.

t

Match the top line in the minipage with the baseline of the surrounding text (plain TeX’s \vtop).

b

Match the bottom line in the minipage with the baseline of the surrounding text (plain TeX’s \vbox).

To see the effects of these, contrast running this

---\begin{minipage}[c]{0.25in}
first\\ second\\ third
\end{minipage}


with the results of changing c to b or t.

The optional argument height is a rigid length (see Lengths). It sets the height of the minipage. You can enter any value larger than, or equal to, or smaller than the minipage’s natural height and LaTeX will not give an error or warning. You can also set it to a height of zero or a negative value.

The final optional argument inner-pos controls the placement of contents inside the box. These are the possible values are (the default is the value of position).

t

Place contents at the top of the box.

c

Place it in the vertical center.

b

Place it at the box bottom.

s

Stretch contents out vertically; it must contain vertically stretchable space.

The inner-pos argument makes sense when the height option is set to a value larger than the minipage’s natural height. To see the effect of the options, run this example with the various choices in place of b.

Text before
\begin{center}
---\begin{minipage}[c][3in][b]{0.25\textwidth}
first\\ second\\ third
\end{minipage}
\end{center}
Text after


By default paragraphs are not indented in a minipage. Change that with a command such as \setlength{\parindent}{1pc} at the start of contents.

Footnotes in a minipage environment are handled in a way that is particularly useful for putting footnotes in figures or tables. A \footnote or \footnotetext command puts the footnote at the bottom of the minipage instead of at the bottom of the page, and it uses the \mpfootnote counter instead of the ordinary footnote counter (see Counters).

This puts the footnote at the bottom of the table, not the bottom of the page.

\begin{center}           % center the minipage on the line
\begin{minipage}{2.5in}
\begin{center}         % center the table inside the minipage
\begin{tabular}{ll}
\textsc{Monarch}  &\textsc{Reign}             \\ \hline
Elizabeth II      &63 years\footnote{to date} \\
Victoria          &63 years                   \\
George III        &59 years
\end{tabular}
\end{center}
\end{minipage}
\end{center}


If you nest minipages then there is an oddness when using footnotes. Footnotes appear at the bottom of the text ended by the next \end{minipage} which may not be their logical place.

This puts a table containing data side by side with a map graphic. They are vertically centered.

% siunitx to have the S column specifier,
% which aligns numbers on their decimal point.
\usepackage{siunitx}
\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
...
\begin{center}
\vcenteredhbox{\includegraphics[width=0.3\textwidth]{nyc.png}}
\hspace{0.1\textwidth}
\begin{minipage}{0.5\textwidth}
\begin{tabular}{r|S}
% \multicolumn to remove vertical bar between column headers
\multicolumn{1}{r}{Borough} &
% braces to prevent siunitx from misinterpreting the
% period as a decimal separator
{Pop. (million)}  \\ \hline
The Bronx      &1.5  \\
Brooklyn       &2.6  \\
Manhattan      &1.6  \\
Queens         &2.3  \\
Staten Island  &0.5
\end{tabular}
\end{minipage}
\end{center}


Next: , Previous: , Up: Environments   [Contents][Index]

### 8.19 picture

Synopses:

\begin{picture}(width,height)
picture command
\end{picture}


or

\begin{picture}(width,height)(xoffset,yoffset)
picture command
\end{picture}


Where there may be any number of picture command’s.

An environment to create simple pictures containing lines, arrows, boxes, circles, and text. This environment is not obsolete, but new documents typically use much more powerful graphics creation systems, such as TikZ, PSTricks, MetaPost, or Asymptote. None of these are covered in this document; see CTAN.

To start, here’s an example showing the parallelogram law for adding vectors.

\setlength{\unitlength}{1cm}
\begin{picture}(6,6)      % picture box will be 6cm wide by 6cm tall
\put(0,0){\vector(2,1){4}}  % for every 2 over this vector goes 1 up
\put(2,1){\makebox(0,0)[l]{\ first leg}}
\put(4,2){\vector(1,2){2}}
\put(5,4){\makebox(0,0)[l]{\ second leg}}
\put(0,0){\vector(1,1){6}}
\put(3,3){\makebox(0,0)[r]{sum\ }}
\end{picture}


The picture environment has one required argument, a pair of positive real numbers (width,height). Multiply these by the value \unitlength to get the nominal size of the output, i.e. the space that LaTeX reserves on the output page. This nominal size need not be how large the picture really is; LaTeX will draw things from the picture outside the picture’s box.

This environment also has an optional argument (xoffset,yoffset). It is used to shift the origin. Unlike most optional arguments, this one is not contained in square brackets. As with the required argument, it consists of a pair of two real numbers, but these may also be negative or null. Multiply these by \unitlength to get the coordinates of the point at the lower-left corner of the picture.

For example, if \unitlength has been set to 1mm, the command

\begin{picture}(100,200)(10,20)


produces a box of width 100 millimeters and height 200 millimeters. The picture’s origin is the point (10mm,20mm) and so the lower-left corner is there, and the upper-right corner is at (110mm,220mm). When you first draw a picture you typically omit the optional argument, leaving the origin at the lower-left corner. If you then want to modify your picture by shifting everything, you can just add the appropriate optional argument.

Each picture command tells LaTeX where to put something by providing its position. A position is a pair such as (2.4,-5) giving the x- and y-coordinates. A coordinate is a not a length, it is a real number (it may have a decimal point or a minus sign). It specifies a length in multiples of the unit length \unitlength, so if \unitlength has been set to 1cm, then the coordinate 2.54 specifies a length of 2.54 centimeters.

LaTeX’s default for \unitlength is 1pt. It is a rigid length (see Lengths). Change it with the \setlength command (see \setlength). Make this change only outside of a picture environment.

The picture environment supports using standard arithmetic expressions as well as numbers.

Coordinates are given with respect to an origin, which is by default at the lower-left corner of the picture. Note that when a position appears as an argument, as with \put(1,2){...}, it is not enclosed in braces since the parentheses serve to delimit the argument. Also, unlike in some computer graphics systems, larger y-coordinates are further up the page, for example, y = 1 is above y = 0.

There are four ways to put things in a picture: \put, \multiput, \qbezier, and \graphpaper. The most often used is \put. This

\put(11.3,-0.3){...}


places the object with its reference point at coordinates (11.3,-0.3). The reference points for various objects will be described below. The \put command creates an LR box (see Modes). Anything that can go in an \mbox (see \mbox & \makebox) can go in the text argument of the \put command. The reference point will be the lower left corner of the box. In this picture

\setlength{\unitlength}{1cm}
...\begin{picture}(1,1)
\put(0,0){\line(1,0){1}}
\put(0,0){\line(1,1){1}}
\end{picture}


the three dots are just slightly left of the point of the angle formed by the two lines. (Also, \line(1,1){1} does not call for a line of length one; rather the line has a change in the x coordinate of 1.)

The \multiput, qbezier, and graphpaper commands are described below.

You can also use this environment to place arbitrary material at an exact location. For example:

\usepackage{color,graphicx}  % in preamble
...
\begin{center}
\setlength{\unitlength}{\textwidth}
\begin{picture}(1,1)      % leave space, \textwidth wide and tall
\put(0,0){\includegraphics[width=\textwidth]{desertedisland.jpg}}
\put(0.25,0.35){\textcolor{red}{X Treasure here}}
\end{picture}
\end{center}


The red X will be precisely a quarter of the \textwidth from the left margin, and 0.35\textwidth up from the bottom of the picture. Another example of this usage is to put similar code in the page header to get repeat material on each of a document’s pages.

Next: , Up: picture   [Contents][Index]

#### 8.19.1 \put

Synopsis:

\put(xcoord,ycoord){content}


Place content at the coordinate (xcoord,ycoord). See the discussion of coordinates and \unitlength in picture. The content is processed in LR mode (see Modes) so it cannot contain line breaks.

This includes the text into the picture.

\put(4.5,2.5){Apply the \textit{unpoke} move}


The reference point, the location (4.5,2.5), is the lower left of the text, at the bottom left of the ‘A’.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.2 \multiput

Synopsis:

\multiput(x,y)(delta_x,delta_y){num-copies}{obj}


Copy obj a total of num-copies times, with an increment of delta_x,delta_y. The obj first appears at position (x,y), then at (x+\delta_x,y+\delta_y), and so on.

This draws a simple grid with every fifth line in bold (see also \graphpaper).

\begin{picture}(10,10)
\linethickness{0.05mm}
\multiput(0,0)(1,0){10}{\line(0,1){10}}
\multiput(0,0)(0,1){10}{\line(1,0){10}}
\linethickness{0.5mm}
\multiput(0,0)(5,0){3}{\line(0,1){10}}
\multiput(0,0)(0,5){3}{\line(1,0){10}}
\end{picture}


Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.3 \qbezier

Synopsis:

\qbezier(x1,y1)(x2,y2)(x3,y3)
\qbezier[num](x1,y1)(x2,y2)(x3,y3)


Draw a quadratic Bezier curve whose control points are given by the three required arguments (x1,y1), (x2,y2), and (x3,y3). That is, the curve runs from (x1,y1) to (x3,y3), is quadratic, and is such that the tangent line at (x1,y1) passes through (x2,y2), as does the tangent line at (x3,y3).

This draws a curve from the coordinate (1,1) to (1,0).

\qbezier(1,1)(1.25,0.75)(1,0)


The curve’s tangent line at (1,1) contains (1.25,0.75), as does the curve’s tangent line at (1,0).

The optional argument num gives the number of calculated intermediate points. The default is to draw a smooth curve whose maximum number of points is \qbeziermax (change this value with \renewcommand).

This draws a rectangle with a wavy top, using \qbezier for that curve.

\begin{picture}(8,4)
\put(0,0){\vector(1,0){8}}  % x axis
\put(0,0){\vector(0,1){4}}  % y axis
\put(2,0){\line(0,1){3}}       % left side
\put(4,0){\line(0,1){3.5}}     % right side
\qbezier(2,3)(2.5,2.9)(3,3.25)
\qbezier(3,3.25)(3.5,3.6)(4,3.5)
\thicklines                 % below here, lines are twice as thick
\put(2,3){\line(4,1){2}}
\put(4.5,2.5){\framebox{Trapezoidal Rule}}
\end{picture}


Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.4 \graphpaper

Synopsis:

\graphpaper(x_init,y_init)(x_dimen,y_dimen)
\graphpaper[spacing](x_init,y_init)(x_dimen,y_dimen)


Draw a coordinate grid. Requires the graphpap package. The grid’s origin is (x_init,y_init). Grid lines come every spacing units (the default is 10). The grid extends x_dimen units to the right and y_dimen units up. All arguments must be positive integers.

This make a grid with seven vertical lines and eleven horizontal lines.

\usepackage{graphpap}    % in preamble
...
\begin{picture}(6,20)    % in document body
\graphpaper[2](0,0)(12,20)
\end{picture}


The lines are numbered every ten units.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.5 \line

Synopsis:

\line(x_run,y_rise){travel}


Draw a line. It slopes such that it vertically rises y_rise for every horizontal x_run. The travel is the total horizontal change—it is not the length of the vector, it is the change in x. In the special case of vertical lines, where (x_run,y_rise)=(0,1), the travel gives the change in y.

This draws a line starting at coordinates (1,3).

\put(1,3){\line(2,5){4}}


For every over 2, this line will go up 5. Because travel specifies that this goes over 4, it must go up 10. Thus its endpoint is (1,3)+(4,10)=(5,13). In particular, note that travel=4 is not the length of the line, it is the change in x.

The arguments x_run and y_rise are integers that can be positive, negative, or zero. (If both are 0 then LaTeX treats the second as 1.) With \put(x_init,y_init){\line(x_run,y_rise){travel}}, if x_run is negative then the line’s ending point has a first coordinate that is less than x_init. If y_rise is negative then the line’s ending point has a second coordinate that is less than y_init.

If travel is negative then you get LaTeX Error: Bad \line or \vector argument.

Standard LaTeX can only draw lines with a limited range of slopes because these lines are made by putting together line segments from pre-made fonts. The two numbers x_run and y_rise must have integer values from -6 through 6. Also, they must be relatively prime, so that (x_run,y_rise) can be (2,1) but not (4,2) (if you choose the latter then instead of lines you get sequences of arrowheads; the solution is to switch to the former). To get lines of arbitrary slope and plenty of other shapes in a system like picture, see the package pict2e (https://ctan.org/pkg/pict2e). Another solution is to use a full-featured graphics system such as TikZ, PSTricks, MetaPost, or Asymptote.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.6 \linethickness

Synopsis:

\linethickness{dim}


Declares the thickness of subsequent horizontal and vertical lines in a picture to be dim, which must be a positive length (see Lengths). It differs from \thinlines and \thicklines in that it does not affect the thickness of slanted lines, circles, or ovals.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.7 \thinlines

Declaration to set the thickness of subsequent lines, circles, and ovals in a picture environment to be 0.4pt. This is the default thickness, so this command is unnecessary unless the thickness has been changed with either \linethickness or \thicklines.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.8 \thicklines

Declaration to set the thickness of subsequent lines, circles, and ovals in a picture environment to be 0.8pt. See also \linethickness and \thinlines. This command is illustrated in the Trapezoidal Rule example of picture.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.9 \circle

Synopsis:

\circle{diameter}
\circle*{diameter}


Produces a circle with a diameter as close as possible to the specified one. The * form produces a filled-in circle.

This draws a circle of radius 6, centered at (5,7).

\put(5,7){\circle{6}}


The available radii for \circle are, in points, the even numbers from 2 to 20, inclusive. For \circle* they are all the integers from 1 to 15.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.10 \oval

Synopsis:

\oval(width,height)
\oval(width,height)[portion]


Produce a rectangle with rounded corners. The optional argument portion allows you to produce only half or a quarter of the oval. For half an oval take portion to be one of these.

t

top half

b

bottom half

r

right half

l

left half

Produce only one quarter of the oval by setting portion to tr, br, bl, or tl.

This draws the top half of an oval that is 3 wide and 7 tall.

\put(5,7){\oval(3,7)[t]}


The (5,7) is the center of the entire oval, not just the center of the top half.

These shapes are not ellipses. They are rectangles whose corners are made with quarter circles. These circles have a maximum radius of 20pt (see \circle for the sizes). Thus large ovals are just boxes with a small amount of corner rounding.

Next: , Previous: , Up: picture   [Contents][Index]

#### 8.19.11 \shortstack

Synopsis:

\shortstack[position]{line 1 \\ ... }


Produce a vertical stack of objects.

This labels the y axis.

\put(0,0){\vector(1,0){4}}   % x axis
\put(0,0){\vector(0,1){2}}   % y
\put(-0.25,2){\makebox[0][r]{\shortstack[r]{$y$\\ axis}}}


For a short stack, the reference point is the lower left of the stack. In the above example the \mbox & \makebox puts the stack flush right in a zero width box so in total the short stack sits slightly to the left of the y axis.

The valid positions are:

r

Make objects flush right

l

Make objects flush left

c

Center objects (default)


The two mathematics modes are similar, but there are some differences. One involves the placement of subscripts and superscripts; in display math mode they are further apart and in inline math mode they are closer together.

Sometimes you want the display math typographical treatment to happen in the inline math mode. For this, the \displaystyle declaration forces the size and style of the formula to be that of displaymath. Thus $$\displaystyle \sum_{n=0}^\infty x_n$$ will have the limits above and below the summation sign, not next to it. Another example is that

\begin{tabular}{r|cc}
\textsc{Name}  &\textsc{Series}  &\textsc{Sum}  \\  \hline
Arithmetic     &$$a+(a+b)+(a+2b)+\cdots+(a+(n-1)b)$$
&$$na+(n-1)n\cdot\frac{b}{2}$$  \\
Geometric      &$$a+ab+ab^2+\cdots+ab^{n-1}$$
&$$\displaystyle a\cdot\frac{1-b^n}{1-b}$$  \\
\end{tabular}


because it has no \displaystyle, the ‘Arithmetic’ line’s fraction will be scrunched. But, because of its \displaystyle, the ‘Geometric’ line’s fraction will be easy to read, with characters the same size as in the rest of the line.

The American Mathematical Society has made freely available a set of packages that greatly expand your options for writing mathematics, amsmath and amssymb (also be aware of the mathtools package that is an extension to, and loads, amsmath). New documents that will have mathematical text should use these packages. Descriptions of these packages is outside the scope of this document; see their documentation on CTAN.

Next: , Up: Math formulas   [Contents][Index]

### 16.1 Subscripts & superscripts

Synopsis (in math mode or display math mode), one of:

base^exp
base^{exp}


or, one of:

base_exp
base_{exp}


Make exp appear as a superscript of base (with the caret character, ^) or a subscript (with underscore, _).

In this example the 0’s and 1’s are subscripts while the 2’s are superscripts.

$$(x_0+x_1)^2 \leq (x_0)^2+(x_1)^2$$


To have the subscript or superscript contain more than one character, surround the expression with curly braces, as in e^{-2x}. This example’s fourth line shows curly braces used to group an expression for the exponent.

\begin{displaymath}
(3^3)^3=27^3=19\,683
3^{(3^3)}=3^{27}=7\,625\,597\,484\,987
\end{displaymath}


LaTeX knows how to handle a superscript on a superscript, or a subscript on a subscript, or supers on subs, or subs on supers. So, expressions such as e^{x^2} and x_{i_0} give correct output. Note the use in those expressions of curly braces to give the base a determined exp. If you enter $$3^3^3$$ then you get ‘Double superscript’.

LaTeX does the right thing when something has both a subscript and a superscript. In this example the integral has both. They come out in the correct place without any author intervention.

\begin{displaymath}
\int_{x=a}^b f'(x)\,dx = f(b)-f(a)
\end{displaymath}


Note the parentheses around x=a to make the entire expression a subscript.

To put a superscript or subscript before a symbol, use a construct like {}_t K^2. The empty curly braces {} give the subscript something to attach to and keeps it from accidentally attaching to a prior symbols.

Using the subscript or superscript character outside of math mode or display math mode, as in the expression x^2, will get you the error ‘Missing $inserted’. A common reason to want subscripts outside of a mathematics mode is to typeset chemical formulas. There are packages for that, such as mhchem; see CTAN. Next: , Previous: , Up: Math formulas [Contents][Index] ### 16.2 Math symbols LaTeX provides almost any mathematical or technical symbol that anyone uses. For example, if you include $\pi$ in your source, you will get the pi symbol π. See the “Comprehensive LaTeX Symbol List” package at https://ctan.org/pkg/comprehensive. Here is a list of commonly-used symbols. It is by no means exhaustive. Each symbol is described with a short phrase, and its symbol class, which determines the spacing around it, is given in parenthesis. Unless said otherwise, the commands for these symbols can be used only in math mode. To redefine a command so that it can be used whatever the current mode, see \ensuremath. \| ∥ Parallel (relation). Synonym: \parallel. \aleph ℵ Aleph, transfinite cardinal (ordinary). \alpha α Lowercase Greek letter alpha (ordinary). \amalg ⨿ Disjoint union (binary) \angle ∠ Geometric angle (ordinary). Similar: less-than sign < and angle bracket \langle. \approx ≈ Almost equal to (relation). \ast ∗ Asterisk operator, convolution, six-pointed (binary). Synonym: *, which is often a superscript or subscript, as in the Kleene star. Similar: \star, which is five-pointed, and is sometimes used as a general binary operation, and sometimes reserved for cross-correlation. \asymp ≍ Asymptotically equivalent (relation). \backslash \ Backslash (ordinary). Similar: set minus \setminus, and \textbackslash for backslash outside of math mode. \beta β Lowercase Greek letter beta (ordinary). \bigcap ⋂ Variable-sized, or n-ary, intersection (operator). Similar: binary intersection \cap. \bigcirc ⚪ Circle, larger (binary). Similar: function composition \circ. \bigcup ⋃ Variable-sized, or n-ary, union (operator). Similar: binary union \cup. \bigodot ⨀ Variable-sized, or n-ary, circled dot operator (operator). \bigoplus ⨁ Variable-sized, or n-ary, circled plus operator (operator). \bigotimes ⨂ Variable-sized, or n-ary, circled times operator (operator). \bigtriangledown ▽ Variable-sized, or n-ary, open triangle pointing down (operator). \bigtriangleup △ Variable-sized, or n-ary, open triangle pointing up (operator). \bigsqcup ⨆ Variable-sized, or n-ary, square union (operator). \biguplus ⨄ Variable-sized, or n-ary, union operator with a plus (operator). (Note that the name has only one p.) \bigvee ⋁ Variable-sized, or n-ary, logical-or (operator). \bigwedge ⋀ Variable-sized, or n-ary, logical-and (operator). \bot ⊥, Up tack, bottom, least element of a partially ordered set, or a contradiction (ordinary). See also \top. \bowtie ⋈ Natural join of two relations (relation). \Box □ Modal operator for necessity; square open box (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package. \bullet • Bullet (binary). Similar: multiplication dot \cdot. \cap ∩ Intersection of two sets (binary). Similar: variable-sized operator \bigcap. \cdot ⋅ Multiplication (binary). Similar: Bullet dot \bullet. \chi χ Lowercase Greek chi (ordinary). \circ ∘ Function composition, ring operator (binary). Similar: variable-sized operator \bigcirc. \clubsuit ♣ Club card suit (ordinary). \complement ∁, Set complement, used as a superscript as in $S^\complement$ (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package. Also used: $S^{\mathsf{c}}$ or $\bar{S}$. \cong ≅ Congruent (relation). \coprod ∐ Coproduct (operator). \cup ∪ Union of two sets (binary). Similar: variable-sized operator \bigcup. \dagger † Dagger relation (binary). \dashv ⊣ Dash with vertical, reversed turnstile (relation). Similar: turnstile \vdash. \ddagger ‡ Double dagger relation (binary). \Delta Δ Greek uppercase delta, used for increment (ordinary). \delta δ Greek lowercase delta (ordinary). \Diamond ◇ Large diamond operator (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package. \diamond ⋄ Diamond operator (binary). Similar: large diamond \Diamond, circle bullet \bullet. \diamondsuit ♢ Diamond card suit (ordinary). \div ÷ Division sign (binary). \doteq ≐ Approaches the limit (relation). Similar: geometrically equal to \Doteq. \downarrow ↓ Down arrow, converges (relation). Similar: \Downarrow double line down arrow. \Downarrow ⇓ Double line down arrow (relation). Similar: \downarrow single line down arrow. \ell ℓ Lowercase cursive letter l (ordinary). \emptyset ∅ Empty set symbol (ordinary). The variant form is \varnothing. \epsilon ϵ Lowercase lunate epsilon (ordinary). Similar to Greek text letter. More widely used in mathematics is the script small letter epsilon \varepsilon ε. Related: the set membership relation \in ∈. \equiv ≡ Equivalence (relation). \eta η Lowercase Greek letter (ordinary). \exists ∃ Existential quantifier (ordinary). \flat ♭ Musical flat (ordinary). \forall ∀ Universal quantifier (ordinary). \frown ⌢ Downward curving arc (ordinary). \Gamma Γ uppercase Greek letter (ordinary). \gamma γ Lowercase Greek letter (ordinary). \ge ≥ Greater than or equal to (relation). This is a synonym for \geq. \geq ≥ Greater than or equal to (relation). This is a synonym for \ge. \gets ← Is assigned the value (relation). Synonym: \leftarrow. \gg ≫ Much greater than (relation). Similar: much less than \ll. \hbar ℏ Planck constant over two pi (ordinary). \heartsuit ♡ Heart card suit (ordinary). \hookleftarrow ↩ Hooked left arrow (relation). \hookrightarrow ↪ Hooked right arrow (relation). \iff ⟷ If and only if (relation). It is \Longleftrightarrow with a \thickmuskip on either side. \Im ℑ Imaginary part (ordinary). See: real part \Re. \imath Dotless i; used when you are putting an accent on an i (see Math accents). \in ∈ Set element (relation). See also: lowercase lunate epsilon \epsilonϵ and small letter script epsilon \varepsilon. \infty ∞ Infinity (ordinary). \int ∫ Integral (operator). \iota ι Lowercase Greek letter (ordinary). \Join ⨝ Condensed bowtie symbol (relation). Not available in Plain TeX. \jmath Dotless j; used when you are putting an accent on a j (see Math accents). \kappa κ Lowercase Greek letter (ordinary). \Lambda Λ uppercase Greek letter (ordinary). \lambda λ Lowercase Greek letter (ordinary). \land ∧ Logical and (binary). Synonym: \wedge. See also logical or \lor. \langle ⟨ Left angle, or sequence, bracket (opening). Similar: less-than <. Matches \rangle. \lbrace { Left curly brace (opening). Synonym: \{. Matches \rbrace. \lbrack [ Left square bracket (opening). Synonym: [. Matches \rbrack. \lceil ⌈ Left ceiling bracket, like a square bracket but with the bottom shaved off (opening). Matches \rceil. \le ≤ Less than or equal to (relation). This is a synonym for \leq. \leadsto ⇝ Squiggly right arrow (relation). To get this symbol outside of math mode you can put \newcommand*{\Leadsto}{\ensuremath{\leadsto}} in the preamble and then use \Leadsto instead. \Leftarrow ⇐ Is implied by, double-line left arrow (relation). Similar: single-line left arrow \leftarrow. \leftarrow ← Single-line left arrow (relation). Synonym: \gets. Similar: double-line left arrow \Leftarrow. \leftharpoondown ↽ Single-line left harpoon, barb under bar (relation). \leftharpoonup ↼ Single-line left harpoon, barb over bar (relation). \Leftrightarrow ⇔ Bi-implication; double-line double-headed arrow (relation). Similar: single-line double headed arrow \leftrightarrow. \leftrightarrow ↔ Single-line double-headed arrow (relation). Similar: double-line double headed arrow \Leftrightarrow. \leq ≤ Less than or equal to (relation). This is a synonym for \le. \lfloor ⌊ Left floor bracket (opening). Matches: \floor. \lhd ◁ Arrowhead, that is, triangle, pointing left (binary). For the normal subgroup symbol you should load amssymb and use \vartriangleleft (which is a relation and so gives better spacing). \ll ≪ Much less than (relation). Similar: much greater than \gg. \lnot ¬ Logical negation (ordinary). Synonym: \neg. \longleftarrow ⟵ Long single-line left arrow (relation). Similar: long double-line left arrow \Longleftarrow. \longleftrightarrow ⟷ Long single-line double-headed arrow (relation). Similar: long double-line double-headed arrow \Longleftrightarrow. \longmapsto ⟼ Long single-line left arrow starting with vertical bar (relation). Similar: shorter version \mapsto. \longrightarrow ⟶ Long single-line right arrow (relation). Similar: long double-line right arrow \Longrightarrow. \lor ∨ Logical or (binary). Synonym: \vee. See also logical and \land. \mapsto ↦ Single-line left arrow starting with vertical bar (relation). Similar: longer version \longmapsto. \mho ℧ Conductance, half-circle rotated capital omega (ordinary). \mid ∣ Single-line vertical bar (relation). A typical use of \mid is for a set \{\, x \mid x\geq 5 \,\}. Similar: \vert and | produce the same single-line vertical bar symbol but without any spacing (they fall in class ordinary) and you should not use them as relations but instead only as ordinals, i.e., footnote symbols. For absolute value, see the entry for \vert and for norm see the entry for \Vert. \models ⊨ Entails, or satisfies; double turnstile, short double dash (relation). Similar: long double dash \vDash. \mp ∓ Minus or plus (relation). \mu μ Lowercase Greek letter (ordinary). \nabla ∇ Hamilton’s del, or differential, operator (ordinary). \natural ♮ Musical natural notation (ordinary). \ne ≠ Not equal (relation). Synonym: \neq. \nearrow ↗ North-east arrow (relation). \neg ¬ Logical negation (ordinary). Synonym: \lnot. Sometimes instead used for negation: \sim. \neq ≠ Not equal (relation). Synonym: \ne. \ni ∋ Reflected membership epsilon; has the member (relation). Synonym: \owns. Similar: is a member of \in. \not Long solidus, or slash, used to overstrike a following operator (relation). Many negated operators are available that don’t require \not, particularly with the amssymb package. For example, \notin is typographically preferable to \not\in. \notin ∉ Not an element of (relation). Similar: not subset of \nsubseteq. \nu ν Lowercase Greek letter (ordinary). \nwarrow ↖ North-west arrow (relation). \odot ⊙ Dot inside a circle (binary). Similar: variable-sized operator \bigodot. \oint ∮ Contour integral, integral with circle in the middle (operator). \Omega Ω uppercase Greek letter (ordinary). \omega ω Lowercase Greek letter (ordinary). \ominus ⊖ Minus sign, or dash, inside a circle (binary). \oplus ⊕ Plus sign inside a circle (binary). Similar: variable-sized operator \bigoplus. \oslash ⊘ Solidus, or slash, inside a circle (binary). \otimes ⊗ Times sign, or cross, inside a circle (binary). Similar: variable-sized operator \bigotimes. \owns ∋ Reflected membership epsilon; has the member (relation). Synonym: \ni. Similar: is a member of \in. \parallel ∥ Parallel (relation). Synonym: \|. \partial ∂ Partial differential (ordinary). \perp ⟂ Perpendicular (relation). Similar: \bot uses the same glyph but the spacing is different because it is in the class ordinary. \Phi Φ Uppercase Greek letter (ordinary). \phi ϕ Lowercase Greek letter (ordinary). The variant form is \varphi φ. \Pi Π uppercase Greek letter (ordinary). \pi π Lowercase Greek letter (ordinary). The variant form is \varpi ϖ. \pm ± Plus or minus (binary). \prec ≺ Precedes (relation). Similar: less than <. \preceq ⪯ Precedes or equals (relation). Similar: less than or equals \leq. \prime ′ Prime, or minute in a time expression (ordinary). Typically used as a superscript: $f^\prime$; $f^\prime$ and $f'$ produce the same result. An advantage of the second is that $f'''$ produces the desired symbol, that is, the same result as $f^{\prime\prime\prime}$, but uses rather less typing. You can only use \prime in math mode. Using the right single quote ' in text mode produces a different character (apostrophe). \prod ∏ Product (operator). \propto ∝ Is proportional to (relation) \Psi Ψ uppercase Greek letter (ordinary). \psi ψ Lowercase Greek letter (ordinary). \rangle ⟩ Right angle, or sequence, bracket (closing). Similar: greater than >. Matches:\langle. \rbrace } Right curly brace (closing). Synonym: \}. Matches \lbrace. \rbrack ] Right square bracket (closing). Synonym: ]. Matches \lbrack. \rceil ⌉ Right ceiling bracket (closing). Matches \lceil. \Re ℜ Real part, real numbers, cursive capital R (ordinary). Related: double-line, or blackboard bold, R \mathbb{R}; to access this, load the amsfonts package. \restriction ↾, Restriction of a function (relation). Synonym: \upharpoonright. Not available in plain TeX. In LaTeX you need to load the amssymb package. \revemptyset ⦰, Reversed empty set symbol (ordinary). Related: \varnothing. Not available in plain TeX. In LaTeX you need to load the stix package. \rfloor ⌋ Right floor bracket, a right square bracket with the top cut off (closing). Matches \lfloor. \rhd ◁ Arrowhead, that is, triangle, pointing right (binary). For the normal subgroup symbol you should instead load amssymb and use \vartriangleright (which is a relation and so gives better spacing). \rho ρ Lowercase Greek letter (ordinary). The variant form is \varrho ϱ. \Rightarrow ⇒ Implies, right-pointing double line arrow (relation). Similar: right single-line arrow \rightarrow. \rightarrow → Right-pointing single line arrow (relation). Synonym: \to. Similar: right double line arrow \Rightarrow. \rightharpoondown ⇁ Right-pointing harpoon with barb below the line (relation). \rightharpoonup ⇀ Right-pointing harpoon with barb above the line (relation). \rightleftharpoons ⇌ Right harpoon up above left harpoon down (relation). \searrow ↘ Arrow pointing southeast (relation). \setminus ⧵ Set difference, reverse solidus or reverse slash, like \ (binary). Similar: backslash \backslash and also \textbackslash outside of math mode. \sharp ♯ Musical sharp (ordinary). \Sigma Σ uppercase Greek letter (ordinary). \sigma σ Lowercase Greek letter (ordinary). The variant form is \varsigma ς. \sim ∼ Similar, in a relation (relation). \simeq ≃ Similar or equal to, in a relation (relation). \smallint ∫ Integral sign that does not change to a larger size in a display (operator). \smile ⌣ Upward curving arc, smile (ordinary). \spadesuit ♠ Spade card suit (ordinary). \sqcap ⊓ Square intersection symbol (binary). Similar: intersection cap. \sqcup ⊔ Square union symbol (binary). Similar: union cup. Related: variable-sized operator \bigsqcup. \sqsubset ⊏, Square subset symbol (relation). Similar: subset \subset. Not available in plain TeX. In LaTeX you need to load the amssymb package. \sqsubseteq ⊑ Square subset or equal symbol (binary). Similar: subset or equal to \subseteq. \sqsupset ⊐, Square superset symbol (relation). Similar: superset \supset. Not available in plain TeX. In LaTeX you need to load the amssymb package. \sqsupseteq ⊒ Square superset or equal symbol (binary). Similar: superset or equal \supseteq. \star ⋆ Five-pointed star, sometimes used as a general binary operation but sometimes reserved for cross-correlation (binary). Similar: the synonyms asterisk * and \ast, which are six-pointed, and more often appear as a superscript or subscript, as with the Kleene star. \subset ⊂ Subset (occasionally, is implied by) (relation). \subseteq ⊆ Subset or equal to (relation). \succ ≻ Comes after, succeeds (relation). Similar: is less than >. \succeq ⪰ Succeeds or is equal to (relation). Similar: less than or equal to \leq. \sum ∑ Summation (operator). Similar: Greek capital sigma \Sigma. \supset ⊃ Superset (relation). \supseteq ⊇ Superset or equal to (relation). \surd √ Radical symbol (ordinary). The LaTeX command \sqrt{...} typesets the square root of the argument, with a bar that extends to cover the argument. \swarrow ↙ Southwest-pointing arrow (relation). \tau τ Lowercase Greek letter (ordinary). \theta θ Lowercase Greek letter (ordinary). The variant form is \vartheta ϑ. \times × Primary school multiplication sign (binary). See also \cdot. \to → Right-pointing single line arrow (relation). Synonym: \rightarrow. \top ⊤ Top, greatest element of a partially ordered set (ordinary). See also \bot. \triangle △ Triangle (ordinary). \triangleleft ◁ Not-filled triangle pointing left (binary). Similar: \lhd. For the normal subgroup symbol you should load amssymb and use \vartriangleleft (which is a relation and so gives better spacing). \triangleright ▷ Not-filled triangle pointing right (binary). For the normal subgroup symbol you should instead load amssymb and use \vartriangleright (which is a relation and so gives better spacing). \unlhd ⊴ Left-pointing not-filled underlined arrowhead, that is, triangle, with a line under (binary). For the normal subgroup symbol load amssymb and use \vartrianglelefteq (which is a relation and so gives better spacing). \unrhd ⊵ Right-pointing not-filled underlined arrowhead, that is, triangle, with a line under (binary). For the normal subgroup symbol load amssymb and use \vartrianglerighteq (which is a relation and so gives better spacing). \Uparrow ⇑ Double-line upward-pointing arrow (relation). Similar: single-line up-pointing arrow \uparrow. \uparrow ↑ Single-line upward-pointing arrow, diverges (relation). Similar: double-line up-pointing arrow \Uparrow. \Updownarrow ⇕ Double-line upward-and-downward-pointing arrow (relation). Similar: single-line upward-and-downward-pointing arrow \updownarrow. \updownarrow ↕ Single-line upward-and-downward-pointing arrow (relation). Similar: double-line upward-and-downward-pointing arrow \Updownarrow. \upharpoonright ↾, Up harpoon, with barb on right side (relation). Synonym: \restriction. Not available in plain TeX. In LaTeX you need to load the amssymb package. \uplus ⊎ Multiset union, a union symbol with a plus symbol in the middle (binary). Similar: union \cup. Related: variable-sized operator \biguplus. \Upsilon Υ uppercase Greek letter (ordinary). \upsilon υ Lowercase Greek letter (ordinary). \varepsilon ε Small letter script epsilon (ordinary). This is more widely used in mathematics than the non-variant lunate epsilon form \epsilon ϵ. Related: set membership \in. \vanothing ∅, Empty set symbol. Similar: \emptyset. Related: \revemptyset. Not available in plain TeX. In LaTeX you need to load the amssymb package. \varphi φ Variant on the lowercase Greek letter (ordinary). The non-variant form is \phi ϕ. \varpi ϖ Variant on the lowercase Greek letter (ordinary). The non-variant form is \pi π. \varrho ϱ Variant on the lowercase Greek letter (ordinary). The non-variant form is \rho ρ. \varsigma ς Variant on the lowercase Greek letter (ordinary). The non-variant form is \sigma σ. \vartheta ϑ Variant on the lowercase Greek letter (ordinary). The non-variant form is \theta θ. \vdash ⊢ Provable; turnstile, vertical and a dash (relation). Similar: turnstile rotated a half-circle \dashv. \vee ∨ Logical or; a downwards v shape (binary). Related: logical and \wedge. Similar: variable-sized operator \bigvee. \Vert ‖ Vertical double bar (ordinary). See Delimiters, for how to use the mathtools package to create flexibly-sized norm symbols. \vert | Single line vertical bar (ordinary). For “such that”, as in the definition of a set, use \mid because it is a relation. See Delimiters, for how to use the mathtools package to create flexibly-sized absolute-value symbols. \wedge ∧ Logical and (binary). Synonym: \land. See also logical or \vee. Similar: variable-sized operator \bigwedge. \wp ℘ Weierstrass p (ordinary). \wr ≀ Wreath product (binary). \Xi Ξ uppercase Greek letter (ordinary). \xi ξ Lowercase Greek letter (ordinary). \zeta ζ Lowercase Greek letter (ordinary). The following symbols are most often used in plain text but LaTeX provides versions to use in mathematical text. \mathdollar Dollar sign in math mode:$.

\mathparagraph

Paragraph sign (pilcrow) in math mode, ¶.

\mathsection

\mathsterling

\mathunderscore

Underscore in math mode: _.

Next: , Up: Math symbols   [Contents][Index]

#### 16.2.1 Arrows

These are the arrows that come with standard LaTeX. The latexsym and amsfonts packages contain many more.

SymbolCommand
\Downarrow
\downarrow
\hookleftarrow
\hookrightarrow
\leftarrow
\Leftarrow
\Leftrightarrow
\leftrightarrow
\longleftarrow
\Longleftarrow
\longleftrightarrow
\Longleftrightarrow
\longmapsto
\Longrightarrow
\longrightarrow
\mapsto
\nearrow
\nwarrow
\Rightarrow
\rightarrow, or \to
\searrow
\swarrow
\uparrow
\Uparrow
\updownarrow
\Updownarrow

An example of the difference between \to and \mapsto is: $$f\colon D\to C$$ given by $$n\mapsto n^2$$.

For commutative diagrams there are a number of packages, including tikz-cd and amscd.

Next: , Previous: , Up: Math symbols   [Contents][Index]

#### 16.2.2 \boldmath & \unboldmath

Synopsis (used in paragraph mode or LR mode):

\boldmath $$math$$


or

\unboldmath $$math$$


Declarations to change the letters and symbols in math to be in a bold font, or to countermand that and bring back the regular (non-bold) default. They must be used when not in math mode or display math mode (see Modes). Both commands are fragile (see \protect).

In this example each \boldmath command takes place inside an \mbox,



If you want a reserved character to be printed as itself, in the text body font, for all but the final three characters in that list simply put a backslash \ in front of the character. Thus, typing \$1.23 will produce $1.23 in your output.

As to the last three characters, to get a tilde in the text body font use \~{} (omitting the curly braces would result in the next character receiving a tilde accent). Similarly, to get a text body font circumflex use \^{}. To get a backslash in the font of the text body, enter \textbackslash{}.

To produce the reserved characters in a typewriter font use \verb!! as below (the double backslash \\ is only there to split the lines in the output).

\begin{center}
\# \$\% \& \{ \} \_ \~{} \^{} \textbackslash \\ \verb!#$ % & { } _ ~ ^ \!
\end{center}


Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.2 Upper and lower case

Synopsis:

\uppercase{text}
\lowercase{text}
\MakeUppercase{text}
\MakeLowercase{text}


Change the case of characters. The TeX primitive commands \uppercase and \lowercase are set up by default to work only with the 26 letters a–z and A–Z. The LaTeX commands \MakeUppercase and \MakeLowercase commands also change characters accessed by commands such as \ae or \aa. The commands \MakeUppercase and \MakeLowercase are robust but they have moving arguments (see \protect).

These commands do not change the case of letters used in the name of a command within text. But they do change the case of every other Latin letter inside the argument text. Thus, \MakeUppercase{Let $y=f(x)$} produces ‘LET Y=F(X)’. Another example is that the name of an environment will be changed, so that \MakeUppercase{\begin{tabular} ... \end{tabular}} will produce an error because the first half is changed to \begin{TABULAR}.

LaTeX uses the same fixed table for changing case throughout a document, The table used is designed for the font encoding T1; this works well with the standard TeX fonts for all Latin alphabets but will cause problems when using other alphabets.

To change the case of text that results from a macro inside text you need to do expansion. Here the \Schoolname produces ‘COLLEGE OF MATHEMATICS’.

\newcommand{\schoolname}{College of Mathematics}
\newcommand{\Schoolname}{\expandafter\MakeUppercase
\expandafter{\schoolname}}


The textcase package brings some of the missing feature of the standard LaTeX commands \MakeUppercase and \MakeLowerCase.

To uppercase only the first letter of words, you can use the package mfirstuc.

Handling all the casing rules specified by Unicode, e.g., for non-Latin scripts, is a much bigger job than anything envisioned in the original TeX and LaTeX. It has been implemented in the expl3 package as of 2020. The article “Case changing: From TeX primitives to the Unicode algorithm”, (Joseph Wright, TUGboat 41:1, https://tug.org/TUGboat/tb41-1/tb127wright-case.pdf), gives a good overview of the topic, past and present.

Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.3 Symbols by font position

You can access any character of the current font using its number with the \symbol command. For example, the visible space character used in the \verb* command has the code decimal 32 in the standard Computer Modern typewriter font, so it can be typed as \symbol{32}.

You can also specify numbers in octal (base 8) by using a ' prefix, or hexadecimal (base 16) with a " prefix, so the visible space at 32 decimal could also be written as \symbol{'40} or \symbol{"20}.

Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.4 Text symbols

LaTeX provides commands to generate a number of non-letter symbols in running text. Some of these, especially the more obscure ones, are not available in OT1. As of the LaTeX February 2020 release, all symbols are available by default; before that, it was necessary to use the textcomp package for some (technically, those in the TS1 font encoding).

\copyright
\textcopyright

\dag

† The dagger symbol (in text).

\ddag

‡ The double dagger symbol (in text).

\LaTeX

The LaTeX logo.

\LaTeXe

The LaTeX2e logo.

\guillemotleft («)
\guillemotright (»)
\guilsinglleft (‹)
\guilsinglright (›)

«, », ‹, › Double and single angle quotation marks, commonly used in French.

\ldots
\dots
\textellipsis

… An ellipsis (three dots at the baseline): \ldots and \dots also work in math mode.

\lq

‘ Left (opening) quote.

\P
\textparagraph

¶ Paragraph sign (pilcrow).

\pounds
\textsterling

£ English pounds sterling.

\quotedblbase („)
\quotesinglbase (‚)

„ and ‚ Double and single quotation marks on the baseline.

\rq

’ Right (closing) quote.

\S
\textsection

§ Section sign.

\TeX

The TeX logo.

\textasciicircum

^ ASCII circumflex.

\textasciitilde

~ ASCII tilde.

\textasteriskcentered

* Centered asterisk.

\textbackslash

\ Backslash.

\textbar

| Vertical bar.

\textbardbl

⏸ Double vertical bar.

\textbigcircle

◯, Big circle symbol.

\textbraceleft

{ Left brace.

\textbraceright

} Right brace.

\textbullet

• Bullet.

\textcircled{letter}

Ⓐ, Circle around letter.

\textcompwordmark
\textcapitalcompwordmark
\textascendercompwordmark

Used to separate letters that would normally ligature. For example, f\textcompwordmark i produces ‘fi’ without a ligature. This is most useful in non-English languages. The \textcapitalcompwordmark form has the cap height of the font while the \textascendercompwordmark form has the ascender height.

\textdagger

† Dagger.

\textdaggerdbl

‡ Double dagger.

\textdollar (or \$)$ Dollar sign.

\textemdash (or ---)

— Em-dash. Used for punctuation, usually similar to commas or parentheses, as in ‘The playoffs---if you're lucky enough to make the playoffs---are more like a sprint.’ Conventions for spacing around em-dashes vary widely.

\textendash (or --)

– En-dash. Used for ranges, as in ‘see pages 12--14’.

\texteuro

The Euro currency symbol: €.

For an alternative glyph design, try the eurosym package; also, most fonts nowadays come with their own Euro symbol (Unicode U+20AC).

\textexclamdown (or !)

¡ Upside down exclamation point.

\textfiguredash

Dash used between numerals, Unicode U+2012. Defined in the June 2021 release of LaTeX. When used in pdfTeX, approximated by an en-dash; with a Unicode engine, either typesets the glyph if available in the current font, or writes the usual “Missing character” warning to the log file.

\textgreater

> Greater than symbol.

\texthorizontalbar

Horizontal bar character, Unicode U+2015. Defined in the June 2021 release of LaTeX. Behavior as with \textfiguredash above; the pdfTeX approximation is an em-dash.

\textless

< Less than symbol.

\textleftarrow

←, Left arrow.

\textnonbreakinghyphen

Non-breaking hyphen character, Unicode U+2011. Defined in the June 2021 release of LaTeX. Behavior as with \textfiguredash above; the pdfTeX approximation is a regular ASCII hyphen (with breaks disallowed after).

\textordfeminine
\textordmasculine

ª, º Feminine and masculine ordinal symbols.

\textperiodcentered

· Centered period.

\textquestiondown (or ?)

¿ Upside down question mark.

\textquotedblleft (or )

“ Double left quote.

\textquotedblright (or '')

” Double right quote.

\textquoteleft (or )

‘ Single left quote.

\textquoteright (or ')

’ Single right quote.

\textquotesingle

', Straight single quote. (From TS1 encoding.)

\textquotestraightbase
\textquotestraightdblbase

Single and double straight quotes on the baseline.

\textregistered

® Registered symbol.

\textrightarrow

→, Right arrow.

\textthreequartersemdash

﹘, “Three-quarters” em-dash, between en-dash and em-dash.

\texttrademark

\texttwelveudash

﹘, “Two-thirds” em-dash, between en-dash and em-dash.

\textunderscore

_ Underscore.

\textvisiblespace

␣, Visible space symbol.

Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.5 Accents

LaTeX has wide support for many of the world’s scripts and languages, provided through the core babel package, which supports pdfLaTeX, XeLaTeX and LuaLaTeX. The polyglossia package provides similar support with the latter two engines.

This section does not cover that support. It only lists the core LaTeX commands for creating accented characters. The \capital... commands shown here produce alternative forms for use with capital letters. These are not available with OT1.

Below, to make them easier to find, the accents are all illustrated with lowercase ‘o’.

Note that \i produces a dotless i, and \j produces a dotless j. These are often used in place of their dotted counterparts when they are accented.

\"
\capitaldieresis

ö Umlaut (dieresis).

\'
\capitalacute

ó Acute accent.

\.

ȯ Dot accent.

\=
\capitalmacron

ō Macron (overbar) accent.

\^
\capitalcircumflex

ô Circumflex (hat) accent.

\
\capitalgrave

ò Grave accent.

\~
\capitaltilde

ñ Tilde accent.

\b

o_ Bar accent underneath.

Related to this, \underbar{text} produces a bar under text. The argument is always processed in LR mode (see Modes). The bar is always a fixed position under the baseline, thus crossing through descenders. See also \underline in Math miscellany.

\c
\capitalcedilla

ç Cedilla accent underneath.

\d
\capitaldotaccent

ọ Dot accent underneath.

\H
\capitalhungarumlaut

ő Long Hungarian umlaut accent.

\k
\capitalogonek

ǫ Ogonek. Not available in the OT1 encoding.

\r
\capitalring

o* Ring accent.

\t
\capitaltie
\newtie
\capitalnewtie

oo[ Tie-after accent. The \newtie form is centered in its box.

\u
\capitalbreve

ŏ Breve accent.

\v
\capitalcaron

ǒ Háček (check, caron) accent.

Up: Accents   [Contents][Index]

#### 23.5.1 \accent

Synopsis:

\accent number character


A TeX primitive command used to generate accented characters from accent marks and letters. The accent mark is selected by number, a numeric argument, followed by a space and then a character argument constructs the accented character in the current font.

These are accented ‘e’ characters.

\accent18 e
\accent20 e
\accent21 e
\accent22 e
\accent23 e


The first is a grave, the second is breve, etc.

The position of the accent is determined by the font designer and so the outcome of \accent use may differ between fonts. In LaTeX it is desirable to have glyphs for accented characters rather than building them using \accent. Using glyphs that already contain the accented characters (as in T1 encoding) allows correct hyphenation whereas \accent disables hyphenation (specifically with OT1 font encoding where accented glyphs are absent).

There can be an optional font change between number and character. Note also that this command sets the \spacefactor to 1000 (see \spacefactor).

An unavoidable characteristic of some Cyrillic letters and the majority of accented Cyrillic letters is that they must be assembled from multiple elements (accents, modifiers, etc.) while \accent provides for a single accent mark and a single letter combination. There are also cases where accents must appear between letters that \accent does not support. Still other cases exist where the letters I and J have dots above their lowercase counterparts that conflict with dotted accent marks. The use of \accent in these cases will not work as it cannot analyze upper/lower case.

Next: , Previous: , Up: Special insertions   [Contents][Index]

Here are the basic LaTeX commands for inserting letters beyond A–Z that extend the Latin alphabet, used primarily in languages other than English.

\aa
\AA

å and Å.

\ae
\AE

æ and Æ.

\dh
\DH

Icelandic letter eth: ð and Ð. Not available with OT1 encoding, you need the fontenc package to select an alternate font encoding, such as T1.

\dj
\DJ

Crossed d and D, a.k.a. capital and small letter d with stroke. Not available with OT1 encoding, you need the fontenc package to select an alternate font encoding, such as T1.

\ij
\IJ

ij and IJ (except somewhat closer together than appears here).

\l
\L

ł and Ł.

\ng
\NG

Lappish letter eng, also used in phonetics.

\o
\O

ø and Ø.

\oe
\OE

œ and Œ.

\ss
\SS

ß and SS.

\th
\TH

Icelandic letter thorn: þ and Þ. Not available with OT1 encoding, you need the fontenc package to select an alternate font encoding, such as T1.

Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.7 inputenc package

Synopsis:

\usepackage[encoding-name]{inputenc}


Declare the input file’s text encoding to be encoding-name. The default, if this package is not loaded, is UTF-8. Technically, specifying the encoding name is optional, but in practice it is not useful to omit it.

In a computer file, the characters are stored according to a scheme called the encoding. There are many different encodings. The simplest is ASCII, which supports 95 printable characters, not enough for most of the world’s languages. For instance, to typeset the a-umlaut character ä in an ASCII-encoded LaTeX source file, the sequence \"a is used. This would make source files for anything but English hard to read; even for English, often a more extensive encoding is more convenient.

The modern encoding standard, in some ways a union of the others, is UTF-8, one of the representations of Unicode. This is the default for LaTeX since 2018.

The inputenc package is how LaTeX knows what encoding is used. For instance, the following command explicitly says that the input file is UTF-8 (note the lack of a dash).

\usepackage[utf8]{inputenc}


Caution: use inputenc only with the pdfTeX engine (see TeX engines). (The XeTeX and LuaTeX engines assume that the input file is UTF-8 encoded.) If you invoke LaTeX with either the xelatex command or the lualatex command, and try to declare a non-UTF-8 encoding with inputenc, such as latin1, then you will get the error inputenc is not designed for xetex or luatex.

An inputenc package error such as Invalid UTF-8 byte "96 means that some of the material in the input file does not follow the encoding scheme. Often these errors come from copying material from a document that uses a different encoding than the input file; this one is a left single quote from a web page using latin1 inside a LaTeX input file that uses UTF-8. The simplest solution is to replace the non-UTF-8 character with its UTF-8 equivalent, or use a LaTeX equivalent command or character.

In some documents, such as a collection of journal articles from a variety of authors, changing the encoding in mid-document may be necessary. Use the command \inputencoding{encoding-name}. The most common values for encoding-name are: ascii, latin1, latin2, latin3, latin4, latin5, latin9, latin10, and utf8.

Next: , Previous: , Up: Special insertions   [Contents][Index]

### 23.8 \rule

Synopsis, one of:

\rule{width}{thickness}
\rule[raise]{width}{thickness}


Produce a rule, a filled-in rectangle.

This example produces a rectangular blob, sometimes called a Halmos symbol, or just “qed”, often used to mark the end of a proof:

\newcommand{\qedsymbol}{\rule{0.4em}{2ex}}


The amsthm package includes this command, with a somewhat different-looking symbol.

The mandatory arguments give the horizontal width and vertical thickness of the rectangle. They are rigid lengths (see Lengths). The optional argument raise is also a rigid length, and tells LaTeX how much to raise the rule above the baseline, or lower it if the length is negative.

This produces a line, a rectangle that is wide but not tall.

\noindent\rule{\textwidth}{0.4pt}


The line is the width of the page and 0.4 points tall. This line thickness is common in LaTeX.

A rule that has zero width, or zero thickness, will not show up in the output, but can cause LaTeX to change the output around it. See \strut, for examples.

Previous: , Up: Special insertions   [Contents][Index]

### 23.9 \today

Synopsis:

\today


Produce today’s date in the format ‘month dd, yyyy’. An example of a date in that format is ‘July 4, 1976’.

Multilingual packages such as babel or polyglossia, or classes such as lettre, will localize \today. For example, the following will output ‘4 juillet 1976’:

\year=1976 \month=7 \day=4
\documentclass{minimal}
\usepackage[french]{babel}
\begin{document}
\today
\end{document}


\today uses the counters \day, \month, and \year (see \day & \month & \year).

A number of package on CTAN work with dates. One is datetime package which can produce a wide variety of date formats, including ISO standards.

The date is not updated as the LaTeX process runs, so in principle the date could be incorrect by the time the program finishes.

Next: , Previous: , Up: Top   [Contents][Index]

## 24 Splitting the input

LaTeX lets you split a large document into several smaller ones. This can simplify editing or allow multiple authors to work on the document. It can also speed processing.

Regardless of how many separate files you use, there is always one root file, on which LaTeX compilation starts. This shows such a file with five included files.

\documentclass{book}
\includeonly{  % comment out lines below to omit compiling
pref,
chap1,
chap2,
append,
bib
}
\begin{document}
\frontmatter
\include{pref}
\mainmatter
\include{chap1}
\include{chap2}
\appendix
\include{append}
\backmatter
\include{bib}
\end{document}


This will bring in material from pref.tex, chap1.tex, chap2.tex, append.tex, and bib.tex. If you compile this file, and then comment out all of the lines inside \includeonly{...} except for chap1, and compile again, then LaTeX will only process the material in the first chapter. Thus, your output will appear more quickly and be shorter to print. However, the advantage of the \includeonly command is that LaTeX will retain the page numbers and all of the cross reference information from the other parts of the document so these will appear in your output correctly.

See Larger book template, for another example of \includeonly.

Next: , Up: Splitting the input   [Contents][Index]

### 24.1 \endinput

Synopsis:

\endinput


When you \include{filename}, inside filename.tex the material after \endinput will not be included. This command is optional; if filename.tex has no \endinput then LaTeX will read all of the file.

For example, suppose that a document’s root file has \input{chap1} and this is chap1.tex.

\chapter{One}
This material will appear in the document.
\endinput
This will not appear.


This can be useful for putting documentation or comments at the end of a file, or for avoiding junk characters that can be added if the file is transmitted in the body of an email. It is also useful for debugging: one strategy to localize errors is to put \endinput halfway through the included file and see if the error disappears. Now, knowing which half contains the error, moving \endinput to halfway through that area further narrows down the location. This process rapidly finds the offending line.

After reading \endinput, LaTeX continues to read to the end of the line, so something can follow this command and be read nonetheless. This allows you, for instance, to close an \if... with a \fi.

Next: , Previous: , Up: Splitting the input   [Contents][Index]

### 24.2 \include & \includeonly

Synopsis:

\includeonly{  % in document preamble
...
filename,
...
}
...
\include{filename}  % in document body


Bring material from the external file filename.tex into a LaTeX document.

The \include command does three things: it executes \clearpage (see \clearpage & \cleardoublepage), then it inputs the material from filename.tex into the document, and then it does another \clearpage. This command can only appear in the document body.

The \includeonly command controls which files will be read by LaTeX under subsequent \include commands. Its list of filenames is comma-separated. It must appear in the preamble or even earlier, e.g., the command line; it can’t appear in the document body.

This example root document, constitution.tex, brings in three files, preamble.tex, articles.tex, and amendments.tex.

\documentclass{book}
\includeonly{
preamble,
articles,
amendments
}
\begin{document}
\include{preamble}
\include{articles}
\include{amendments}
\end{document}


The file preamble.tex contains no special code; you have just excerpted the chapter from consitution.tex and put it in a separate file just for editing convenience.

\chapter{Preamble}
We the People of the United States,
in Order to form a more perfect Union, ...


Running LaTeX on constitution.tex makes the material from the three files appear in the document but also generates the auxiliary files preamble.aux, articles.aux, and amendments.aux. These contain information such as page numbers and cross-references (see Cross references). If you now comment out \includeonly’s lines with preamble and amendments and run LaTeX again then the resulting document shows only the material from articles.tex, not the material from preamble.tex or amendments.tex. Nonetheless, all of the auxiliary information from the omitted files is still there, including the starting page number of the chapter.

If the document preamble does not have \includeonly then LaTeX will include all the files you call for with \include commands.

The \include command makes a new page. To avoid that, see \input (which, however, does not retain the auxiliary information).

See Larger book template, for another example using \include and \includeonly. That example also uses \input for some material that will not necessarily start on a new page.

File names can involve paths.

\documentclass{book}
\includeonly{
chapters/chap1,
}
\begin{document}
\include{chapters/chap1}
\end{document}


To make your document portable across distributions and platforms you should avoid spaces in the file names. The tradition is to instead use dashes or underscores. Nevertheless, for the name ‘amo amas amat’, this works under TeX Live on GNU/Linux:

\documentclass{book}
\includeonly{
"amo\space amas\space amat"
}
\begin{document}
\include{"amo\space amas\space amat"}
\end{document}


and this works under MiKTeX on Windows:

\documentclass{book}
\includeonly{
{"amo amas amat"}
}
\begin{document}
\include{{"amo amas amat"}}
\end{document}


You cannot use \include inside a file that is being included or you get ‘LaTeX Error: \include cannot be nested.’ The \include command cannot appear in the document preamble; you will get ‘LaTeX Error: Missing \begin{document}’.

If a file that you \include does not exist, for instance if you \include{athiesm} but you meant \include{atheism}, then LaTeX does not give you an error but will warn you ‘No file athiesm.tex.’ (It will also create athiesm.aux.)

If you \include the root file in itself then you first get ‘LaTeX Error: Can be used only in preamble.’ Later runs get ‘TeX capacity exceeded, sorry [text input levels=15]’. To fix this, you must remove the inclusion \include{root} but also delete the file root.aux and rerun LaTeX.

Previous: , Up: Splitting the input   [Contents][Index]

### 24.3 \input

Synopsis:

\input{filename}


LaTeX processes the file as if its contents were inserted in the current file. For a more sophisticated inclusion mechanism see \include & \includeonly.

If filename does not end in ‘.tex’ then LaTeX first tries the filename with that extension; this is the usual case. If filename ends with ‘.tex’ then LaTeX looks for the filename as it is.

For example, this

\input{macros}


will cause LaTeX to first look for macros.tex. If it finds that file then it processes its contents as thought they had been copy-pasted in. If there is no file of the name macros.tex then LaTeX tries the name macros, without an extension. (This may vary by distribution.)

To make your document portable across distributions and platforms you should avoid spaces in the file names. The tradition is to instead use dashes or underscores. Nevertheless, for the name ‘amo amas amat’, this works under TeX Live on GNU/Linux:

\input{"amo\space amas\space amat"}


and this works under MiKTeX on Windows:

\input{{"amo amas amat"}}


Next: , Previous: , Up: Top   [Contents][Index]

## 25 Front/back matter

Next: , Up: Front/back matter   [Contents][Index]

Synopsis, one of:

\tableofcontents
\listoffigures
\listoftables


Produce a table of contents, or list of figures, or list of tables. Put the command in the input file where you want the table or list to go. You do not type the entries; for example, typically the table of contents entries are automatically generated from the sectioning commands \chapter, etc.

This example illustrates the first command, \tableofcontents. LaTeX will produce a table of contents on the book’s first page.

\documentclass{book}
% \setcounter{tocdepth}{1}
\begin{document}
\tableofcontents\newpage
...
\chapter{...}
...
\section{...}
...
\subsection{...}
...
\end{document}


Uncommenting the second line would cause that table to contain chapter and section listings but not subsection listings, because the \section command has level 1. See Sectioning, for level numbers of the sectioning units. For more on the tocdepth see Sectioning/tocdepth.

Another example of the use of \tableofcontents is in Larger book template.

If you want a page break after the table of contents, write a \newpage command after the \tableofcontents command, as above.

To make the table of contents, LaTeX stores the information in an auxiliary file named root-file.toc (see Splitting the input). For example, this LaTeX file test.tex

\documentclass{article}
\begin{document}
\tableofcontents\newpage
\section{First section}
\subsection{First subsection}
...


writes these lines to test.toc.

\contentsline {section}{\numberline {1}First section}{2}
\contentsline {subsection}{\numberline {1.1}First subsection}{2}


Each line contains a single command, \contentsline (see \contentsline). The first argument, the section or subsection, is the sectioning unit. The second argument has two components. The hook \numberline determines how the sectioning number, 1 or 1.1, appears in the table of contents (see \numberline). The remainder of the second argument of \contentsline, ‘First section’ or ‘First subsection’, is the sectioning title text. Finally, the third argument, ‘2’, is the page number on which this sectioning unit starts.

To typeset these lines, the document class provides \l@section-unit commands such as \l@section{text}{pagenumber} and \l@subsection{text}{pagenumber}. These commands often use the \@dottedtocline command (see \@dottedtocline).

A consequence of LaTeX’s strategy of using auxiliary files is that to get the correct information in the document you must run LaTeX twice, once to store the information and the second time to retrieve it. In the ordinary course of writing a document authors run LaTeX a number of times, but you may notice that the first time that you compile a new document, the table of contents page will be empty except for its ‘Contents’ header. Just run LaTeX again.

The commands \listoffigures and \listoftables produce a list of figures and a list of tables. Their information is stored in files with extension .lof and .lot. They work the same way as \tableofcontents but the latter is more common, so we use it for most examples.

You can manually add material to the table of contents, the list of figures, and the list of tables. For instance, add a line about a section to the table of contents with \addcontentsline{toc}{section}{text}. (see \addcontentsline). Add arbitrary material, that is, non-line material, with \addtocontents, as with the command \addtocontents{lof}{\protect\vspace{2ex}}, which adds vertical space to the list of figures (see \addtocontents).

Lines in the table of contents, the list of figures, and the list of tables, have four parts. First is an indent. Next is a box into which sectioning numbers are placed, and then the third box holds the title text, such as ‘First section’. Finally there is a box up against the right margin, inside of which LaTeX puts the page number box. For the indent and the width of the number box, see \@dottedtocline. The right margin box has width \@tocrmarg and the page number is flush right in that space, inside a box of width \@pnumwidth. By default \@tocrmarg is 2.55em and \@pnumwidth is 1.55em. Change these as with \renewcommand{\@tocrmarg}{3.5em}.

CTAN has many packages for the table of contents and lists of figures and tables (see CTAN). The package tocloft is convenient for adjusting some aspects of the default such as spacing. And, tocbibbind will automatically add the bibliography, index, etc. to the table of contents.

To change the header for the table of contents page, do something like these commands before you call \tableofcontents, etc.

\renewcommand{\contentsname}{Table of Contents}
\renewcommand{\listfigurename}{Plots}
\renewcommand{\listtablename}{Specifications}


Internationalization packages such as babel or polyglossia will change these headers depending on the chosen base language.

#### 25.1.1 \@dottedtocline

Synopsis:

\@dottedtocline{section-level-num}{indent}{numwidth}{text}{pagenumber}


Used internally by LaTeX to format an entry line in the table of contents, list of figures, or list of tables. Authors do not directly enter \@dottedtocline commands.

This command is typically used by \l@section, \l@subsection, etc., to format the content lines. For example, the article.cls file contains these definitions:

\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}


In this example, \@dottedcline appears to have been given only three arguments. But tracing the internal code shows that it picks up the final text and pagenumber arguments in the synopsis from a call to \contentsline.


In the default book class, LaTeX does not use dotted leaders for the Part and Chapter table entries, and in the default article class it does not use dotted leaders for Section entries.

#### 25.1.2 \addcontentsline

Synopsis:

\addcontentsline{ext}{unit}{text}


Add an entry to the auxiliary file with extension ext.

\addcontentsline{toc}{section}{\protect\textbf{Appendices}}


It will appear at the same indentation level as the sections, will be in boldface, and will be assigned the page number associated with the point where it appears in the input file.

The \addcontentsline command writes information to the file root-name.ext. It writes that information as the text of the command \contentsline{unit}{text}{num}, where num is the current value of counter unit (see \contentsline). The most common case is the table of contents and there num is the page number of the first page of unit.

This command is invoked by the sectioning commands \chapter, etc., and also by \caption inside a float environment. But it is also used by authors. For example, an author writing a book whose style is to have an unnumbered preface may use the starred \chapter*. But that command leaves out table of contents information, which can be entered manually, as here.

\chapter*{Preface}


In the .toc file LaTeX will put the line \contentsline {chapter}{\numberline {}Preface}{3}; note that the page number ‘3’ is automatically generated by the system, not entered manually.

All of the arguments for \addcontentsline are required.

ext

Typically one of the strings toc for the table of contents, lof for the list of figures, or lot for the list of tables. The filename extension of the information file.

unit

A string that depends on the value of the ext argument:

toc

For the table of contents, this is the name of a sectional unit: part, chapter, section, subsection, etc.

lof

For the list of figures: figure.

lot

For the list of tables: table.

text

The text of the entry. You must \protect any commands that are fragile (see \protect).

The \addcontentsline command has an interaction with \include (see \include & \includeonly). If you use them at the same level, as with \addcontentsline{...}{...}{...}\include{...} then lines in the table of contents can come out in the wrong order. The solution is to move \addcontentsline into the file being included.

If you use a unit that LaTeX does not recognize, as here

\addcontentsline{toc}{setcion}{\protect\textbf{Appendices}}


then you don’t get an error but the formatting in the table of contents will not make sense.

#### 25.1.3 \addtocontents

Synopsis:

\addtocontents{ext}{text}


Add text, which may be text or formatting commands, directly to the auxiliary file with extension ext. This is most commonly used for the table of contents so that is the discussion here, but it also applies to the list of figures and list of tables.

\tableofcontents\newpage


This puts the word ‘Page’, in boldface, above the column of page numbers and after the header.

\tableofcontents
\chapter{...}


This adds a line announcing work by a new author.

\addtocontents{toc}{%
\protect\vspace{2ex}
\textbf{Chapters by N. Other Author}\par}


The difference between \addtocontents and \addcontentsline is that the latter is strictly for lines, such as with a line giving the page number for the start of a new subset of the chapters. As the above examples show, \addtocontents is for material such as spacing.

The \addtocontents command has two arguments. Both are required.

ext

Typically one of: toc for the table of contents, lof for the list of figures, or lot for the list of tables. The extension of the file holding the information.

text

The text, and possibly commands, to be written.

The sectioning commands such as \chapter use the \addcontentsline command to store information. This command creates lines in the .toc auxiliary file containing the \contentsline command (see \addcontentsline). In contrast, the command \addtocontents puts material directly in that file.

The \addtocontents command has an interaction with \include (see \include & \includeonly). If you use them at the same level, as with \addtocontents{...}{...}\include{...} then lines in the table of contents can come out in the wrong order. The solution is to move \addtocontents into the file being included.

#### 25.1.4 \contentsline

Synopsis:

\contentsline{unit}{text}{pagenumber}


Used internally by LaTeX to typeset an entry of the table of contents, list of figures, or list of tables (see Table of contents etc.). Authors do not directly enter \contentsline commands.

Usually adding material to these lists is done automatically by the commands \chapter, \section, etc. for the table of contents, or by the \caption command inside of a \figure or \table environment (see figure and see table). Thus, where the base file is thesis.tex, and contains the declaration \tableofcontents, the command \chapter{Chapter One} produces something like this in the file thesis.toc.

\contentsline {chapter}{\numberline {1}Chapter One}{3}


If the file contains the declaration \listoffigures then a figure environment involving \caption{Test} will produce something like this in thesis.lof.

\contentsline {figure}{\numberline {1.1}{\ignorespaces Test}}{6}


To manually add material, use \addcontentsline{filetype}{unit}{text}, where filetype is toc, lof, or lot (see \addcontentsline).

For manipulating how the \contentline material is typeset, see the tocloft package.

Note that the hyperref package changes the definition of \contentsline (and \addcontentsline) to add more arguments, to make hyperlinks. This is the source of the error Argument of \contentsline has an extra }. Fix this error by deleting the .toc or .lof or .lot file, and running LaTeX again.

#### 25.1.5 \nofiles

Synopsis:

\nofiles


Prevent LaTeX from writing any auxiliary files. The only output will be the .log and .pdf (or .dvi) files. This command must go in the preamble.

Because of the \nofiles command this example will not produce a .toc file.

\documentclass{book}
\nofiles
\begin{document}
\tableofcontents\newpage
\chapter{...}
...


LaTeX will not erase any existing auxiliary files, so if you insert the \nofiles command after you have run the file and gotten a .toc then the table of contents page will continue to show the old information.

#### 25.1.6 \numberline

Synopsis:

\numberline{number}


Typeset its argument flush left in a box. This is used in a \contentsline command to typeset the section number (see \contentsline).

For example, this line in a .toc file causes the 1 to be typeset flush left.

\contentsline {subsection}{\numberline {1.1}Motivation}{2}


By default, LaTeX typesets the section numbers in a box of length \@tempdima. That length is set by the commands \l@section, \l@subsection, etc. Put section numbers inside a natural-width box with \renewcommand{\numberline}[1]{#1~}.

This command is fragile, so you may need to precede it with \protect (see \protect). An example is the use of \protect in the command \addcontentsline{toc}{section}{\protect\numberline{}Summary} to get the \numberline into this command in the .toc file: \contentsline {section}{\numberline {}Summary}{6} (the page number ‘6’ is automatically added by LaTeX; see \addcontentsline).

Next: , Previous: , Up: Front/back matter   [Contents][Index]

### 25.2 Indexes

This document has an index.

\documentclass{article}
\usepackage{makeidx} \makeindex
...
\begin{document}
...
Recall Wilson's Theorem: \index{Wilson's Theorem}
a number $$n>1$$ is prime if and only if the factorial of $$n-1$$
is congruent to $$-1$$ modulo~$$n$$.
...
\printindex
...


The \usepackage{makeidx} and \makeindex in the preamble bring in the relevant commands.

Producing an index is a three stage process. First, in the document body you declare index entries with the \index command (see \index). When you run LaTeX, the \index writes its information to an auxiliary file root-name.idx. Next, to alphabetize and to do other manipulations you run an external command, typically makeindex or xindy (see makeindex). These output a file root-name.ind. Finally, you bring the information back into your document and typeset it with the \printindex command (see \printindex).

There are many packages in the area of indexing. The showidx package causes each index entries to be shown in the margin on the page where the entry appears. This can help in preparing the index. The multind package, among others, supports multiple indexes. See also the TeX FAQ entry on this topic, https://www.texfaq.org/FAQ-multind, and the CTAN topic, https://ctan.org/topic/index-multi.

Next: , Up: Indexes   [Contents][Index]

#### 25.2.1 \index

Synopsis:

\index{index-entry-string}


Declare an entry in the index. This command is fragile (see \protect).

For example, as described in Indexes, one way to get an index from what’s below is to compile the document with pdflatex test, then process the index entries with makeindex test, and then compile again with pdflatex test.

W~Ackermann (1896--1962).\index{Ackermann}
...
Ackermann function\index{Ackermann!function}
...
rate of growth\index{Ackermann!function!growth rate}


All three index entries will get a page number, such as ‘Ackermann, 22’. LaTeX will format the second as a subitem of the first, on the line below it and indented, and the third as a subitem of the second. Three levels deep is as far as you can nest subentries. (If you add \index{Ackermann!function!growth rate!comparison} then makeindex says ‘Scanning input file test.idx....done (4 entries accepted, 1 rejected)’ and nothing appears in the index).

If you enter a second \index with the same index-entry-string then you will get a single index entry with two page numbers (unless they happen to fall on the same page). Thus, adding as for Ackermann.\index{Ackermann} later in the same document as above will give an index entry like ‘Ackermann, 22, 151’. Also, you can enter the index entries in any order, so for instance \index{Ackermann!function} could come before \index{Ackermann}.

Get a page range in the output, like ‘Hilbert, 23--27’, as here.

W~Ackermann (1896--1962).\index{Ackermann}
...
D~Hilbert (1862--1943)\index{Ackermann!Hilbert$$} ... disapproved of his marriage.\index{Ackermann!Hilbert$$}


If the beginning and ending of the page range are equal then the system just gives a single page entry, not a range.

If you index subentries but not a main entry, as with \index{Jones!program} and \index{Jones!results}, then the output is the item ‘Jones’ with no comma or page number, followed by two subitems, like ‘program, 50’ and ‘results, 51’.

Generate a index entry that says ‘See’ by using a vertical bar character: \index{Ackermann!function|see{P\'eter's function}}. You can instead get ‘See also’ with seealso. (The text ‘See’ is defined by \seename, and ‘See also’ by \alsoname. You can redefine these either by using an internationalization package such as babel or polyglossia, or directly as with \renewcommand{\alsoname}[1]{Also see #1}.)

The ‘See’ feature is part of a more general functionality. After the vertical bar you can put the name of a one-input command, as in \index{group|textit} (note the missing backslash on the \textit command) and the system will apply that command to the page number, here giving something like \textit{7}. You can define your own one-input commands, such as \newcommand{\definedpage}[1]{{\color{blue}#1}} and then \index{Ackermann!function|definedpage} will give a blue page number (see Color). Another, less practical, example is this,

\newcommand\indexownpage[1]{#1, \thepage}
... Epimenides.\index{self-reference|indexownpage}


which creates an entry citing the page number of its own index listing.

The two functions just described combine, as here

\index{Ackermann!function|(definedpage}
...
\index{Ackermann!function|)}


which outputs an index entry like ‘function, 23--27’ where the page number range is in blue.

Consider an index entry such as ‘α-ring’. Entering it as $\alpha$-ring will cause it to be alphabetized according to the dollar sign. You can instead enter it using an at-sign, as \index{alpha-ring@$\alpha$-ring}. If you specify an entry with an at-sign separating two strings, pos@text, then pos gives the alphabetical position of the entry while text produces the text of the entry. Another example is that \index{Saint Michael's College@SMC} produces an index entry ‘SMC’ alphabetized into a different location than its spelling would naturally give it.

To put a !, or @, or | character in an index entry, preceding it with a double quote, ". (The double quote gets deleted before alphabetization.)

A number of packages on CTAN have additional functionality beyond that provided by makeidx. One is index, which allows for multiple indices and contains a command \index*{index-entry-string} that prints the index-entry-string as well as indexing it.

The \index command writes the indexing information to the file root-name.idx file. Specifically, it writes text of the command \indexentry{index-entry-string}{page-num}, where page-num is the value of the \thepage counter. On occasion, when the \printindex command is confused, you have to delete this file to start with a fresh slate.

If you omit the closing brace of an \index command then you get a message like this.

Runaway argument?  {Ackermann!function
!  Paragraph ended before \@wrindex was complete.


Next: , Previous: , Up: Indexes   [Contents][Index]

#### 25.2.2 makeindex

Synopsis, one of:

makeindex filename
makeindex -s style-file filename
makeindex options filename0 ...


Sort, and otherwise process, the index information in the auxiliary file filename. This is a command line program. It takes one or more raw index files, filename.idx files, and produces the actual index file, the filename.ind file that is input by \printindex (see \printindex).

The first form of the command suffices for many uses. The second allows you to format the index by using an index style file, a .isty file. The third form is the most general; see the full documentation on CTAN.

This is a simple .isty file.

% book.isty
%   $makeindex -s book.isty -p odd book.idx % creates the index as book.ind, starting on an odd page. preamble "\\pagestyle{empty} \\small \\begin{theindex} \\thispagestyle{empty}" postamble "\n \\end{theindex}"  The description here covers only some of the index formatting possibilities in style-file. For a full list see the documentation on CTAN. A style file consists of a list of pairs: specifier and attribute. These can appear in the file in any order. All of the attributes are strings, except where noted. Strings are surrounded with double quotes, ", and the maximum length of a string is 144 characters. The \n is for a newline and \t is for a tab. Backslashes are escaped with another backslash, \\. If a line begins with a percent sign, %, then it is a comment. preamble Preamble of the output file. Defines the context in which the index is formatted. Default: "\\begin{theindex}\n". postamble Postamble of the output file. Default: "\n\n\\end{theindex}\n". group_skip Traditionally index items are broken into groups, typically a group for entries starting with ‘a’, etc. This specifier gives what is inserted when a new group begins. Default: "\n\n \\indexspace\n" (\indexspace is a command inserting a rubber length, by default 10pt plus5pt minus3pt). lethead_flag An integer. It governs what is inserted for a new group or letter. If it is 0 (which is the default) then other than group_skip nothing will be inserted before the group. If it is positive then at a new letter the lethead_prefix and lethead_suffix will be inserted, with that letter in uppercase between them. If it is negative then what will be inserted is the letter in lowercase. The default is 0. lethead_prefix If a new group begins with a different letter then this is the prefix inserted before the new letter header. Default: "" lethead_suffix If a group begins with a different letter then this is the suffix inserted after the new letter header. Default: "". item_0 What is put between two level 0 items. Default: "\n \\item ". item_1 Put between two level 1 items. Default: "\n \\subitem ". item_2 put between two level 2 items. Default: "\n \\subsubitem ". item_01 What is put between a level 0 item and a level 1 item. Default: "\n \\subitem ". item_x1 What is put between a level 0 item and a level 1 item in the case that the level 0 item doesn’t have any page numbers (as in \index{aaa|see{bbb}}). Default: "\n \\subitem ". item_12 What is put between a level 1 item and a level 2 item. Default: "\n \\subsubitem ". item_x2 What is put between a level 1 item and a level 2 item, if the level 1 item doesn’t have page numbers. Default: "\n \\subsubitem ". delim_0 Delimiter put between a level 0 key and its first page number. Default: a comma followed by a blank, ", ". delim_1 Delimiter put between a level 1 key and its first page number. Default: a comma followed by a blank, ", ". delim_2 Delimiter between a level 2 key and its first page number. Default: a comma followed by a blank, ", ". delim_n Delimiter between two page numbers for the same key (at any level). Default: a comma followed by a blank, ", ". delim_r What is put between the starting and ending page numbers of a range. Default: "--". line_max An integer. Maximum length of an index entry’s line in the output, beyond which the line wraps. Default: 72. indent_space What is inserted at the start of a wrapped line. Default: "\t\t". indent_length A number. The length of the wrapped line indentation. The default indent_space is two tabs and each tab is eight spaces so the default here is 16. page_precedence A document may have pages numbered in different ways. For example, a book may have front matter pages numbered in lowercase roman while main matter pages are in arabic. This string specifies the order in which they will appear in the index. The makeindex command supports five different types of numerals: lowercase roman r, and numeric or arabic n, and lowercase alphabetic a, and uppercase roman R, and uppercase alphabetic A. Default: "rnaRA". There are a number of other programs that do the job makeindex does. One is xindy (https://ctan.org/pkg/xindy), which does internationalization and can process indexes for documents marked up using LaTeX and a number of other languages. It is written in Lisp, highly configurable, both in markup terms and in terms of the collating order of the text, as described in its documentation. A more recent indexing program supporting Unicode is xindex, written in Lua (https://ctan.org/pkg/xindex). Previous: , Up: Indexes [Contents][Index] #### 25.2.3 \printindex Synopsis: \printindex  Place the index into the output. To get an index you must first include \usepackage{makeidx}\makeindex in the document preamble and compile the document, then run the system command makeindex, and then compile the document again. See Indexes, for further discussion and an example of the use of \printindex. Previous: , Up: Front/back matter [Contents][Index] ### 25.3 Glossaries Synopsis: \usepackage{glossaries} \makeglossaries ... \newglossaryentry{label}{settings} ... \gls{label}. ... \printglossaries  The glossaries package allows you to make glossaries, including multiple glossaries, as well as lists of acronyms. To get the output from this example, compile the document (for instance with pdflatex filename), then run the command line command makeglossaries filename, and then compile the document again. \documentclass{...} \usepackage{glossaries} \makeglossaries \newglossaryentry{tm}{% name={Turing machine}, description={A model of a machine that computes. The model is simple but can compute anything any existing device can compute. It is the standard model used in Computer Science.}, } \begin{document} Everything begins with the definition of a \gls{tm}. ... \printglossaries \end{document}  That gives two things. In the main text it outputs ‘... definition of a Turing machine’. In addition, in a separate sectional unit headed ‘Glossary’ there appears a description list. In boldface it says ‘Turing machine’ and the rest of the item says in normal type ‘A model of a machine … Computer Science’. The command \makeglossary opens the file that will contain the entry information, root-file.glo. Put the \printglossaries command where you want the glossaries to appear in your document. The glossaries package is very powerful. For instance, besides the commands \newglossaryentry and \gls, there are similar commands for a list of acronyms. See the package documentations on CTAN. Next: , Up: Glossaries [Contents][Index] #### 25.3.1 \newglossaryentry Synopsis, one of: \newglossaryentry{label} { name={name}, description={description}, other options, ... }  or \longnewglossaryentry{label} { name={name}, other options ..., } {description}  Declare a new entry for a glossary. The label must be unique for the document. The settings associated with the label are pairs: key=value. This puts the blackboard bold symbol for the real numbers ℝ, in the glossary. \newglossaryentry{R} { name={\ensuremath{\mathbb{R}}}, description={the real numbers}, }  Use the second command form if the description spans more than one paragraph. For a full list of keys see the package documentation on CTAN but here are a few. name (Required.) The word, phrase, or symbol that you are defining. description (Required.) The description that will appear in the glossary. If this has more than one paragraph then you must use the second command form given in the synopsis. plural The plural form of name. Refer to the plural form using \glspl or \Glspl (see \gls). sort How to place this entry in the list of entries that the glossary holds. symbol A symbol, such as a mathematical symbol, besides the name. Previous: , Up: Glossaries [Contents][Index] #### 25.3.2 \gls Synopsis, one of: \gls{label} \glspl{label} \Gls{label} \Glspl{label}  Refer to a glossary entry. The entries are declared with \newglossaryentry (see \newglossaryentry). This \newglossaryentry{N}{% name={the natural numbers}, description={The numbers$0$,$1$,$2$,$\ldots\$\@},
symbol={\ensuremath{\mathbb{N}}},
}
...
Consider \gls{N}.


gives the output ‘Consider the natural numbers’.

The second command form \glspl{label} produces the plural of name (by default it tries adding an ‘s’). The third form capitalizes the first letter of name, as does the fourth form, which also takes the plural.

Next: , Previous: , Up: Top   [Contents][Index]

## 26 Letters

Synopsis:

\documentclass{letter}
\signature{sender name}
\begin{document}
\opening{salutation}
letter body
\closing{closing text}
\end{letter}
...
\end{document}


Produce one or more letters.

Each letter is in a separate letter environment, whose argument recipient address often contains multiple lines separated with a double backslash, (\\). For example, you might have:

 \begin{letter}{Ninon de l'Enclos \\
l'h\^otel Sagonne}
...
\end{letter}


The start of the letter environment resets the page number to 1, and the footnote number to 1 also.

The sender address and sender name are common to all of the letters, whether there is one or more, so these are best put in the preamble. As with the recipient address, often sender address contains multiple lines separated by a double backslash (\\). LaTeX will put the sender name under the closing, after a vertical space for the traditional hand-written signature.

Each letter environment body begins with a required \opening command such as \opening{Dear Madam or Sir:}. The letter body text is ordinary LaTeX so it can contain everything from enumerated lists to displayed math, except that commands such as \chapter that make no sense in a letter are turned off. Each letter environment body typically ends with a \closing command such as \closing{Yours,}.

Additional material may come after the \closing. You can say who is receiving a copy of the letter with a command like \cc{the Boss \\ the Boss's Boss}. There’s a similar \encl command for a list of enclosures. And, you can add a postscript with \ps.

LaTeX’s default is to indent the sender name and the closing above it by a length of \longindentation. By default this is 0.5\textwidth. To make them flush left, put \setlength{\longindentation}{0em} in your preamble.

To set a fixed date use something like \renewcommand{\today}{1958-Oct-12}. If put in your preamble then it will apply to all the letters.

This example shows only one letter environment. The three lines marked as optional are typically omitted.

\documentclass{letter}
\signature{Sender's name \\ Sender's title}
% optional: \location{Mailbox 13}
% optional: \telephone{(102) 555-0101}
\begin{document}
\opening{Sir:}
% optional: \thispagestyle{firstpage}
I am not interested in entering a business arrangement with you.
\end{letter}
\end{document}


These commands are used with the letter class.

Next: , Up: Letters   [Contents][Index]

### 26.1 \address

Synopsis:

\address{senders address}


Specify the return address, as it appears on the letter and on the envelope. Separate multiple lines in senders address with a double backslash, \\.

Because it can apply to multiple letters this declaration is often put in the preamble. However, it can go anywhere, including inside an individual letter environment.

This command is optional: if you do not use it then the letter is formatted with some blank space on top, for copying onto pre-printed letterhead paper. If you do use the \address declaration then it is formatted as a personal letter.

Here is an example.

\address{Stephen Maturin \\
The Grapes of the Savoy}


Next: , Previous: , Up: Letters   [Contents][Index]

### 26.2 \cc

Synopsis:

\cc{name0 \\
... }


Produce a list of names to which copies of the letter were sent. This command is optional. If it appears then typically it comes after \closing. Put the names on different lines by separating them with a double backslash, \\, as in:

\cc{President \\
Vice President}


Next: , Previous: , Up: Letters   [Contents][Index]

### 26.3 \closing

Synopsis:

\closing{text}


Produce the letter’s closing. This is optional, but usual. It appears at the end of a letter, above a handwritten signature. For example:

\closing{Regards,}


Next: , Previous: , Up: Letters   [Contents][Index]

### 26.4 \encl

Synopsis:

\encl{first enclosed object \\
... }


Produce a list of things included with the letter. This command is optional; when it is used, it typically is put after \closing. Separate multiple lines with a double backslash, \\.

\encl{License \\
Passport}


Next: , Previous: , Up: Letters   [Contents][Index]

### 26.5 \location

Synopsis:

\location{text}


The text appears centered at the bottom of the page. It only appears if the page style is firstpage.

Next: , Previous: , Up: Letters   [Contents][Index]

### 26.6 \makelabels

Synopsis:

\makelabels   % in preamble


Optional, for a document that contains letter environments. If you just put \makelabels in the preamble then at the end of the document you will get a sheet with labels for all the recipients, one for each letter environment, that you can copy to a sheet of peel-off address labels.

Customize the labels by redefining the commands \startlabels, \mlabel, and \returnaddress (and perhaps \name) in the preamble. The command \startlabels sets the width, height, number of columns, etc., of the page onto which the labels are printed. The command \mlabel{return address}{recipient address} produces the two labels (or one, if you choose to ignore the return address) for each letter environment. The first argument, return address, is the value returned by the macro \returnaddress. The second argument, recipient address, is the value passed in the argument to the letter environment. By default \mlabel ignores the first argument, the return address, causing the default behavior described in the prior paragraph.

This illustrates customization. Its output includes a page with two columns having two labels each.

\documentclass{letter}
Oshkosh, Mineola 12305}
\newcommand*\originalMlabel{}
\let\originalMlabel\mlabel
\def\mlabel#1#2{\originalMlabel{}{#1}\originalMlabel{}{#2}}
\makelabels
...
\begin{document}
\begin{letter}{A Einstein \\
112 Mercer Street \\
Princeton, New Jersey, USA 08540}
...
\end{letter}
\begin{letter}{K G\"odel \\
145 Linden Lane \\
`