%%% ====================================================================
%%% @LaTeX-file{
%%%   filename  = "amsthdoc.tex",
%%%   version   = "2.04",
%%%   date      = "2000/06/06",
%%%   time      = "11:42:29 EDT",
%%%   checksum  = "45213 291 1500 12328",
%%%   author    = "American Mathematical Society",
%%%   address   = "American Mathematical Society,
%%%                Technical Support,
%%%                Electronic Products and Services,
%%%                P. O. Box 6248,
%%%                Providence, RI 02940,
%%%                USA",
%%%   telephone = "401-455-4080 or (in the USA and Canada)
%%%                800-321-4AMS (321-4267)",
%%%   FAX       = "401-331-3842",
%%%   email     = "tech-support@ams.org (Internet)",
%%%   copyright = "Copyright 1999, 2000 American Mathematical Society,
%%%                all rights reserved.  Copying of this file is
%%%                authorized only if either:
%%%                (1) you make absolutely no changes to your copy,
%%%                including name; OR
%%%                (2) if you do make changes, you first rename it
%%%                to some other name.",
%%%   supported = "yes",
%%%   keywords  = "latex, theorem, proof, amsthm",
%%%   abstract  = "This file is the User's Guide for the amsthm
%%%                package.",
%%%   docstring = "The checksum field above contains a CRC-16
%%%                checksum as the first value, followed by the
%%%                equivalent of the standard UNIX wc (word
%%%                count) utility output of lines, words, and
%%%                characters.  This is produced by Robert
%%%                Solovay's checksum utility.",
%%% }
%%% ====================================================================
\documentclass{article}
\pagestyle{myheadings}

\title{Using the \pkg{amsthm} Package}
\author{Version 2.07, 2000/06/02\\ American Mathematical Society}
\date{}

\providecommand{\qq}[1]{\textquotedblleft#1\textquotedblright}
\providecommand{\mdash}{\textemdash\penalty\hyphenpenalty}

% Embedded \index commands are a legacy from the time when this
% documentation was part of amsldoc. Since they don't hurt anything,
% let's leave them in. Maybe they will become useful again in the
% future. [mjd,2000/06/06]

\chardef\bslchar=`\\ % p. 424, TeXbook
\newcommand{\ntt}{%
  \fontfamily\ttdefault \fontseries\mddefault \fontshape\updefault
  \selectfont
}
\DeclareRobustCommand{\cn}[1]{{\ntt\bslchar#1}}
\DeclareRobustCommand{\cls}[1]{{\ntt#1}}
\DeclareRobustCommand{\pkg}[1]{{\ntt#1}}
\DeclareRobustCommand{\opt}[1]{{\ntt#1}}
\DeclareRobustCommand{\env}[1]{{\ntt#1}}
\DeclareRobustCommand{\fn}[1]{{\ntt#1}}

\providecommand{\qedsymbol}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}

\hfuzz4pt \vbadness9999 \hbadness5000
\def\latex/{{\protect\LaTeX}}

\setlength{\textwidth}{210mm}\addtolength{\textwidth}{-2in}
\setlength{\oddsidemargin}{39pt}
\addtolength{\textwidth}{-2\oddsidemargin}

\begin{document}
\maketitle
\markboth{USING THE \pkg{amsthm} PACKAGE}{USING THE \pkg{amsthm} PACKAGE}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}

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

\section{The \cn{newtheorem} command}

In mathematical research articles and books, theorems\index{theorems}
and proofs\index{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 well-defined boundaries, they are naturally handled in
\latex/ as environments. But \latex/ 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
\cn{newtheorem}, similar to \cn{newenvironment} in effect, that makes it
easy for authors to set up the elements required for a particular
document.

The \cn{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,
\begin{verbatim}
\newtheorem{lem}{Lemma}
\end{verbatim}
means that instances in the document of
\begin{verbatim}
\begin{lem} Text text ... \end{lem}
\end{verbatim}
will produce
\[\makebox[.8\columnwidth]{%
  \textbf{Lemma 1.} \textit{Text text \dots}\hfill}\]
where the heading consists of the specified text \qq{Lemma} and an
automatically generated number and punctuation.

If \cn{newtheorem*} is used instead of \cn{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 \qq{Klein's Lemma} instead of \qq{Lemma} +
number, then the statement
\begin{verbatim}
\newtheorem*{KL}{Klein's Lemma}
\end{verbatim}
would allow you to write
\begin{verbatim}
\begin{KL} Text text ... \end{KL}
\end{verbatim}
and get the desired output.

\section{Numbering modifications}

In addition to the two mandatory arguments, \cn{newtheorem} has two
mutually exclusive optional arguments. These affect the
sequencing\index{theorems!numbering} 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\mdash Lemma 1, Lemma 2, Theorem 3, Lemma
4, Theorem 5\mdash then you should indicate the desired relationship as
follows:
\begin{verbatim}
\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}
\end{verbatim}
The optional argument \verb'[thm]' in the second statement means that
the \texttt{lem} environment should share the \texttt{thm} numbering
sequence instead of having its own independent sequence.

To have a theorem environment numbered subordinately within a
sectional unit\mdash e.g., to get propositions numbered Proposition 2.1,
Proposition 2.2, and so on in Section 2\mdash put the name of the parent
unit in square brackets in final position:
\begin{verbatim}
\newtheorem{prop}{Proposition}[section]
\end{verbatim}
With the optional argument \verb'[section]', the \verb'prop' counter
will be reset to 0 whenever the parent counter \verb'section' is
incremented.

\section{Changing styles for theorem-like environments}

\subsection{The \cn{theoremstyle} command}

The \pkg{amsthm} package supports the notion of a current theorem style,
which determines what will be produced by a given \cn{newtheorem}
command. The three theorem styles provided\mdash
\verb'plain',\index{plain theo@\texttt{plain} theorem style}\relax
\index{definition theo@\texttt{definition} theorem style}\relax
\index{remark theo@\texttt{remark} theorem style} \verb'definition', and
\verb'remark'\mdash 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 \verb'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 \cn{new\-theorem} commands into groups and preface each
group with the appropriate \cn{theo\-rem\-style}. If no \cn{theoremstyle}
command is given, the style used will be \texttt{plain}. Some examples:
\begin{verbatim}
\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}
\end{verbatim}

\subsection{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 \cn{theoremstyle} changes, number-swapping is done by
placing a \cn{swapnumbers} command at the beginning of the list of
\cn{newtheorem} statements that should be affected. For example:
\begin{verbatim}
\swapnumbers
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\theoremstyle{remark}
\newtheorem{rem}{Remark}
\end{verbatim}
When the \pkg{amsthm} package is used with one of the generic \latex/
document classes such as \cls{article} or \cls{book}, the result of the
above declarations will be to have theorem and remark heads printed in
the form \textbf{1.4~Theorem}, \textit{9.1~Remark}. With other document
classes the appearance may be different.

\subsection{Further customization possibilities}

More extensive customization capabilities are provided by the
\pkg{amsthm} package in the form of a \cn{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
\fn{thmtest.tex} and to the commentary in \fn{amsclass.dtx}.

\section{Proofs}

A predefined \env{proof} environment provided by the \pkg{amsthm}
package produces the heading \qq{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 \cn{section} or \cn{subsection} in
your document.

An optional argument of the proof environment allows you to substitute
a different name for the standard \qq{Proof}. If you want
the proof heading to be, say, \qq{Proof of the Main Theorem}, then write
\begin{verbatim}
\begin{proof}[Proof of the Main Theorem]
\end{verbatim}

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

Placement of the QED symbol can be problematic if the last part of
a \env{proof} environment is a displayed equation or list environment
or something of that nature. In that case put a \cn{qedhere} command at
the place where the QED symbol should appear.
\begin{verbatim}
\begin{proof}
...
\begin{equation}
G(t)=L\gamma!\,t^{-\gamma}+t^{-\delta}\eta(t) \qedhere
\end{equation}
\end{proof}
\end{verbatim}
If the \pkg{amsthm} package is used with a non-AMS documentclass and
with the \pkg{amsmath} package, \pkg{amsthm} must be loaded
\emph{after} \pkg{amsmath}, not before.\footnote{The right-margin
positioning done by \cn{qedhere} in displayed equations works only with
version 2 of the \pkg{amsmath} package, not with earlier versions.}
If \cn{qedhere} produces an error message in an equation, try using
\verb'\mbox{\qedhere}' instead.

\end{document}
