LaTeX tips: Theorems
Note: Most of the tips below require the amslatex macros. These
are automatically loaded if you use the "amsart"
documentclass, but if you use other documentclasses, such as
"article", put the following in the preamble, after
"\documentclass{...}":
\usepackage{amsmath, amsthm, amssymb}
For more about the amslatex macros, and as a general reference for the
tips below, see Gratzer's "Math into LaTeX".
Disabling automatic theorem numbering
One reason why many authors who are familiar with TeX/Amstex are reluctant to
switch to LaTeX is the apparent loss of control over the structure
of a document, due to LaTeX' tendency to do things like theorem and
equation numbering automatically. Most books on LaTeX reinforce this
belief and leave the impression that one either has to give up that
control and let LaTeX do things the way it's set up by default, or
invest considerable time learning how to change the LaTeX default
behavior. For example, to get "Theorem A." in Amstex is easy:
\proclaim{Theorem A} We have ... \endproclaim
However, there is no apparent simple way to obtain the same output with LaTeX'
automated theorem numbering mechanism (but see below for a simple solution
that does not use automatic numbering).
Some authors try to deal with this
problem by manually coding theorems, etc., resorting to constructs
like
\vspace{5mm}\noindent{\bf Theorem A}. {\it We have ...}\vspace{5mm}
However, such "manual formatting"
is bad LaTeX practice,
should be avoided.
For one, the spacing is likely not optimal, and
it would take some trial and error to optimize the
spacing. However,
any such effort is most likely wasted, since such manual formatting
will likely be removed at the publisher's end
and replaced by proper LaTeX constructs.
The right way to handle situations like this is to use the
"\newtheorem*"
command, which works just like "\newtheorem", except that
it doesn't number the theorems: To get the above example, add
"\newtheorem*{thma}{Theorem A}" to the preamble (this
defines a theorem, "thma"), and then use
\begin{thma} We have ... \end{thma}
The "\newtheorem*" command is part of the amslatex macro set;
specifically, it is defined in the package "amsthm",
which should be loaded (along with "amsmath" and
"amssymb") as recommended above, unless you use
"amsart" as documentclass (since the "amsart"
class loads these packages automatically).
Automatic theorem numbering
Theorems declared with the "\newtheorem"
command are automatically numbered. The numbering scheme is highly
customizable (see Gratzer's book for details).
The LaTeX default is to number each "theorem"
consecutively: Theorem 1, Theorem 2, Theorem 3, Corollary 1,
Corollary 2, Lemma 1, etc. However, except for short papers with only
a few "theorems", this is usually not a good practice.
A better scheme, that is appropriate for most
papers and could be used in article templates,
is one that numbers all theorems (and their equivalents)
consecutively, but within each section: Theorem 1.1, Corollary 1.2,
Lemma 1.3, etc. This is achieved with the following commands in the
preamble:
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
Then theorems, corollaries, and lemmas can be called up (and get
automatically numbered) with
\begin{thm}\label{...} .... \end{thm}
\begin{cor}\label{...} .... \end{cor}
\begin{lem}\label{...} .... \end{lem}
where "\label{...}" contains the theorem label. The label is not
mandatory, but needed if you want to refer back to the theorem with
"\ref{...}".
Theorem styles
The "amsthm" package (loaded
via the "amsart" documentclass, or explicitly with a
"\usepackage{...}" command) provides different "theorem
styles", so that theorems, corollaries, and lemmas, can be
differentiated from definitions and remarks. In mathematical
typesetting, it is customary to set the latter two (definitions and
remarks) in ordinary Roman font, while the "real" theorems are set in
italics. To achieve this effect, precede the theorem declarations
corresponding to definitions and remarks by
an appropriate "\theoremstyle{...}" command, as in the
following example.
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\theoremstyle{remark}
\newtheorem{rem}[thm]{Remark}
\theoremstyle{definition}
\newtheorem{def}[thm]{Definition}
Note that the "real" theorems (thm, cor,lem) need no explicit
theoremstyle declaration, since the style appropriate for these
theorems is the default.
For more on this see Gratzer's book.
Proofs
For proofs use the
"\begin{proof} ... \end{proof}"
environment, which
acts much like the "\demo ... \enddemo"
pair in amstex.
Here are some hints:
- Proof name.
By default, a proof is introduced with
"Proof." This can be changed by giving an optional argument in square
brackets: For example, to change this to "Proof of the Main Theorem.",
use:
\begin{proof}[Proof of the Main Theorem]
Note that the period after "Proof of the Main Theorem" is supplied by
the macro and should not be included in the argument.
- End of proof symbol.
The "\end{proof}" command generates a "qed symbol" (by default,
a hollow square)
at the end of the proof. The symbol can be redefined with
"\qedsymbol"; in particular, if you
don't want qed symbols, just redefine "\qedsymbol"
to an empty command as follows:
"\renewcommand{\qedsymbol}{}".
If this definition is placed in the preamble, its effect is global.
However, one can also place the definition inside a
"\begin{proof} ... \end{proof}" pair. In this case, it only
affects the current proof and eliminates the qed symbol in that proof,
but has no effect on other proofs.
One situation where one might want to do that is in the case of nested proof
environments. Suppose, for example, the proof of a theorem contains several
lemmas, each with its own proof, and that the proof of the last lemma also
concludes the proof of the theorem.
Since \begin{proof} ... \end{proof} commands must come in pairs,
both the proof of the theorem and that of the final lemma must be concluded
with an "\end{proof}" command,
so one ends up with two consecutive "\end{proof}" commands.
To prevent two "qed" symbols from being printed,
simply precede the second of the \end{proof} commands by
"\renewcommand{\qedsymbol}{}".
- Placing of qed symbol.
An important rule is that
you should not leave a blank line before "\end{proof}"
since
that would indicate a paragraph break and would cause the qed symbol to
be placed one line below where it should be.
- Proofs ending with an equation.
If the proof ends with a
displayed equation, then "\end{proof}"
would normally place the symbol
one line below the display, which looks odd. To place the symbol on the
same line as the display, add "\qedhere"
at the end of the display
(right before "\end{equation}",
or its equivalent). Note that in order
for this to work properly, the display should not be set with double
dollar signs (which isn't advisable anyway) - use \[, \] or one of
the display environments instead.
- Matching of \begin{proof}, \end{proof} pairs. Each
"\begin{proof}"
must have a matching "\end{proof}";
otherwise TeX will complain.
However, these environments can be nested. For example, inside a proof
of a theorem one can have several
" \begin{proof} ... \end{proof}"
pairs
for proofs of lemmas. Sometimes, the proof of a theorem occupies
an entire section. It wouldn't make much sense to begin
a section titled, say, "4. Proof of Theorem 1" with
"\begin{proof}". In a case like this, it's usually
best to leave out both \begin{proof} and \end{proof}. If one still
wants to indicate the end of the proof by a qed symbol, one can insert
this manually with "\qed"
at the appropriate place.
Other hints
- Theorems with several items.
Often a theorem contains several parts, labelled (i), (ii), etc.
The best way to set this is using the itemize environment, as in the
following example:
\begin{thm}
Let $A$ be a finite set and $f$ a map from $A$ to itself.
The following statements are equivalent:
\begin{itemize}
\item[(i)] $f$ is injective.
\item[(ii)] $f$ is surjective.
\item[(iii)] $f$ is a bijection.
\end{itemize}
\end{thm}
This is preferable to setting the items (i)-(iii)
manually with constructs like "\newline (i) ... \newline (ii) ...".
Note that the arguments [(i)], etc. generate the item labels.
- Lists at the beginning of a theorem statement.
Anyone who has had to typeset theorems with lists probably has run
into the problem that if the list occurs at the beginning of the
statement (i.e., with no text preceding it inside the theorem),
it gets typeset right after the theorem name, and not
on a new line and indented in the same way as the other items, and
putting spacing commands or explicit newlines before the list doesn't
seem to help. For instance, this would happen in the above
example without the introductory phrase "Let ...".
The reason for this behavior is that the theorem
environment "eats up" (nearly) any space at the beginning of the
theorem, so commands like \hfill or \newline or \par have no effect.
The remedy is to
trick TeX into thinking that there is material before
the list, by putting an "\mbox{}"
before the list, as in the following example.
\begin{thm}
\mbox{}
\begin{itemize}
\item[(i)] $f$ is injective.
\item[(ii)] $f$ is surjective.
\item[(iii)] $f$ is a bijection.
\end{itemize}
\end{thm}
- Theorems with citations or other parenthetical matter.
Theorems quoted from the literature are often stated in a form like
"Theorem A (Gauss [3])" or "Theorem A ([3, Theorem 4.6])".
One way to typeset this is to include the entire header in the theorem
declaration, as in
"\newtheorem*{theorema}{Theorem A (Gauss \cite{3})}".
The preferred method, however, is to set the material in parenthesis
as an optional argument to the theorem environment, e.g.: With
"\newtheorem*{theorema}{Theorem A}" as theorem declaration, use
"\begin{theorema}[Gauss \cite{3}]"
to begin the statement of Theorem A.
This works well in the first case, but not if the
"\cite" command also needs an optional argument, as in the second
case: "\begin{theorema}[Gauss \cite[Theorem 4.6]{3}]"
doesn't work,
since there is a clash between the two bracket pairs.
To fix this, protect the inner bracket pair by
enclosing the entire argument in braces:
"\begin{theorema}[{Gauss \cite[Theorem 4.6]{3}}]".
- Equation numbers, etc., in theorems
Theorems usually get
typeset in a slanted (or italic) font, but equation numbers, and other
labels look poor in that font. To remedy this, surround these
by "\textup{...}"; e.g., " equation \textup{(3)} ...",
or "by part \textup{(i)} of Theorem 3".
Also, parentheses in slanted font
may look poor, expecially next to material (e.g., math expressions)
in upright font; this can be fixed in the same way,
by replacing ")" by "\textup{)}".
- Fonts in Theorems.
Another situation that arises with some frequency is text material
inside a displayed math formula in a theorem (e.g.,
"... as $x\to\infty" ). The proper way to set
such text material is with the (amslatex) command
\text{...}. Within
ordinary text, this material gets typeset in Roman font, but when the
display occurs inside a theorem, the font is the same as that of the
in which the theorem is typeset (usually italic). This is the desired
behavior and should not be circumvented by explicit font commands.
Back to the LaTeX Tips Page
Last modified: Mon 10 Sep 2007 08:05:46 AM CDT
A.J. Hildebrand