%%% ====================================================================
%%% @LaTeX-file{
%%%   filename  = "amsthdoc.tex",
%%%   version   = "2.01",
%%%   date      = "1999/12/03",
%%%   time      = "10:07:00 EST",
%%%   checksum  = "26746 295 1573 12487",
%%%   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 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.",
%%% }
%%% ====================================================================
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/06/01]% LaTeX date must June 1994 or later
\documentclass[leqno,titlepage,openany]{amsldoc}

\title{Using the \pkg{amsthm} Package}
\author{American Mathematical Society\\Michael Downes}
\date{Version 2.01, 1999/12/03}

%    The amsldoc class includes a number of features useful for
%    documentation about TeX, including:
%
%    ---Commands \tex/, \amstex/, \latex/, ... for uniform treatment
%    of the various logos and easy handling of following spaces.
%
%    ---Commands for printing various common elements: \cn for command
%    names, \fn for file names (including font-file names), \env for
%    environments, \pkg and \cls for packages and classes, etc.

%    Many of the command names used here are rather long and will
%    contribute to poor linebreaking if we follow the \latex/ practice
%    of not hyphenating anything set in tt font; instead we selectively
%    allow some hyphenation.
\allowtthyphens % defined in amsldoc.cls

\hyphenation{new-theo-rem theo-rem-style}

\makeatletter
%    Turn off section marks.
\let\sectionmark\@gobble
\renewcommand{\thesection}{\arabic{section}}

\renewcommand{\maketitle}{%
  \vspace{1.5\baselineskip}%
  \begingroup \centering \normalfont
  \begingroup \Large\bfseries\@title\par\endgroup
  \nobreak \vskip\baselineskip
  \@author\par
  \nobreak \vskip\baselineskip
  \begingroup \small\@date\par\endgroup
  \endgroup
  \markboth{\protect\MakeUppercase{\@title}}%
    {\protect\MakeUppercase{\@title}}%
}
\makeatother

\begin{document}
\thispagestyle{plain}
\maketitle

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

The \pkg{amsthm} package provides an enhanced version of the \latex/
command \cn{newtheorem} 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 |*| 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 `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 `Klein's Lemma' instead of `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---Lemma 1, Lemma 2, Theorem 3, Lemma
4, Theorem 5---then you should indicate the desired relationship as
follows:
\begin{verbatim}
\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}
\end{verbatim}
The optional argument |[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-like 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:
\begin{verbatim}
\newtheorem{prop}{Proposition}[section]
\end{verbatim}
With the optional argument |[section]|, the |prop| counter will be reset
to 0 whenever the parent counter |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---|plain|,\index{plain
theo@\texttt{plain} theorem style}\relax \index{definition
theo@\texttt{definition} theorem style}\relax \index{remark
theo@\texttt{remark} theorem style} |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 \cn{newtheorem} commands into groups and preface each
group with the appropriate \cn{theoremstyle}. 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 ``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 ``Proof''. If you want
the proof heading to be, say, ``Proof of the Main Theorem'', then write
\begin{verbatim}
\begin{proof}[Proof of the Main Theorem]
\end{verbatim}

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