Using the amsthm Package

Version 2.07, 2000/06/02 American Mathematical Society

1 Introduction

The amsthm package provides an enhanced version of L^{A}TEX’s \newtheorem command for defining theorem-like environments. The amsthm version of the \newtheorem command recognizes a \theoremstyle specification (as in Mittelbach’s theorem package) and has a * form for defining unnumbered environments. The amsthm package also defines a proof environment that automatically adds a Q.E.D. symbol at the end. AMS document classes incorporate the amsthm package, so everything described here applies to them as well. A number of examples are given in the file thmtest.tex.

2 The \newtheorem command

In mathematical research articles and books, theorems and proofs are among the most common elements, but authors also use many others that fall in the same general class: lemmas, propositions, axioms, corollaries, conjectures, definitions, remarks,, cases, steps, and so forth. As these elements form a slice of the text stream with welldefined boundaries, they are naturally handled in L^{A}TEX as environments. But L^{A}TEX document classes normally do not provide predefined environments for theorem-like elements because (a) that would make it difficult for authors to exercise the necessary control over the automatic numbering, and (b) the variety of such elements is so wide that it’s just not possible for a document class to provide every one that will ever be needed. Instead there is a command \newtheorem, similar to \newenvironment in effect, that makes it easy for authors to set up the elements required for a particular document.

The \newtheorem command has two mandatory arguments; the first one is the environment name that the author would like to use for this element; the second one is the heading text. For example,

\newtheorem{lem}{Lemma}

means that instances in the document of

\begin{lem} Text text ... \end{lem}

will produce

Lemma 1. Text text …

where the heading consists of the specified text “Lemma” and an automatically generated number and punctuation.

If \newtheorem* is used instead of \newtheorem in the above example, there will not be any automatic numbers generated for any of the lemmas in the document. This form of the command can be useful if you have only one lemma and don’t want it to be numbered; more often, though, it is used to produce a special named variant of one of the common theorem types. For example, if you have a lemma whose name should be “Klein’s Lemma” instead of “Lemma” + number, then the statement

\newtheorem*{KL}{Klein's Lemma}

would allow you to write

\begin{KL} Text text ... \end{KL}

and get the desired output.

3 Numbering modifications

In addition to the two mandatory arguments, \newtheorem has two mutually exclusive optional arguments. These affect the sequencing and hierarchy of the numbering.

By default each kind of theorem-like environment is numbered independently. Thus if you have three lemmas and two theorems interspersed, they will be numbered something like this: Lemma 1, Lemma 2, Theorem 1, Lemma 3, Theorem 2. If you want lemmas and theorems to share the same numbering sequence—Lemma 1, Lemma 2, Theorem 3, Lemma 4, Theorem 5—then you should indicate the desired relationship as follows:

\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}

The optional argument [thm] in the second statement means that the lem environment should share the thm numbering sequence instead of having its own independent sequence.

To have a theorem environment numbered subordinately within a sectional unit— e.g., to get propositions numbered Proposition 2.1, Proposition 2.2, and so on in Section 2—put the name of the parent unit in square brackets in final position:

\newtheorem{prop}{Proposition}[section]

With the optional argument [section], the prop counter will be reset to 0 whenever the parent counter section is incremented.

4 Changing styles for theorem-like environments

4.1 The \theoremstyle command

The amsthm package supports the notion of a current theorem style, which determines what will be produced by a given \newtheorem command. The three theorem styles provided—plain, definition, and remark—receive different typographical treatment that gives them visual emphasis corresponding to their relative importance. The details of this typographical treatment may vary depending on the document class, but typically the plain style produces italic body text, while the other two styles produce roman body text.

To create new theorem-like environments in the different styles, divide your \newtheorem commands into groups and preface each group with the appropriate \theoremstyle. If no \theoremstyle command is given, the style used will be plain. Some examples:

\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\newtheorem*{KL}{Klein's Lemma}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}

4.2 Number swapping

A not uncommon style variation for theorem heads is to have the theorem number on the left, at the beginning of the heading, instead of on the right. As this variation is usually applied across the board regardless of individual \theoremstyle changes, number-swapping is done by placing a \swapnumbers command at the beginning of the list of \newtheorem statements that should be affected. For example:

\swapnumbers
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\theoremstyle{remark}
\newtheorem{rem}{Remark}

When the amsthm package is used with one of the generic L^{A}TEX document classes such as article or book, the result of the above declarations will be to have theorem and remark heads printed in the form 1.4 Theorem, 9.1 Remark. With other document classes the appearance may be different.

4.3 Further customization possibilities

More extensive customization capabilities are provided by the amsthm package in the form of a \newtheoremstyle command and a mechanism for using package options to load custom theoremstyle definitions. As these capabilities are somewhat beyond the needs of the average user, discussion of the details is consigned to the example file

thmtest.tex and to the commentary in amsclass.dtx.

5 Proofs

A predefined proof environment provided by the amsthm package produces the heading “Proof” with appropriate spacing and punctuation. The proof environment is primarily intended for short proofs, no more than a page or two in length; longer proofs are usually better done as a separate \section or \subsection in your document.

An optional argument of the proof environment allows you to substitute a different name for the standard “Proof”. If you want the proof heading to be, say, “Proof of the Main Theorem”, then write

\begin{proof}[Proof of the Main Theorem]

A “QED” symbol, , is automatically appended at the end of a proof environment. To substitute a different end-of-proof symbol, use \renewcommand to redefine the command \qedsymbol. For a long proof done as a subsection or section instead of with the proof environment, you can obtain the symbol and the usual amount of preceding space by using \qed.

Placement of the QED symbol can be problematic if the last part of a proof environment is a displayed equation or list environment or something of that nature. In that case put a \qedhere command at the place where the QED symbol should appear.

\begin{proof}
...
\begin{equation}
G(t)=L\gamma!\,t^{-\gamma}+t^{-\delta}\eta(t) \qedhere
\end{equation}
\end{proof}

If the amsthm package is used with a non-AMS documentclass and with the amsmath package, amsthm must be loaded after amsmath, not before.^{1} If \qedhere produces an error message in an equation, try using \mbox{\qedhere} instead.

1The right-margin positioning done by \qedhere in displayed equations works only with version 2 of the amsmath package, not with earlier versions.