## Environments

LaTeX provides many environments for delimiting certain behavior. An environment begins with `\begin` and ends with `\end`, like this:

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

The environment-name at the beginning must exactly match that at the end. For instance, the input `\begin{table*}...\end{table}` will cause an error like: ‘`! LaTeX Error: \begin{table*} on input line 5 ended by \end{table}.`’

Environments are executed within a group.

### `abstract`

Synopsis:

    \begin{abstract}
    ...
    \end{abstract}

Produce an abstract, possibly of multiple paragraphs. This environment is only defined in the `article` and `report` document classes (see Document classes).

Using the example below in the `article` class produces a displayed paragraph. Document class option `titlepage` causes the abstract to be on a separate page (see Document class options); this is the default only in the `report` class.

    \begin{abstract}
      We compare all known accounts of the proposal made by Porter Alexander
      to Robert E Lee at the Appomattox Court House that the army continue
      in a guerrilla war, which Lee refused.
    \end{abstract}

The next example produces a one column abstract in a two column document (for a more flexible solution, use the package `abstract`).

    \documentclass[twocolumn]{article}
      ...
    \begin{document}
    \title{Babe Ruth as Cultural Progenitor: a Atavistic Approach}
    \author{Smith \\ Jones \\ Robinson\thanks{Railroad tracking grant.}}
    \twocolumn[
      \begin{@twocolumnfalse}
         \maketitle
         \begin{abstract}
           Ruth was not just the Sultan of Swat, he was the entire swat
           team.
         \end{abstract}
       \end{@twocolumnfalse}
       ]
    {   % by-hand insert a footnote at page bottom
     \renewcommand{\thefootnote}{\fnsymbol{footnote}}
     \footnotetext[1]{Thanks for all the fish.}
    }

### `array`

Synopsis:

    \begin{array}{cols}
      column 1 entry &column 2 entry ... &column n entry \\
      ...
    \end{array}

or:

    \begin{array}[pos]{cols}
      column 1 entry &column 2 entry ... &column n entry \\
      ...
    \end{array}

Produce a mathematical array. This environment can only be used in math mode, and normally appears within a displayed mathematics environment such as `equation` (see equation). Inside of each row the column entries are separated by an ampersand, (`&`). Rows are terminated with double-backslashes (see \\).

This example shows a three by three array.

    \begin{equation*}
      \chi(x) =
      \left|              % vertical bar fence
        \begin{array}{ccc}
          x-a  &-b  &-c  \\
          -d   &x-e &-f  \\
          -g   &-h  &x-i
        \end{array}
     \right|
    \end{equation*}

The required argument cols describes the number of columns, their alignment, and the formatting of the intercolumn regions. For instance, `\begin{array}{rcl}...\end{array}` gives three columns: the first flush right, the second centered, and the third flush left. See tabular for the complete description of cols and of the other common features of the two environments, including the optional pos argument.

There are two ways that `array` diverges from `tabular`. The first is that `array` entries are typeset in math mode, in textstyle (see Modes) except if the cols definition specifies the column with `p{...}`, which causes the entry to be typeset in text mode. The second is that, instead of `tabular`’s parameter `\tabcolsep`, LaTeX’s intercolumn space in an `array` is governed by `\arraycolsep`, which gives half the width between columns. The default for this is ‘`5pt`’ so that between two columns comes 10pt of space.

To obtain arrays with braces the standard is to use the `amsmath` package. It comes with environments `pmatrix` for an array surrounded by parentheses `(...)`, `bmatrix` for an array surrounded by square brackets `[...]`, `Bmatrix` for an array surrounded by curly braces `{...}`, `vmatrix` for an array surrounded by vertical bars `|...|`, and `Vmatrix` for an array surrounded by double vertical bars `||...||`, along with a number of other array constructs.

The next example uses the `amsmath` package.

    \usepackage{amsmath}  % in preamble

    \begin{equation}
      \begin{vmatrix}{cc}  % array with vert lines
        a  &b \\
        c  &d
      \end{vmatrix}=ad-bc
    \end{equation}

There are many packages concerning arrays. The `array` package has many useful extensions, including more column types. The `dcolumn` package adds a column type to center on a decimal point. For both see the documentation on CTAN.

### `center`

Synopsis:

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

Create a new paragraph consisting of a sequence of lines that are centered within the left and right margins. Use double-backslash, `\\`, to get a line break (see \\). If some text is too long to fit on a line then LaTeX will insert line breaks that avoid hyphenation and avoid stretching or shrinking any interword space.

This environment inserts space above and below the text body. See \centering to avoid such space, for example inside a `figure` environment.

This example produces three centered lines. There is extra vertical space between the last two lines.

    \begin{center}
      A Thesis Submitted in Partial Fufillment \\
      of the Requirements of \\[0.5ex]
      the School of Environmental Engineering
    \end{center}

In this example, depending on the page’s line width, LaTeX may choose a line break for the part before the double backslash. If so, it will center each of the two lines and if not it will center the single line. Then LaTeX will break at the double backslash, and will center the ending.

    \begin{center}
      My father considered that anyone who went to chapel and didn't drink
      alcohol was not to be tolerated.\\
      I grew up in that belief.  --Richard Burton
    \end{center}

A double backslash after the final line is optional. If present it doesn’t add any vertical space.

In a two-column document the text is centered in a column, not in the entire page.

#### `\centering`

Synopsis:

    {\centering ... }

or

    \begin{group}
      \centering ...
    \end{group}

Center the material in its scope. It is most often used inside an environment such as `figure`, or in a `parbox`.

This example’s `\centering` declaration causes the graphic to be horizontally centered.

    \begin{figure}
      \centering
      \includegraphics[width=0.6\textwidth]{ctan_lion.png}
      \caption{CTAN Lion}  \label{fig:CTANLion}
    \end{figure}

The scope of this `\centering` ends with the `\end{figure}`.

Unlike the `center` environment, the `\centering` command does not add vertical space above and below the text. That’s its advantage in the above example; there is not an excess of space.

It also does not start a new paragraph; it simply changes how LaTeX formats paragraph units. If `ww {\centering xx \\ yy} zz` is surrounded by blank lines then LaTeX will create a paragraph whose first line ‘`ww xx`’ is centered and whose second line, not centered, contains ‘`yy zz`’. Usually what is desired is for the scope of the declaration to contain a blank line or the `\end` command of an environment such as `figure` or `table` that ends the paragraph unit. Thus, if `{\centering xx \\ yy\par} zz` is surrounded by blank lines then it makes a new paragraph with two centered lines ‘`xx`’ and ‘`yy`’, followed by a new paragraph with ‘`zz`’ that is formatted as usual.

### `description`

Synopsis:

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

Environment to make a list of labeled items. Each item’s label is typeset in bold and is flush left, so that long labels continue into the first line of the item text. There must be at least one item; having none causes the LaTeX error ‘`Something's wrong--perhaps a missing \item`’.

This example shows the environment used for a sequence of definitions.

    \begin{definition}
      \item[lama] A priest.
      \item[llama] A beast.
    \end{definition}

The labels ‘`lama`’ and ‘`llama`’ are output in boldface, with the left edge on the left margin.

Start list items with the `\item` command (see \item). Use the optional labels, as in `\item[Main point]`, because there is no sensible default. Following the `\item` is optional text, which may contain multiple paragraphs.

Since the labels are in bold style, if the label text calls for a font change given in argument style (see Font styles) then it will come out bold. For instance, if the label text calls for typewriter with `\item[\texttt{label text}]` then it will appear in bold typewriter, if that is available. The simplest way around this, in this example to get non-bold typewriter, is to use declarative style: `\item[{\tt label text}]`. Similarly, get the standard roman font with `\item[{\rm label text}]`.

For other major LaTeX labelled list environments, see itemize and enumerate. Unlike those environments, nesting `description` environments does not change the default label; it is boldface and flush left at all levels.

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.

This example changes the description labels to small caps.

    \renewcommand{\descriptionlabel}[1]{%
      {\hspace{\labelsep}\textsc{#1}}}

### `displaymath`

Synopsis:

    \begin{displaymath}
      mathematical text
    \end{displaymath}

Environment to typeset the math text on its own line, in display style and centered. To make the text be flush-left use the global option `fleqn`; see Document class options.

In the `displaymath` environment no equation number is added to the math text. One way to get an equation number is to use the `equation` environment (see equation).

LaTeX will not break the math text across lines.

Note that the `amsmath` package has significantly more extensive displayed equation facilities. For example, there are a number of ways in that package for having math text broken across lines.

The construct `\[math text\]` is essentially a synonym for `\begin{displaymath}math text\end{displaymath}` but the latter is easier to work with in the source file; for instance, searching for a square bracket may get false positives but the word `displaymath` will likely be unique. (The construct `$$math text$$` from Plain TeX is sometimes mistakenly used as a synonym for `displaymath`. It is not a synonym, because the `displaymath` environment checks that it isn’t started in math mode and that it ends in math mode begun by the matching environment start, because the `displaymath` environment has different vertical spacing, and because the `displaymath` environment honors the `fleqn` option.)

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.

### `document`

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

#### `\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.

#### `\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.

### `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.

To change the format of the label use `\renewcommand` (see \newcommand & \renewcommand) on the commands `\labelenumi` through `\labelenumiv`. For instance, this first level list will be labelled with uppercase letters, in boldface, and without a trailing period.

    \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.

### `eqnarray`

The `eqnarray` environment is obsolete. It has infelicities, including spacing that is inconsistent with other mathematics elements. (See “Avoid eqnarray!” by Lars Madsen http://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*}

### `equation`

Synopsis:

    \begin{equation}
      mathematical text
    \end{equation}

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 `\begin{equation}` and `\begin{equation}`, 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.

### `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}

### `filecontents`: Write an external file

Synopsis:

    \begin{filecontents}{filename}
      text
    \end{filecontents}

or

    \begin{filecontents*}{filename}
      text
    \end{filecontents*}

Create a file named filename and fill it with text. The unstarred version of the environment `filecontents` prefixes the content of the created file with a header; see the example below. The starred version `filecontents*` does not include the header.

This environment can be used anywhere in the preamble, although it often appears before the `\documentclass` command. It is typically used when a source file requires a nonstandard style or class file. The environment will write that file to the directory containing the source and thus make the source file self-contained. Another use is to include `bib` references in the file, again to make it self-contained.

The environment checks whether a file of that name already exists and if so, does not do anything. There is a `filecontents` package that redefines the `filecontents` environment so that instead of doing nothing in that case, it will overwrite the existing file.

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}

### `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 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}

#### `\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}

### `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 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.

#### `\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.

### `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 a list that is unordered, sometimes called a bullet list. The environment must have at least one `\item`; 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}

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 it 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 optional text, which may contain multiple paragraphs.

Itemized 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 (this also uses 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. . (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`. (Note 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. 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.

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}}

### `letter` environment: writing letters

This environment is used for creating letters. See Letters.

### `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 items 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. In the ‘`book`’ and ‘`article`’ classes 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} }

#### `\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.`’.

#### `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 as 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}

### `math`

Synopsis:

    \begin{math}
    math
    \end{math}

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

### `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] 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 (what Plain TeX calls `\vcenter`).

`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 content inside the box. These are the possible values are (the default is the value of position).

`t`

  Place content 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.

    \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|l}
          \multicolumn{1}{r}{Borough} &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}

### `picture`

Synopses:

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

or

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

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

This shows 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){\line(1,1){6}}
        \put(3,3){\makebox(0,0)[r]{sum\ }}
    \end{picture}

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

    \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 `\linewidth` from the left margin, and `0.35\linewidth` up from the bottom. 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.

The `picture` environment has one required argument, a pair of numbers (width,height). Multiply these by the value `\unitlength` to get the nominal size of the output, 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 two real numbers. Multiply these by `\unitlength` to get 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 naming 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.

Coordinates are given with respect to an origin, which is normally 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.

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.

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

    \begin{picture}(3,1.5)
      \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 rectangle
      \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}

#### `\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`’.

#### `\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}

#### `\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`).

#### `\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.

#### `\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` on CTAN. Another solution is to use a full-featured graphics system such as `TikZ`, or `PSTricks`, or `MetaPost`, or `Asymptote`

#### `\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.

#### `\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.

#### `\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.

#### `\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.

#### `\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.

#### `\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)

Separate objects into lines with `\\`. These stacks are short in that, unlike in a `tabular` or `array` environment, here the rows are not spaced out to be of even heights. Thus, in `\shortstack{X\\o\\o\\X}` the first and last rows are taller than the middle two. You can adjust row heights either by putting in the usual interline spacing with `\shortstack{X\\ \strut o\\o\\X}`, or by hand, via an explicit zero-width box `\shortstack{X \\ \rule{0pt}{12pt} o\\o\\X}` or by using `\\`’s optional argument `\shortstack{X\\[2pt] o\\o\\X}`.

The `\shortstack` command is also available outside the `picture` environment.

#### `\vector`

Synopsis:

    \vector(x_run,y_rise){travel}

Draw a line ending in an arrow. The slope of that line is: 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 vectors, if (x_run,y_rise)=(0,1), then travel gives the change in y.

For an example see picture.

For elaboration on x_run and y_rise see \line. As there, the values of x_run and y_rise are limited. For `\vector` you must chooses integers between -4 and 4, inclusive. Also, the two you choose must be relatively prime. Thus, `\vector(2,1){4}` is acceptable but `\vector(4,2){4}` is not (if you use the latter then you get a sequence of arrowheads).

#### `\makebox` (picture)

Synopsis:

    \makebox(rec-width,rec-height){text}
    \makebox(rec-width,rec-height)[position]{text}

Make a box to hold text. This command fits with the `picture` environment, although you can use it outside of there, because rec-width and rec-height are numbers specifying distances in terms of the `\unitlength` (see picture). This command is similar to the normal `\makebox` command (see \mbox & \makebox) except here that you must specify the width and height. This command is fragile (see \protect).

This makes a box of length 3.5 times `\unitlength` and height 4 times `\unitlength`.

    \put(1,2){\makebox(3.5,4){...}}

The optional argument `position` specifies where in the box the text appears. The default is to center it, both horizontally and vertically. To place it somewhere else, use a string with one or two of these letters.

`t`

  Puts text the top of the box.

`b`

  Put text at the bottom.

`l`

  Put text on the left.

`r`

  Put text on the right.

#### `\framebox` (picture)

Synopsis:

    \framebox(rec-width,rec-height){text}
    \framebox(rec-width,rec-height)[position]{text}

This is the same as \makebox (picture) except that it puts a frame around the outside of the box that it creates. The reference point is the bottom left corner of the frame. This command fits with the `picture` environment, although you can use it outside of there, because lengths are numbers specifying the distance in terms of the `\unitlength` (see picture). This command is fragile (see \protect).

This example creates a frame 2.5 inches by 3 inches and puts the text in the center.

    \setlength{\unitlength}{1in}
    \framebox(2.5,3){test text}

The required arguments are that the rectangle has overall width rect-width units and height rect-height units.

The optional argument position specifies the position of text; see \makebox (picture) for the values that it can take.

The rule has thickness `\fboxrule` and there is a blank space `\fboxsep` between the frame and the contents of the box.

For this command, you must specify the width and height. If you want to just put a frame around some contents whose dimension is determined in some other way then either use `\fbox` (see \fbox & \framebox) or `\frame` (see \frame).

#### `\frame`

Synopsis:

    \frame{contents}

Puts a rectangular frame around contents. The reference point is the bottom left corner of the frame. In contrast to `\framebox` (see \framebox (picture)), this command puts no extra space is put between the frame and the object. It is fragile (see \protect).

#### `\dashbox`

Synopsis:

    \dashbox{dash-len}(rect-width,rect-height){text}
    \dashbox{dash-len}(rect-width,rect-height)[position]{text}

Create a dashed rectangle around text. This command fits with the `picture` environment, although you can use it outside of there, because lengths are numbers specifying the distance in terms of the `\unitlength` (see picture).

The required arguments are: dashes are dash-len units long, with the same length gap, and the rectangle has overall width rect-width units and height rect-height units.

The optional argument position specifies the position of text; see \makebox (picture) for the values that it can take.

This shows that you can use non-integer value for dash-len.

    \put(0,0){\dashbox{0.1}(5,0.5){My hovercraft is full of eels.}}

Each dash will be `0.1\unitlength` long, the box’s width is `5\unitlength` and its height is `0.5\unitlength`.

As in that example, a dashed box looks best when rect-width and rect-height are multiples of the dash-len.

### `quotation` & `quote`

Synopsis:

    \begin{quotation}
      text
    \end{quotation}

or

    \begin{quote}
      text
    \end{quote}

Include a quotation. Both environments indent margins on both sides by `\leftmargin` and the text is right-justified.

They differ in how they treat paragraphs. In the `quotation` environment, paragraphs are indented by 1.5em and the space between paragraphs is small, `0pt plus 1pt`. In the `quote` environment, paragraphs are not indented and there is vertical space between paragraphs (it is the rubber length `\parsep`).

    \begin{quotation} \small\it
      Four score and seven years ago
      ... shall not perish from the earth.
      \hspace{1em plus 1fill}---Abraham Lincoln
    \end{quotation}

### `tabbing`

Synopsis:

    \begin{tabbing}
    row1col1 \= row1col2 ...  \\
    row2col1 \> row2col2 ...  \\
    ...
    \end{tabbing}

Align text in columns, by setting tab stops and tabbing to them much as was done on a typewriter. This is less often used than the environments `tabular` (see tabular) or `array` (see array) because in those the width of each column need not be constant and need not be known in advance.

This example has a first line where the tab stops are set to explicit widths, ended by a `\kill` command (which is described below):

    \begin{tabbing}
    \hspace{0.75in}     \= \hspace{0.40in}  \= \hspace{0.40in}    \kill
    Ship                \> Guns             \> Year    \\
    \textit{Sophie}     \> 14               \> 1800    \\
    \textit{Polychrest} \> 24               \> 1803    \\
    \textit{Lively}     \> 38               \> 1804    \\
    \textit{Surprise}   \> 28               \> 1805    \\
    \end{tabbing}

Both the `tabbing` environment and the more widely-used `tabular` environment put text in columns. The most important distinction is that in `tabular` the width of columns is determined automatically by LaTeX, while in `tabbing` the user sets the tab stops. Another distinction is that `tabular` generates a box, but `tabbing` can be broken across pages. Finally, while `tabular` can be used in any mode, `tabbing` can be used only in paragraph mode and it starts a new paragraph.

A `tabbing` environment always starts a new paragraph, without indentation. Moreover, as shown in the example above, there is no need to use the starred form of the `\hspace` command at the beginning of a tabbed row. The right margin of the `tabbing` environment is the end of line, so that the width of the environment is `\linewidth`.

The `tabbing` environment contains a sequence of tabbed rows. The first tabbed row begins immediately after `\begin{tabbing}` and each row ends with `\\` or `\kill`. The last row may omit the `\\` and end with just `\end{tabbing}`.

At any point the `tabbing` environment has a current tab stop pattern, a sequence of n > 0 tab stops, numbered 0, 1, etc. These create n corresponding columns. Tab stop 0 is always the left margin, defined by the enclosing environment. Tab stop number i is set if it is assigned a horizontal position on the page. Tab stop number i can only be set if all the stops 0, …, i-1 have already been set; normally later stops are to the right of earlier ones.

By default any text typeset in a `tabbing` environment is typeset ragged right and left-aligned on the current tab stop. Typesetting is done in LR mode (see Modes).

The following commands can be used inside a `tabbing` environment. They are all fragile (see \protect).

`\\ (tabbing)`

  End a tabbed line and typeset it.

`\= (tabbing)`

  Sets a tab stop at the current position.

`\> (tabbing)`

  Advances to the next tab stop.

`\<`

  Put following text to the left of the local margin (without changing the margin). Can only be used at the start of the line.

`\+`

  Moves the left margin of the next and all the following commands one tab stop to the right, beginning tabbed line if necessary.

`\-`

  Moves the left margin of the next and all the following commands one tab stop to the left, beginning tabbed line if necessary.

`\' (tabbing)`

  Moves everything that you have typed so far in the current column, i.e., everything from the most recent `\>`, `\<`, `\'`, `\\`, or `\kill` command, to the previous column and aligned to the right, flush against the current column’s tab stop.

`\` (tabbing)`

  Allows you to put text flush right against any tab stop, including tab stop 0. However, it can’t move text to the right of the last column because there’s no tab stop there. The `\`` command moves all the text that follows it, up to the `\\` or `\end{tabbing}` command that ends the line, to the right margin of the `tabbing` environment. There must be no `\>` or `\'` command between the `\`` and the `\\` or `\end{tabbing}` command that ends the line.

`\a (tabbing)`

  In a `tabbing` environment, the commands `\=`, `\'` and `\`` do not produce accents as usual (see Accents). Instead, use the commands `\a=`, `\a'` and `\a``.

`\kill`

  Sets tab stops without producing text. Works just like `\\` except that it throws away the current line instead of producing output for it. Any `\=`, `\+` or `\-` commands in that line remain in effect.

`\poptabs`

  Restores the tab stop positions saved by the last `\pushtabs`.

`\pushtabs`

  Saves all current tab stop positions. Useful for temporarily changing tab stop positions in the middle of a `tabbing` environment.

`\tabbingsep`

  Distance of the text moved by `\'` to left of current tab stop.

This example typesets a Pascal function:

    \begin{tabbing}
    function \= fact(n : integer) : integer;\\
             \> begin \= \+ \\
                   \> if \= n > 1 then \+ \\
                            fact := n * fact(n-1) \- \\
                      else \+ \\
                            fact := 1; \-\- \\
                end;\\
    \end{tabbing}

The output looks like this.

    function fact(n : integer) : integer;
             begin
                   if n > 1 then
                      fact := n * fact(n-1);
                   else
                      fact := 1;
             end;

This example is just for illustration of the environment. To actually typeset computer code in typewriter like this, a verbatim environment (see verbatim) would normally be best. For pretty-printed code, there are quite a few packages, including `algorithm2e`, `fancyvrb`, `listings`, and `minted`.

### `table`

Synopsis:

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

A class of floats (see Floats). They cannot be split across pages and so they are not typeset in sequence with the normal text but instead are floated to a convenient place, such as the top of a following page.

This example `table` environment contains a `tabular`

    \begin{table}
      \centering\small
      \begin{tabular}{ll}
        \multicolumn{1}{c}{\textit{Author}}
          &\multicolumn{1}{c}{\textit{Piece}}  \\ \hline
        Bach            &Cello Suite Number 1  \\
        Beethoven       &Cello Sonata Number 3 \\
        Brahms          &Cello Sonata Number 1
      \end{tabular}
      \caption{Top cello pieces}
      \label{tab:cello}
    \end{table}

but you can put many different kinds of content in a `table`, including text, LaTeX commands, etc.

For the possible values of placement and their effect on the float placement algorithm, see Floats.

The table body is typeset in a `parbox` of width `\textwidth`. It can contain text, commands, graphics, etc.

The label is optional; it is used for cross references (see Cross references). The `\caption` command is also optional. It specifies caption text for the table. By default it is numbered. If its optional lottitle is present then that text is used in the list of tables instead of title (see Table of contents etc.).

In this example the table and caption will float to the bottom of a page, unless it is pushed to a float page at the end.

    \begin{table}[b]
      \centering
      \begin{tabular}{r|p{2in}} \hline
        One &The loneliest number \\
        Two &Can be as sad as one.
             It's the loneliest number since the number one.
      \end{tabular}
      \caption{Cardinal virtues}
      \label{tab:CardinalVirtues}
    \end{table}

### `tabular`

Synopsis:

    \begin{tabular}[pos]{cols}
      column 1 entry  &column 2 entry  ...  &column n entry \\
      ...
    \end{tabular}

or

    \begin{tabular*}{width}[pos]{cols}
      column 1 entry  &column 2 entry  ...  &column n entry \\
      ...
    \end{tabular*}

Produce a table, a box consisting of a sequence of horizontal rows. Each row consists of items that are aligned vertically in columns. This illustrates many of the features.

    \begin{tabular}{l|l}
      \textit{Player name}  &\textit{Career home runs}  \\
      \hline
      Hank Aaron  &755 \\
      Babe Ruth   &714
    \end{tabular}

The output will have two left-aligned columns with a vertical bar between them. This is specified in `tabular`’s argument `{l|l}`. Put the entries into different columns by separating them with an ampersand, `&`. The end of each row is marked with a double backslash, `\\`. Put a horizontal rule below a row, after a double backslash, with `\hline`. After the last row the `\\` is optional, unless an `\hline` command follows to put a rule below the table.

The required and optional arguments to `tabular` consist of:

pos

  Optional. Specifies the table’s vertical position. The default is to align the table so its vertical center matches the baseline of the surrounding text. There are two other possible alignments: `t` aligns the table so its top row matches the baseline of the surrounding text, and `b` aligns on the bottom row.

  This only has an effect if there is other text. In the common case of a `tabular` alone in a `center` environment this option makes no difference.

cols

  Required. Specifies the formatting of columns. It consists of a sequence of the following specifiers, corresponding to the types of column and intercolumn material.

  `l`

    A column of left-aligned items.

  `r`

    A column of right-aligned items.

  `c`

    A column of centered items.

  `|`

    A vertical line the full height and depth of the environment.

  `@{text or space}`

    Insert text or space at this location in every row. The text or space material is typeset in LR mode. This text is fragile (see \protect).

    If between two columns there is no @-expression then LaTeX’s `book`, `article`, and `report` classes will put on either side of each column a space of length `\tabcolsep`, which by default is 6pt. That is, by default adjacent columns are separated by 12pt (so `\tabcolsep` is misleadingly named since it is only half of the separation between tabular columns). In addition, a space of 6pt also comes before the first column and after the final column, unless you put a `@{...}` or `|` there.

    If you override the default and use an @-expression then LaTeX does not insert `\tabcolsep` so you must insert any desired space yourself, as in `@{\hspace{1em}}`.

    An empty expression `@{}` will eliminate the space. In particular, sometimes you want to eliminate the space before the first column or after the last one, as in the example below where the tabular lines need to lie on the left margin.

        \begin{flushleft}
          \begin{tabular}{@{}l}
            ...
          \end{tabular}
        \end{flushleft}

    The next example shows text, a decimal point between the columns, arranged so the numbers in the table are aligned on it.

        \begin{tabular}{r@{$.$}l}
          $3$ &$14$  \\
          $9$ &$80665$
        \end{tabular}

    An `\extracolsep{wd}` command in an @-expression causes an extra space of width wd to appear to the left of all subsequent columns, until countermanded by another `\extracolsep`. Unlike ordinary intercolumn space, this extra space is not suppressed by an @-expression. An `\extracolsep` command can be used only in an @-expression in the `cols` argument. Below, LaTeX inserts the right amount of intercolumn space to make the entire table 4 inches wide.

        \begin{tabular*}{4in}{l@{\extracolsep{\fill}}l}
          Seven times down, eight times up \ldots
          &such is life!
        \end{tabular*}

    To insert commands that are automatically executed before a given column, load the `array` package and use the `>{...}` specifier.

  `p{wd}`

    Each item in the column is typeset in a parbox of width wd, as if it were the argument of a `\parbox[t]{wd}{...}` command.

    A line break double backslash `\\` may not appear in the item, except inside an environment like `minipage`, `array`, or `tabular`, or inside an explicit `\parbox`, or in the scope of a `\centering`, `\raggedright`, or `\raggedleft` declaration (when used in a `p`-column element these declarations must appear inside braces, as with `{\centering .. \\ ..}`). Otherwise LaTeX will misinterpret the double backslash as ending the row. Instead, to get a line break in there use `\newline` (see \newline).

  `*{num}{cols}`

    Equivalent to num copies of cols, where num is a positive integer and cols is a list of specifiers. Thus the specifier `\begin{tabular}{|*{3}{l|r}|}` is equivalent to the specifier `\begin{tabular}{|l|rl|rl|r|}`. Note that cols may contain another `*`-expression.

width

  Required for `tabular*`, not allowed for `tabular`. Specifies the width of the `tabular*` environment. The space between columns should be rubber, as with `@{\extracolsep{\fill}}`, to allow the table to stretch or shrink to make the specified width, or else you are likely to get the `Underfull \hbox (badness 10000) in alignment ...` warning.

Parameters that control formatting:

`\arrayrulewidth`

  A length that is the thickness of the rule created by `|`, `\hline`, and `\vline` in the `tabular` and `array` environments. The default is ‘`.4pt`’. Change it as in `\setlength{\arrayrulewidth}{0.8pt}`.

`\arraystretch`

  A factor by which the spacing between rows in the `tabular` and `array` environments is multiplied. The default is ‘`1`’, for no scaling. Change it as `\renewcommand{\arraystretch}{1.2}`.

`\doublerulesep`

  A length that is the distance between the vertical rules produced by the `||` specifier. The default is ‘`2pt`’.

`\tabcolsep`

  A length that is half of the space between columns. The default is ‘`6pt`’. Change it with `\setlength`.

The following commands can be used inside the body of a `tabular` environment, the first two inside an entry and the second two between lines:

#### `\multicolumn`

Synopsis:

    \multicolumn{numcols}{cols}{text}

Make an `array` or `tabular` entry that spans several columns. The first argument numcols gives the number of columns to span. The second argument cols specifies the formatting of the entry, with `c` for centered, `l` for flush left, or `r` for flush right. The third argument text gives the contents of that entry.

In this example, in the first row, the second and third columns are spanned by the single heading ‘`Name`’.

    \begin{tabular}{lccl}
      \textit{ID}       &\multicolumn{2}{c}{\textit{Name}} &\textit{Age} \\
      \hline
      978-0-393-03701-2 &O'Brian &Patrick                  &55           \\
        ...
    \end{tabular}

What counts as a column is: the column format specifier for the `array` or `tabular` environment is broken into parts, where each part (except the first) begins with `l`, `c`, `r`, or `p`. So from `\begin{tabular}{|r|ccp{1.5in}|}` the parts are `|r|`, `c`, `c`, and `p{1.5in}|`.

The cols argument overrides the `array` or `tabular` environment’s intercolumn area default adjoining this multicolumn entry. To affect that area, this argument can contain vertical bars `|` indicating the placement of vertical rules, and `@{...}` expressions. Thus if cols is ‘`|c|`’ then this multicolumn entry will be centered and a vertical rule will come in the intercolumn area before it and after it. This table details the exact behavior.

    \begin{tabular}{|cc|c|c|}
      \multicolumn{1}{r}{w}       % entry one
        &\multicolumn{1}{|r|}{x}  % entry two
        &\multicolumn{1}{|r}{y}   % entry three
        &z                        % entry four
    \end{tabular}

Before the first entry the output will not have a vertical rule because the `\multicolumn` has the cols specifier ‘`r`’ with no initial vertical bar. Between entry one and entry two there will be a vertical rule; although the first cols does not have an ending vertical bar, the second cols does have a starting one. Between entry two and entry three there is a single vertical rule; despite that the cols in both of the surrounding `multicolumn`’s call for a vertical rule, you only get one rule. Between entry three and entry four there is no vertical rule; the default calls for one but the cols in the entry three `\multicolumn` leaves it out, and that takes precedence. Finally, following entry four there is a vertical rule because of the default.

The number of spanned columns numcols can be 1. Besides giving the ability to change the horizontal alignment, this also is useful to override for one row the `tabular` definition’s default intercolumn area specification, including the placement of vertical rules.

In the example below, in the `tabular` definition the first column is specified to default to left justified but in the first row the entry is centered with `\multicolumn{1}{c}{\textsc{Period}}`. Also in the first row, the second and third columns are spanned by a single entry with `\multicolumn{2}{c}{\textsc{Span}}`, overriding the specification to center those two columns on the page range en-dash.

    \begin{tabular}{l|r@{--}l}
      \multicolumn{1}{c}{\textsc{Period}}
        &multicolumn{2}{c}{\textsc{Span}} \\ \hline
      Baroque          &1600           &1760         \\
      Classical        &1730           &1820         \\
      Romantic         &1780           &1910         \\
      Impressionistic  &1875           &1925
    \end{tabular}

Although the `tabular` specification by default puts a vertical rule between the first and second columns, no such vertical rule appears in the first row here. That’s because there is no vertical bar in the cols part of the first row’s first `\multicolumn` command.

#### `\vline`

Draw a vertical line in a `tabular` or `array` environment extending the full height and depth of an entry’s row. Can also be used in an @-expression, although its synonym vertical bar `|` is more common. This command is rarely used in the body of a table; typically a table’s vertical lines are specified in `tabular`’s cols argument and overridden as needed with `\multicolumn` (see tabular).

The example below illustrates some pitfalls. In the first row’s second entry the `\hfill` moves the `\vline` to the left edge of the cell. But that is different than putting it halfway between the two columns, so between the first and second columns there are two vertical rules, with the one from the `{c|cc}` specifier coming before the one produced by the `\vline\hfill`. In contrast, the first row’s third entry shows the usual way to put a vertical bar between two columns. In the second row, the `ghi` is the widest entry in its column so in the `\vline\hfill` the `\hfill` has no effect and the vertical line in that entry appears immediately next to the `g`, with no whitespace.

    \begin{tabular}{c|cc}
      x   &\vline\hfill y   &\multicolumn{1}{|r}{z} \\ % row 1
      abc &def &\vline\hfill ghi                       % row 2
    \end{tabular}

#### `\cline`

Synopsis:

    \cline{i-j}

In an `array` or `tabular` environment, draw a horizontal rule beginning in column i and ending in column j. The dash, `-`, must appear in the mandatory argument. To span a single column use the number twice, as with `\cline{2-2}`.

This example puts two horizontal lines between the first and second rows, one line in the first column only, and the other spanning the third and fourth columns. The two lines are side-by-side, at the same height.

    \begin{tabular}{llrr}
      a &b &c &d \\ \cline{1-1} \cline{3-4}
      e &f &g &h
    \end{tabular}

#### `\hline`

Draw a horizontal line the width of the enclosing `tabular` or `array` environment. It’s most commonly used to draw a line at the top, bottom, and between the rows of a table.

In this example the top of the table has two horizontal rules, one above the other, that span both columns. The bottom of the table has a single rule spanning both columns. Because of the `\hline`, the `tabular` second row’s line ending double backslash `\\` is required.

    \begin{tabular}{ll} \hline\hline
      Baseball   &Red Sox  \\
      Basketball &Celtics  \\ \hline
    \end{tabular}

### `thebibliography`

Synopsis:

    \begin{thebibliography}{widest-label}
      \bibitem[label]{cite_key}
      ...
    \end{thebibliography}

Produce a bibliography or reference list. There are two ways to produce bibliographic lists. This environment is suitable when you have only a few references and can maintain the list by hand. See Using BibTeX for a more sophisticated approach.

This shows the environment with two entries.

    This work is based on \cite{latexdps}.
    Together they are \cite{latexdps, texbook}.
      ...
    \begin{thebibliography}{9}
    \bibitem{latexdps}
      Leslie Lamport.
      \textit{\LaTeX{}: a document preparation system}.
      Addison-Wesley, Reading, Massachusetts, 1993.
    \bibitem{texbook}
      Donald Ervin Knuth.
      \textit{The \TeX book}.
      Addison-Wesley, Reading, Massachusetts, 1983.
    \end{thebibliography}

This styles the first reference as ‘`[1] Leslie ...`’, and so that `\cite{latexdps}` produces the matching ‘`... based on [1]`’. The second `\cite` produces ‘`[1, 2]`’. You must compile the document twice to resolve these references.

The mandatory argument widest-label is text that, when typeset, is as wide as the widest item label produced by the `\bibitem` commands. The tradition is to use `9` for bibliographies with less than 10 references, `99` for ones with less than 100, etc.

The bibliographic list is headed by a title such as ‘`Bibliography`’. To change it there are two cases. In the `book` and `report` classes, where the top level sectioning is `\chapter` and the default title is ‘`Bibliography`’, that title is in the macro `\bibname`. For `article`, where the class’s top level sectioning is `\section` and the default is ‘`References`’, the title is in macro `\refname`. Change it by redefining the command, as with `\renewcommand{\refname}{Cited references}` after `\begin{document}`.

Language support packages such as `babel` will automatically redefine `\refname` or `\bibname` to fit the selected language.

#### `\bibitem`

Synopsis:

    \bibitem{cite_key}

or

    \bibitem[label]{cite_key}

Generate an entry labeled by label. The default is for LaTeX to generates a number using the `enumi` counter. The citation key cite_key is a string of letters, numbers, and punctuation symbols (but not comma).

See thebibliography for an example.

The optional label changes the default label from an integer to the given string. With this

    \begin{thebibliography}
    \bibitem[Lamport 1993]{latexdps}
      Leslie Lamport.
      \textit{\LaTeX{}: a document preparation system}.
      Addison-Wesley, Reading, Massachusetts, 1993.
    \bibitem{texbook}
      Donald Ervin Knuth.
      \textit{The \TeX book}.
      Addison-Wesley, Reading, Massachusetts, 1983.
    \end{thebibliography}

the first entry will be styled as ‘`[Lamport 1993] Leslie ...`’ (The amount of horizontal space that LaTeX leaves for the label depends on the widest-label argument of the `thebibliography` environment; see thebibliography.) Similarly, `... based on \cite{latexdps}` will produce ‘`... based on [Lamport 1994]`’.

If you mix `\bibitem` entries having a label with those that do not then LaTeX will number the unlabelled ones sequentially. In the example above the `texbook` entry will appear as ‘`[1] Donald ...`’, despite that it is the second entry.

If you use the same cite_key twice then you get ‘`LaTeX Warning: There were multiply-defined labels`’.

Under the hood, LaTeX remembers the cite_key and label information because `\bibitem` writes it to the auxiliary file `filename.aux`. For instance, the above example causes `\bibcite{latexdps}{Lamport, 1993}` and `\bibcite{texbook}{1}` to appear in that file. The `.aux` file is read by the `\begin{document}` command and then the information is available for `\cite` commands. This explains why you need to run LaTeX twice to resolve references: once to write it out and once to read it in.

Because of this two-pass algorithm, when you add a `\bibitem` or change its cite_key you may get ‘`LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right`’. Fix it by recompiling.

#### `\cite`

Synopsis:

    \cite{keys}

or

    \cite[subcite]{keys}

Generate as output a citation to the references associated with keys. The mandatory keys is a citation key, or a comma-separated list of citation keys (see \bibitem).

This

    The ultimate source is \cite{texbook}.
      ...
    \begin{thebibliography}
    \bibitem{texbook}
      Donald Ervin Knuth.
      \textit{The \TeX book}.
      Addison-Wesley, Reading, Massachusetts, 1983.
    \end{thebibliography}

produces output like ‘`... source is [1]`’. (You can change the appearance of the citation with bibliography styles. More is in Using BibTeX.)

The optional argument subcite is appended to the citation. For example, `See 14.3 in \cite[p.~314]{texbook}` might produce ‘`See 14.3 in [1, p. 314]`’.

In addition to what appears in the output, `\cite` writes information to the auxiliary file `filename.aux`. For instance, `\cite{latexdps}` writes ‘`\citation{latexdps}`’ to that file. This information is used by BibTeX to include in your reference list only those works that you have actually cited; see \nocite also.

If keys is not in your bibliography information then you get ‘`LaTeX Warning: There were undefined references`’, and in the output the citation shows as a boldface question mark between square brackets. There are two possible causes. If you have mistyped something, as in `\cite{texbok}` then you need to correct the spelling. On the other hand, if you have just added or modified the bibliographic information and so changed the `.aux` file (see \bibitem) then the fix may be to run LaTeX again.

#### `\nocite`

Synopsis:

    \nocite{keys}

Produces no output but writes keys to the auxiliary file `doc-filename.aux`.

The mandatory argument keys is a comma-separated list of one or more citation keys (see \bibitem). This information is used by BibTeX to include these works in your reference list even though you have not cited them (see \cite).

#### Using BibTeX

As described in `thebibliography` (see thebibliography), a sophisticated approach to managing bibliographies is provided by the BibTeX program. This is only an introduction; see the full documentation on CTAN.

With BibTeX, you don’t use `thebibliography` (see thebibliography). Instead, include these lines.

    \bibliographystyle{bibstyle}
    \bibliography{bibfile1, bibfile2, ...}

The bibstyle refers to a file `bibstyle.bst`, which defines how your citations will look. The standard bibstyle’s distributed with BibTeX are:

`alpha`

  Labels are formed from name of author and year of publication. The bibliographic items are sorted alphabetically.

`plain`

  Labels are integers. Sort the bibliographic items alphabetically.

`unsrt`

  Like `plain`, but entries are in order of citation.

`abbrv`

  Like `plain`, but more compact labels.

Many, many other BibTeX style files exist, tailored to the demands of various publications. See CTAN’s listing http://mirror.ctan.org/biblio/bibtex/contrib.

The `\bibliography` command is what actually produces the bibliography. Its argument is a comma-separated list, referring to files named `bibfile1.bib`, `bibfile2.bib`, … These contain your database in BibTeX format. This shows a typical couple of entries in that format.

    @book{texbook,
      title     = {The {{\TeX}}book},
      author    = {D.E. Knuth},
      isbn      = {0201134489},
      series    = {Computers \& typesetting},
      year      = {1983},
      publisher = {Addison-Wesley}
    }
    @book{sexbook,
        author    = {W.H. Masters and V.E. Johnson},
        title     = {Human Sexual Response},
        year      = {1966},
        publisher = {Bantam Books}
    }

Only the bibliographic entries referred to via `\cite` and `\nocite` will be listed in the document’s bibliography. Thus you can keep all your sources together in one file, or a small number of files, and rely on BibTeX to include in this document only those that you used.

### `theorem`

Synopsis:

    \begin{theorem}
      theorem body
    \end{theorem}

Produces ‘`Theorem n`’ in boldface followed by theorem body in italics. The numbering possibilities for n are described under `\newtheorem` (see \newtheorem).

    \newtheorem{lem}{Lemma}      % in preamble
    \newtheorem{thm}{Theorem}
      ...
    \begin{lem}                  % in  document body
      text of lemma
    \end{lem}

    The next result follows immediately.
    \begin{thm}[Gauss]   %  put `Gauss' in parens after theorem head
      text of theorem
    \end{thm}

Most new documents use the packages `amsthm` and `amsmath` from the American Mathematical Society. Among other things these packages include a large number of options for theorem environments, such as styling options.

### `titlepage`

Synopsis:

    \begin{titlepage}
      ... text and spacing ...
    \end{titlepage}

Create a title page, a page with no printed page number or heading and with succeeding pages numbered starting with page one.

In this example all formatting, including vertical spacing, is left to the author.

    \begin{titlepage}
    \vspace*{\stretch{1}}
    \begin{center}
      {\huge\bfseries Thesis \\[1ex]
                      title}                  \\[6.5ex]
      {\large\bfseries Author name}           \\
      \vspace{4ex}
      Thesis  submitted to                    \\[5pt]
      \textit{University name}                \\[2cm]
      in partial fulfilment for the award of the degree of \\[2cm]
      \textsc{\Large Doctor of Philosophy}    \\[2ex]
      \textsc{\large Mathematics}             \\[12ex]
      \vfill
      Department of Mathematics               \\
      Address                                 \\
      \vfill
      \today
    \end{center}
    \vspace{\stretch{2}}
    \end{titlepage}

To instead produce a standard title page without a `titlepage` environment, use `\maketitle` (see \maketitle).

### `verbatim`

Synopsis:

    \begin{verbatim}
    literal-text
    \end{verbatim}

A paragraph-making environment in which LaTeX produces as output exactly what you type as input. For instance inside literal-text the backslash `\` character does not start commands, it produces a printed ‘`\`’, and carriage returns and blanks are taken literally. The output appears in a monospaced typewriter-like font (`\tt`).

    \begin{verbatim}
    Symbol swearing: %&$#?!.
    \end{verbatim}

The only restriction on `literal-text` is that it cannot include the string `\end{verbatim}`.

You cannot use the verbatim environment in the argument to macros, for instance in the argument to a `\section`. This is not the same as commands being fragile (see \protect), instead it just cannot appear there. (But the `cprotect` package can help with this.)

One common use of verbatim input is to typeset computer code. There are packages that are an improvement the `verbatim` environment. For instance, one improvement is to allow the verbatim inclusion of external files, or parts of those files. Such packages include `listings`, and `minted`.

A package that provides many more options for verbatim environments is `fancyvrb`. Another is `verbatimbox`.

For a list of all the relevant packages, see CTAN.

#### `\verb`

Synopsis:

    \verb char literal-text char
    \verb* char literal-text char

Typeset literal-text as it is input, including special characters and spaces, using the typewriter (`\tt`) font.

This example shows two different invocations of `\verb`.

    This is \verb!literally! the biggest pumpkin ever.
    And this is the best squash, \verb+literally!+

The first `\verb` has its literal-text surrounded with exclamation point, `!`. The second instead uses plus, `+`, because the exclamation point is part of `literal-text`.

The single-character delimiter char surrounds literal-text — it must be the same character before and after. No spaces come between `\verb` or `\verb*` and char, or between char and literal-text, or between literal-text and the second occurrence of char (the synopsis shows a space only to distinguish one component from the other). The delimiter must not appear in literal-text. The literal-text cannot include a line break.

The `*`-form differs only in that spaces are printed with a visible space character.

The output from this will include a character showing the spaces.

    The commands's first argument is \verb*!filename with extension! and ...

For typesetting Internet addresses, urls, the package `url` provides an option that is better than the `\verb` command, since it allows line breaks.

For computer code there are many packages with advantages over `\verb`. One is `listings`, another is `minted`.

You cannot use `\verb` in the argument to a macro, for instance in the argument to a `\section`. It is not a question of `\verb` being fragile (see \protect), instead it just cannot appear there. (But the `cprotect` package can help with this.)

### `verse`

Synopsis:

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

An environment for poetry.

Here are two lines from Shakespeare’s Romeo and Juliet.

    Then plainly know my heart's dear love is set \\
    On the fair daughter of rich Capulet.

Separate the lines of each stanza with `\\`, and use one or more blank lines to separate the stanzas.

    \begin{verse}
    \makebox[\linewidth][c]{\textit{Shut Not Your Doors} ---Walt Whitman}
      \\[1\baselineskip]
    Shut not your doors to me proud libraries,                  \\
    For that which was lacking on all your well-fill'd shelves, \\
    \qquad yet needed most, I bring,                             \\
    Forth from the war emerging, a book I have made,            \\
    The words of my book nothing, the drift of it every thing,  \\
    A book separate, not link'd with the rest nor felt by the intellect, \\
    But you ye untold latencies will thrill to every page.
    \end{verse}

The output has margins indented on the left and the right, paragraphs are not indented, and the text is not right-justified.