\title{Maths in \LaTeX: Part~4, Numbered and Unnumbered Things}
\author[R.~A.~Bailey]{R.~A.~Bailey\\
Queen Mary and Westfield College, \\University of London}
\newenvironment{oneoff}[1]{\equation%
               \addtocounter{equation}{-1}%
                \renewcommand{\theequation}{\mbox{#1}}}%
              {\endequation}
%%%
\newcommand{\writer}[1]{{\sc #1}:}
\newcommand{\book}[1]{{\it #1},}
\newcommand{\publish}[2]{{\rm #1, #2,}}
\newcommand{\byear}[1]{{\rm (#1).}}
\newtheorem{preqn}{Exercise}
\newenvironment{qn}{\begin{preqn}\normalfont\rm}{\end{preqn}}
\newcommand{\latexword}[1]{{\normalfont\tt #1}}
%%% and the above should be in typewriter-ordinary IRRESPECTIVE of the
%%% surrounding fonts
%%%
%%%
%%% editor: I have been as generic as I can, but of course you can't
%%% put \verb inside a \newcommand. I have consistently used + as the
%%% delimiter for \verb, except when I needed the + in Maths!
%%%
\newcommand{\lamport}{{\it \LaTeX: A Document Preparation System\/} by Leslie 
Lamport}
\newcommand{\shortlamp}{{\it The Manual}}
%%%
\let\torl\AllTeX
%%% editor, can you do a better macro for the above?
%%%
\newcommand{\littlehead}[1]{\textit{#1}}
\begin{Article}
\section*{Recall}
This is the fourth in a sequence of tutorials on typesetting Mathematics in 
\LaTeX. The first three appeared in issues~4.4, 4.5 and~5.1 of \BV. The series
includes some things which can be found in \cite{leslie}, but I am 
working in more things which, while straightforward and necessary for 
Mathematical work, are  not in \cite{leslie} or \cite{newleslie}. In this 
tutorial I concentrate not on Mathematical formulae but on things like 
equations and theorems which Mathematicians like to display in special ways and
to number (or not).

In case you missed the first three
tutorials, I remind you that
I expect you, the reader, to do some work. Every so 
often comes a group of exercises, which you are supposed to do. Use \LaTeX\ to 
typeset everything in the exercise except sentences in italics, which are 
instructions. If you are not satisfied that you can do the exercise, then tell 
me. Either write
to me 
at
\begin{verse}
School of Mathematical Sciences\\
Queen Mary and Westfield College\\
Mile End Road\\
London E1 4NS
\end{verse}
with hard copy of your input and output, 
or email me at \mbox{\tt r.a.bailey@qmw.ac.uk}
with a copy of the 
smallest possible piece of \LaTeX\ input file that contains your
attempt at the answer.
In either case
I will include a solution in the following issue of \BV: you will remain 
anonymous if you wish.


\section*{Answers}
I promised to answer all questions arising from this series of articles (as far
as I can).

\subsection*{Size of parentheses}
Charles M.~Goldie asks why I put $(t^{g^{-1}})v$ in Exercise~26 instead of 
using \verb+\bigl(+ and \verb+\bigr)+ to make the parentheses larger than 
what they enclose.
%\[\bigl(t^{g^{-1}}\bigr)\]
%\[\Bigl(t^{g^{-1}}\Bigr)\]
The answer is that you would need \verb+\Bigl(+ and \verb+\Bigr)+ to make them 
large enough in this case: I should have used
\verb+\left+ and \verb+\right+ (see 
Part~2 of this series) but I was lazy.

Both he and Charles Leedham-Green have asked why I permit, or 
even encourage, deeply nested parentheses, as in
\begin{equation}
u(P((1 - \varepsilon)z)),  
\label{goldie}
\end{equation}
without using commands like \verb+\bigl(+ to make some of the outer
parentheses somewhat larger. In Chapter~17 of \cite{dek}, Knuth
advises that authors should use \verb+\bigl+ and its relatives to
specify the size of parentheses and other expandable fences, to
improve the readability of their formulae. However, I have
deliberately avoided telling people about these commands.

I have two reasons for ignoring Knuth's advice. The first is that I
regard \LaTeX\ primarily as a system for {\em authors}, not for
typesetters. Authors should not be stopping to worry about the size of
parentheses, particularly if the level of nesting may change in a
later version of the document. Conventions on size of fence should be
a matter for the style designer, not the author. If someone can write
a style file that automatically detects the level of nesting and
adjusts the size accordingly, well and good. I have no objection to
using such a style file; I do object to interrupting my Mathematical
thoughts to fret over niceties of sizing.

My second reason is related to the first. Journal editors and
executive editors tend to have policies about the size of fences, and
they will impose these policies whatever we as authors do. So it is
generally a {\em complete waste of time\/} for authors to use
\verb+\Bigr+ and the like, or for referees to insist on them.

This is not to say that I disapprove of \verb+\left+ and
\verb+\right+.  These commands automatically adjust the size of the
fence to fit what is inside it. Adding, say, an extra item inside a
\verb+\left( ... \right)+ does not cause the author to rethink the
size of the parentheses. In fact, in my \mbox{basic} style file I have
macros such as \verb+\probab+, \verb+\setof+ and \verb+\card+ which
use \verb+\left+ and \verb+\right+ precisely so that I can type as I
think, {\em the set of \ldots\/} rather than {\em squiggly brackets,
  now what size and how much space?} (Oh, all right:
\begin{verbatim}
   \newcommand{\card}[1]{\left|#1\right|}
\end{verbatim}
---you can guess the others.)
In fact, \verb+\left+ and \verb+\right+ make no difference to the formula 
in~(\ref{goldie}), so neither of my questioners will be satisfied by my answer.

\subsection*{Interchangeability of parentheses, brackets and braces}
Charles M.~Goldie also asks if I have an opinion about whether nested
parentheses should be routinely replaced so that one uses the sequence
$\{[( \ldots )]\}$, which is demanded by some journals. I do have an
opinion, quite a strong one, probably because one of the journals in
which I publish most frequently insists on the sequence $[\{( \ldots
)\}]$ and shows surprise (or the executive editor does) each time that
I explain that I am using $\{ \ldots \}$ to denote a {\em set}. My
opinion has been admirably expressed by Ellen Swanson in her bible of
Mathematical typesetting~\cite{swan}:
\begin{quote}
  Often, however, the author of research mathematics attaches a
  special meaning to different types of enclosures, and this author
  believes that they {\it should be left in whatever order and variety
    the author has indicated in the manuscript.}
\end{quote}
(her italics).

\addtocounter{section}{4}
\section{Numbered and Unnumbered Displays}
\subsection{Unnumbered Maths displays}
Use \verb+\[+ and \verb+\]+ for an unnumbered single line of displayed
Maths: see Part~1. If you have two or more lines of displayed Maths
that must be vertically aligned then you need one of the
\latexword{array} environments. I shall deal with them in the final
tutorial in this series.

\subsection{Unnumbered word displays}
Sometimes what you want to display is not simply a formula but a
verbal condition that may or may not involve short pieces of notation.
For example:
\begin{quote}
each basis vector~$f$ in~$V_{T,B}$ is orthogonal to every basis vector 
in~$V_{B,T}$ except $f\psi$.
\end{quote}
If this will fit on a single line then you can use
\verb+\[\mbox{...}\]+, but this is not very satisfactory because you
have to stop and think how long it is and it is subject to changes in
the line width. I find that the \latexword{quote} environment works
well for such displays.

\subsection{Numbered Maths displays}
Use the \latexword{equation} environment for a numbered single line of
displayed Maths such as (\ref{goldie}) in the `Answers' section above.
If you have two or more consecutive equations or formulae that do not
need to be vertically aligned, simply use one \latexword{equation}
environment per line. For vertical alignment, wait until the tutorial
on arrays.

If you put a \verb+\label+ within an \latexword{equation} you can painlessly 
refer back (or forward) to that equation.
\begin{verbatim}
   For contrasts, we put
   \begin{equation}
   W_T = V_T \cap V_0^\perp
   \label{contrasts}
   \end{equation}
   The space~$W_T$ was defined 
   in Equation~(\ref{contrasts}).
\end{verbatim}
\begin{quote}
  For contrasts, we put
\begin{equation}
W_T = V_T \cap V_0^\perp
\label{contrasts}
\end{equation}
The space~$W_T$ was defined in Equation~(\ref{contrasts}).
\end{quote}

\subsection{Numbered word displays}
Sometimes word displays also need to be numbered for reference.
\LaTeX\ does not directly provide an environment for this, but I find
that the following works quite well.
\begin{verbatim}
   There is a bijection ...
   \begin{equation}
   \begin{minipage}[t]{0.8\linewidth}
   each basis vector~$f$ ...
   \end{minipage}
   \end{equation}
   Using ...
\end{verbatim}
\begin{quote}
   There is a bijection~$\psi$ between the bases which satisfies:
   \begin{equation}
   \begin{minipage}[t]{0.8\linewidth}
   each basis vector~$f$ in~$V_{T,B}$ is orthogonal to every basis vector 
   in~$V_{B,T}$ except $f\psi$.
   \end{minipage}
   \end{equation}
   Using~$\psi$, we can show that \ldots
\end{quote}
These displays are numbered in the same sequence as the
\latexword{equation}s, and can be labelled and referred to in just the
same way.  Note that I have made no attempt to make the indentation
the same as that in \latexword{quote}.

You can suppress the \verb+[t]+ if you want the number to be
vertically centred on the display. You can replace 0.8 by any
reasonable fraction. There is a catch, however: if you have numbered
word displays labelled (9) and~(10) you may find that the second one
comes out shifted to the left, to allow space for the wider label.
Whether or not this happens depends on the settings of other
parameters, such as \verb+\linewidth+. With the default width for A4
paper in 10pt in \LaTeXe, I found that I had to decrease 0.8 to 0.75
in order to have satisfactory word displays numbered (9) and~(10).

Of course, if you have two or more such displays you should make an
environment for them. I do it as follows.
\begin{verbatim}
   \newenvironment{condition}%
    {\equation%
     \begin{minipage}[t]{0.8\linewidth}}%
    {\end{minipage}\endequation}
\end{verbatim}
You may wonder why I have used \verb+\equation+ and
\verb+\endequation+ in the definition instead of
\verb+\begin{equation}+ and \verb+\end{equation}+. This is because of
the clever things that \LaTeX\ does with spaces before and after
displayed material. When you type the line
\begin{verbatim}
   \end{equation}
\end{verbatim}
\LaTeX\ ignores the spaces on the rest of the line; if you type the line
\begin{verbatim}
   \end{condition}
\end{verbatim}
and the final part of the \latexword{condition} environment is
\verb+\end{equation}+ then this forgetfulness about spaces is not
passed through to \verb+\end{condition}+. Use of the more primitive
\verb+\equation+ and \verb+\endequation+ does pass on the
forgetfulness.

\subsection{Numbering equations within sections}
By default, \latexword{equation}s are numbered~1, 2, \ldots\ right
through the document in the \latexword{article} class. To make them
numbered within sections you need
\begin{verbatim}
   \renewcommand{\theequation}%
     {\thesection.\arabic{equation}}
\end{verbatim}
Then the first equation in Section~1 will be numbered~1.1, the
next~1.2, and so on. However, if there are four equations in
Section~1, then the first equation in Section~2 will be numbered~2.5
because the \latexword{equation} counter has not been reset at the
start of the new section. To correct this, you also need
\begin{verbatim}
   \@addtoreset{equation}{section}
\end{verbatim}
Because of the \verb+@+~sign in this command, you must either place it
in a style file or make sure that it comes between the commands
\verb+\makeatletter+ and \verb+\makeatother+ in the preamble to the
document.

\subsection{One-off numbering of equations}
Occasionally you want to number an equation not in the main sequence
but by a particular symbol, such as ($*$) or (1.1$'$). Use the
following \latexword{oneoff} environment in place of
\latexword{equation}, putting the desired symbol as the single
parameter.
\begin{verbatim}
\newenvironment{oneoff}[1]{\equation%
  \addtocounter{equation}{-1}%
  \renewcommand{\theequation}{\mbox{#1}}}%
  {\endequation}
\end{verbatim}
For example,
\begin{verbatim}
   \begin{oneoff}{$*$}
   a(p_i,q) - a(p_j,q) = 0 \bmod s
   \end{oneoff}
\end{verbatim}
\begin{quote}
   \begin{oneoff}{$*$}
   a(p_i,q) - a(p_j,q) = 0 \bmod s
   \end{oneoff}
\end{quote}
(See \cite[page~92]{leslie} or \cite[pages~98--99]{newleslie} for how these 
counter commands work.)
Note that automatic cross-referencing does not work for such equations.

If you want a one-off equation numbered~1.1$'$ related to
Equation~(1.1) then give the latter a label (say, \latexword{rowsum})
and then do
\begin{verbatim}
   \begin{oneoff}{\ref{rowsum}$'$} ...
\end{verbatim}

\subsection{Subsequences of equations}
Suppose that between Equations~(5) and~(7) you want a sequence of
equations numbered~(6a), (6b) etc. Put the following in the preamble
to the document (or in the style file).
\begin{verbatim}
\newsavebox{\saveeqn}
\newcounter{subeqnno}
\renewcommand{\thesubeqnno}{\alph{subeqnno}}
\newenvironment{subequations}%
    {\refstepcounter{equation}%
     \savebox{\saveeqn}{\theequation}%
     \setcounter{subeqnno}{0}}%
    {}
\newenvironment{subeqn}%
    {\refstepcounter{subeqnno}%
     \oneoff{\usebox{\saveeqn}\thesubeqnno}}%
    {\endoneoff}
\end{verbatim}
(See \cite[page~101]{leslie} or \cite[pages107--108]{newleslie} for
details of \verb+\savebox+.)  Then use \latexword{subeqn} in place of
\latexword{equation} for each of the equations~(6a), (6b) etc., and
place the whole sub\-sequence in the \latexword{subequations}
environment.

Automatic cross-referencing doesn't work for these either. The reason
is that in constructing \latexword{oneoff} and \latexword{subeqn} I
have {\em used\/} the \latexword{equation} environment rather than
{\em mimicking\/} it, with the result that any \verb+\label+ picks up
the \latexword{equation} counter. To do this properly you would have
to copy out the \latexword{equation} part of \latexword{latex.tex}
(which is well documented) and hack it (for 2.09ers; of course,
\LaTeXe\ persons would have to hack part of \latexword{ltmath.dtx} and
\latexword{classes.dtx}, which some would argue are even better
documented). I have never needed this construct often enough to bother
to do it properly, but I am sure that it could be done.

\section*{Exercises}
\addtocounter{preqn}{47}
\begin{qn}
\it Make  a numbered displayed equation saying
\[
t\left(vP_g\right) = \left(t^{g^{-1}}\right)v
\]
and a sentence which refers to it.
\end{qn}


\begin{qn}
\it Make an unnumbered word display saying
\begin{quote}
\rm There is a natural surjective homomorphism $\phi\colon G \to G/N$ with 
$\ker(\phi) \simeq \mathop{\rm Im}(\phi)$.
\end{quote}
\end{qn}

\begin{qn}
\it
Make  a displayed numbered verbal condition saying
\begin{quote}
\rm
for all $A$, $B$, $C$ in $\cal P$: if $A\prec B$ and $B\prec C$ then $A\prec 
C$; and if $A  \preceq B$ and $B\preceq A$ then $A=B$.
\end{quote}
Then add a sentence which refers to it.
\end{qn}

\section{Theorems and their friends}
\subsection{Basics}
To make a new environment called \latexword{thm} for theorems, do
\begin{verbatim}
   \newtheorem{thm}{Theorem}
\end{verbatim}
  \newtheorem{thm}{Theorem} This sets up the environment, which is
  then used as follows.
\begin{verbatim}
   \begin{thm}
   The kernel of a homomorphism 
   is a congruence.
   \label{basic} 
   \end{thm}
   In Theorem~\ref{basic} we ... 
\end{verbatim}
\begin{quote}
  \begin{thm}
  The kernel of a homomorphism is a congruence.
  \label{basic} 
  \end{thm}
  In Theorem~\ref{basic} we \ldots
\end{quote}
The theorems are all given the heading `Theorem'. They are numbered 
automatically, and may be cross-referred to in the usual way.

For clarity in the rest of this section, I shall call the item like
\latexword{thm} the {\em theorem environment}, the item like
\latexword{Theorem} the {\em theorem name}, the text like `Theorem~1'
the {\em theorem head}, and the text like `The kernel of \ldots' the
{\em theorem body}.

Note that there is nothing to prevent two different theorem
environments having the same theorem name. Indeed, the theorem name
can be empty.

By default, the theorem head is in bold and the theorem body is in
italics. The theorems are numbered in arabic numbers, in a single
sequence throughout the document (in the \latexword{article} class).
All of these defaults can be changed, as I show below.

It may not be obvious to the novice user, but there is more to an
environment created with \verb+\newtheorem+ than special layout and
automatic numbering.  The spacing before and after each theorem
environment is controlled, and penalties are set so that no page break
will come after the first line of a theorem environment unless there
is a natural break-point in the text.

Unfortunately, there is a bug (oops, feature) in \LaTeX\ which means
that if you put \verb+\label{...}+ immediately after
\verb+\begin{thm}+ you spoil this page-breaking penalty. But the
\verb+\label+ should be somewhere easy to find, so I always play safe
and put it immediately before \verb+\end{thm}+.

\subsection{Named theorems}
If you have a theorem environment \latexword{thm} then you can use an optional 
argument to \latexword{thm} to obtain a named theorem. For example,
\begin{verbatim}
   \begin{thm}[The Central Limit Theorem]
   If $X_1$, ...
\end{verbatim}
\begin{quote}
  \begin{thm}[The Central Limit Theorem]
  If $X_1$, $X_2$, \ldots, $X_n$ are independent \ldots
  \end{thm}
\end{quote}
or 
\begin{verbatim}
   \begin{thm}[Galois, 1832]
\end{verbatim}
\begin{quote}
  \begin{thm}[Galois, 1832]
  If $L:K$ is a finite normal \ldots
  \end{thm}
\end{quote}

\subsection{Sequences of numbering}
Two optional arguments to \verb+\newtheorem+ give you control of which
theorem environments are numbered in which sequences. Although it is
logical to number theorems, lemmas, corollaries etc.\ all in their own
sequences, it is much easier to find your way around a long document
if they are all in a single sequence. To get a theorem environment
\latexword{lem} numbered in the same sequence as \latexword{thm}, do
\begin{verbatim}
   \newtheorem{lem}[thm]{Lemma}
\end{verbatim}
  \newtheorem{lem}[thm]{Lemma}
After the theorems we have had so far, if we now do
\begin{verbatim}
   \begin{lem}
   With the above notation ...
   \end{lem}
\end{verbatim}
we get
\begin{quote}
  \begin{lem}
  With the above notation \ldots
   \end{lem}
\end{quote}


The other optional argument numbers the theorem environment inside something 
else. If you want the second example in Section~3 to be numbered~3.2 
irrespective of how many examples there were in previous sections, then do
\begin{verbatim}
   \newtheorem{eg}{Example}[section]
\end{verbatim}
You can use at most one optional argument with each \verb+\newtheorem+
command.

You can even number one theorem environment inside another: for
example
\begin{verbatim}
   \newtheorem{cor}{Corollary}[thm]
\end{verbatim}
if you want the corollaries after Theorem~10 to be Corollary~10.1, 
Corollary~10.2, etc. Be careful not to create a circle of environments numbered
within each other.

\subsection{Unnumbered environments}
There are several items, such as definitions, remarks and notation,
that clearly should be theorem-like environments except that they
should not be numbered. It would be possible to set them all up and
then separately adjust the counter on each one so that it is not
numbered. However, it is easier to take advantage of the
number-in-the-same-sequence option. Set up a single unnumbered counter
with
\begin{verbatim}
   \newcounter{unnumber}
   \renewcommand{\theunnumber}{}
\end{verbatim}
and then put the other unnumbered theorem environments in the same sequence 
with
\begin{verbatim}
   \newtheorem{rem}[unnumber]{Remark}
   \newtheorem{def}[unnumber]{Definition}
\end{verbatim}


\subsection{Other systems of numbering}
Many Mathematicians want the possibility of having Theorem~A, Theorem~B etc.\ 
as well as Theorem~1 etc. This is no problem. Use the commands given in 
\cite[page~92]{leslie} or \cite[page~98]{newleslie} to alter the way a theorem 
environment is numbered. Thus
\begin{verbatim}
   \newtheorem{thma}{Theorem}
   \renewcommand{\thethma}{\Alph{thma}}
   \begin{thma} The subgroups ...
   ...
   \begin{thma} The irreducible  ...
   \label{char}
   ...  
   The result of Theorem~\ref{char} \ldots
\end{verbatim}
  \newtheorem{thma}{Theorem}
  \renewcommand{\thethma}{\Alph{thma}}
\begin{quote}
  \begin{thma} The subgroups \ldots
  \end{thma}
  \begin{thma} The irreducible  \ldots
  \label{char}
  \end{thma}
The result of Theorem~\ref{char} \ldots
\end{quote}

Other possibilities for numbering are
\[
\begin{tabular}{ll}
\verb+\alph{thma}+ & Theorem~b\\
\verb+\roman{thma}+ & Theorem~ii\\
\verb+\Roman{thma}+ & Theorem~II
\end{tabular}
\]



\subsection{Changing the fonts}
Fonts are handled differently in \LaTeX\ 2.09, 
in NFSS, and in the new standard \LaTeX, \LaTeXe. 
All the suggestions that I give in this section work in both \LaTeX\ 2.09 and 
\LaTeXe. They do not work at all if you run NFSS without \LaTeXe. If you are 
using \LaTeXe, you {\em must\/} use the forms like \verb+\sc+ given here: the 
commands like \verb+\textsc+ will not do the right thing, because they 
{\em add\/} small capitals (say) to the default fonts instead of 
{\em replacing\/} the default fonts.

The \verb+\newtheorem+ command in \LaTeX\ is the most wonderful thing
to happen to Mathematical writers in a long time, because so many of
our constructs fit it. However, one of the worst things to happen to
Mathematical writers is the hard-wiring of the fonts for the theorem
heads and the theorem bodies. Ordinary \LaTeX\ simply does not give
you the flexibility to change these easily. Yet the defaults are not
always appropriate, and different journals demand different fonts for
these purposes. I suspect that this hard-wiring is one reason that
some Mathematicians have been reluctant to use \LaTeX. What can the
ordinary user do about this problem?

I shall give four answers, because different solutions are appropriate
in different circumstances.

(i)~\littlehead{Bare hands} Sometimes (for example, when sending an
article to \BV) you cannot submit your favourite style files along
with your main file. So you need a `bare hands' way of changing the
fonts, without losing too much genericity. Here's how.

To make a theorem environment \latexword{prop} whose theorem head is
set in small capitals, do
\begin{verbatim}
   \newtheorem{prop}{\sc Proposition}
\end{verbatim}
For a small document, this will do. To be more generic, you could do
\begin{verbatim}
   \newcommand{\headfont}{\sc}
   \newtheorem{prop}{\headfont Proposition}
\end{verbatim}
so that only one line has to be changed if you decide to change the
font of all the theorem heads.

To make a theorem environment \latexword{qn} whose theorem body font
is set in roman, use a two-stage process. The exercises in this
sequence of tutorials are defined by
\begin{verbatim}
   \newtheorem{preqn}{Exercise}
   \newenvironment{qn}{\preqn\rm}%
                      {\endpreqn}
\end{verbatim}
(The exercises in this particular tutorial are bad examples, because
they all have italic instructions.)

(ii)~\littlehead{Mittelbach's style file} Frank Mittelbach wrote the
style file \latexword{theorem.sty}, which should be available from all
good CTAN hosts. It is described in \cite[pages~251--255]{companion}.
It enables you to change the fonts and the layout of theorem
environments. However, it does not do exactly what I need.

(iii)~\littlehead{My style file} When I first started to use \LaTeX\ 
it was obvious to me that a flexible means of changing the fonts for
theorem heads and theorem bodies had to be provided. I hacked
\verb+@begintheorem+ from \latexword{latex.tex} to produce a style
file which lets me give a single command to set the font for theorem
heads, another to set the font for (most) theorem bodies, and another
to say that all subsequently declared theorem environments will have
their bodies set in `ordinary' type: not necessarily in roman, but in
{\em whatever font the surrounding text is in}.  However, like many
others, I deplore the proliferation of personal style files because
they inhibit portability of documents, so I haven't made this style
file generally available.

(iv)~\littlehead{American Mathematical Society} The old version of
\latexword{amstex.sty} (see \cite{amslatex}) gives the user the
possibility of declaring theorem environments in three classes---plain
theorems, definitions and remarks. However, it does not give the user
any control over the fonts used in those environments. I do not know
if the forthcoming package \latexword{amsthm.sty} will give any more
freedom.

\subsection{Proofs}
We all need a proof environment, so everyone invents her own, some
more successfully than others. I think that the proof environment
should be made with \verb+\newtheorem+, so that all the benefits of
spacing, of page-break penalties and of consistent head fonts can be
retained. Of course, proofs should be unnumbered and (usually) set in
the same font as the surrounding text.  So I simply use the foregoing
methods to create an environment \latexword{pf} with name
\latexword{Proof} which is unnumbered and has its body
set either in the surrounding text font or in roman.
%\begin{verbatim}
%  \plaintheorems
%  \newtheorem{pf}[unnumber]{Proof}
%\end{verbatim}

What should you do about the end-of-proof symbol? Some people want it put in 
automatically. In principle this could be done with something like
\begin{verbatim}
   \newenvironment{proof}{\pf}%
                         {\eop\endpf}
\end{verbatim}
where \verb+\eop+ is your favourite end-of-proof symbol, for example
\begin{verbatim}
\unskip\protect\nolinebreak\mbox{\quad$\Box$}
\end{verbatim}
This is not really satisfactory if you have any proofs that end in
displayed Maths (or any other sort of display). Traditionally the
end-of-proof sign goes in the display, not on a new line; but if you
have a display inside an environment then \LaTeX\ finishes off the
display and gets ready for a new line before it reads the instructions
for the end of the environment. So my advice is to have an \verb+\eop+
macro and put it in by hand at the end of every proof, either just
inside the final display (if this is the last thing in the proof) or
just before the \verb+\end{pf}+.


\subsection{Questions and Exercises}

A theorem environment is ideal for questions on exam papers and
coursework sheets, and exercises in text books. It is usually better
than \latexword{enumerate} because it retains the normal text\-width,
paragraph indentation and paragraph separation.  If you want the
questions to be headed simply `1', `2', etc. then do
\begin{verbatim}
   \newtheorem{question}{}
\end{verbatim}

If the questions have parts and subparts, it is sensible to use 
\latexword{enumerate} for them. In that case you probably need to change the 
default numbering of the \latexword{enumerate} environments so that, say, parts
are labelled~`(a)' etc.\ and subparts~`(ii)' etc. The next section shows how 
to do this.

\section*{Exercises}
\begin{qn}
\it
Create a short document with two sections. 
In the first section put one theorem, 
a lemma subtitled `Burnside', another theorem, and a remark. The remark should 
be neither numbered nor in italic. In the second section put another lemma, 
another theorem, a corollary numbered in the same sequence as the theorems, and
finally a theorem in a roman-numbered sequence.
Include cross-references to all the numbered items.
\label{thmdoc}
\end{qn}

\begin{qn}
\it
Redo the previous question, in such a way that lemmas and equations are 
numbered within sections.
\end{qn}

\section{Other numbered things}
\subsection{Numbered lists}
If you use \latexword{enumerate} within a theorem environment then you will 
probably have to change the way that the different levels of enumerated list 
are numbered. This is controlled by commands containing the strings 
\latexword{enumi}, \latexword{enumii}, \latexword{enumiii} and
\latexword{enumiv}. Thus the $N$th level of nesting is controlled by 
\latexword{enumN}.

The counter for \latexword{enumN} is called simply \latexword{enumN}. To alter 
whether the counter is displayed as an arabic numeral, a letter etc., you 
change \verb+\theenumN+ (see \cite[pages~91--92]{leslie} or 
\cite[pages~97--99]{newleslie}.) To alter the printed labels which are
put on the items in the
list, change \verb+\labelenumN+ to be a suitable text containing 
\verb+\theenumN+.

I find that two levels of nesting are quite sufficient within exam questions 
and homework problems. My style files for exams and homeworks contain the lines
\begin{verbatim}
  \renewcommand{\theenumi}{\alph{enumi}}
  \renewcommand{\labelenumi}{(\theenumi)}
  \renewcommand{\theenumii}{\roman{enumii}}
  \renewcommand{\labelenumii}{(\theenumii)}
\end{verbatim}
In a book, you might need to put something similar in the start  of an 
\latexword{exercises} environment.

If you are lazy then you might try to alter just \verb+\labelenumN+. The 
list items will have the correct printed  labels but your printed
cross-references will not match.
The cross-reference generated by a \verb+\ref+ call to a \verb+\label+ in the 
$N$th level of nested \latexword{enumerate}s has the form
\begin{verbatim}
   \p@enumN\theenumN
\end{verbatim}
where \verb+\p@enumN+ usually picks up the \verb+\theenumM+ 
from higher levels ($M < N$), and 
possibly some punctuation. If you don't like the settings of \verb+\p@enumN+ 
that \LaTeX\ gives you by default, you will have to change them in a style file.

\subsection{Footnotes}
Mathematicians usually don't use footnotes, because the footnote marks would be 
interpreted as superscripts or operators. However, we do sometimes like to put 
information at the bottom of the first page of a document, under a horizontal 
line: perhaps an address for correspondence, or a list of AMS subject 
categories. You can do this with a \verb+\footnote+ early in the document, so 
long as you have first done
\begin{verbatim}
   \renewcommand{\thefootnote}{}
\end{verbatim}
It is best to put this command in a small group around the use of 
\verb+\footnote+.

\section*{Exercises}
\begin{qn}
\textit{Modify the document in Exercise~\ref{thmdoc} so that one of the theorems 
has parts and subparts. The parts should be labelled} 
\begin{quote}
[A], [B], \ldots
\end{quote}
\textit{and the subparts}
\begin{quote}
1/, 2/, \ldots .
\end{quote}
\label{enumex}
\end{qn}

\begin{qn}
\textit{Modify the document in Exercise~\ref{enumex} so that the foot of the 
first page carries the text}
\begin{quote}
Key words: construction of designs; neighbour balance; optimality; 
randomization; software.
\end{quote}

\end{qn}

\begin{thebibliography}{9}
\bibitem{amslatex}
\writer{American Mathematical Society}
\book{\AMS-\LaTeX\ Version~1.0 User's Guide}
\publish{American Mathematical Society}{Providence, Rhode Island}
\byear{1990}

\bibitem{companion}
\writer{Goossens,~M., Mittelbach,~F. \& Samarin,~A.}
\book{The \LaTeX\ Companion}
\publish{Addison-Wesley}{Reading, Mass.}
\byear{1994}

\bibitem{dek}
\writer{Knuth,~D.~E.}
\book{The \TeX book}
\publish{Addison-Wesley}{Reading, Mass.}
\byear{1984}

\bibitem{leslie}
\writer{Lamport,~L.}
\book{\LaTeX: A Document Preparation System}
first edition,
\publish{Addison-Wesley}{Reading, Mass.}
\byear{1986}

\bibitem{newleslie}
\writer{Lamport,~L.}
\book{\LaTeX: A Document Preparation System}
second edition, 
\publish{Addison-Wesley}{Reading, Mass.}
\byear{1994}

\bibitem{swan}
\writer{Swanson, E.}
\book{Mathematics into Type}
revised edition,
\publish{American Mathematical Society}{Providence, Rhode Island}
\byear{1979}
\end{thebibliography}
\end{Article}
\endinput

leslie
newleslie
\bibitem{hart}
%\writer{Oxford University Press}
\book{Hart's Rules for Compositors and Readers}
\publish{Oxford University Press}{Oxford}
\byear{1967}
\bibitem{chamb}
\book{The Chambers Dictionary}
\publish{Chambers Harrap}{Edinburgh}
\byear{1993}
\bibitem{chicago}
\book{The Chicago Manual of Style}
\publish{The University of Chicago Press}{Chicago}
\byear{1982}

Like many others, I deplore the proliferation of personal style files
because they inhibit portability of documents. Yet when I first
started to use \LaTeX\ it was obvious to me that a flexible means of
changing the fonts for theorem heads and theorem bodies had to be
provided. I hacked \verb+@begintheorem+ from \latexword{latex.tex} to
produce the code in Figure~\ref{rabcode}. My only excuse for
reproducing it here is that none of the widely available styles gives
the necessary flexibility.
\begin{figure*}
\begin{verbatim}
%commands to change the type face in theorems
%default is heading in small caps, content in roman
\newif\ifplaintheorems
\def\plaintheorems{\plaintheoremstrue}
\def\fancytheorems{\plaintheoremsfalse}

\let\thmheadfont\sc
\let\thmcontfont\rm
\def\theoremheadfontis#1{\def\thmheadfont{#1}}
\def\theoremcontfontis#1{\def\thmcontfont{#1}}

\def\@xnthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname
{\@definecounter{#1}\@addtoreset{#1}{#3}%
\expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand
  \csname the#3\endcsname \@thmcountersep \@thmcounter{#1}}%
     \ifplaintheorems \global\@namedef{#1}{\@thm{#1}{#2}}%
     \else \global\@namedef{#1}{\thmcontfont\@thm{#1}{#2}}\fi%
\global\@namedef{end#1}{\@endtheorem}}}

\def\@ynthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname
{\@definecounter{#1}%
\expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
     \ifplaintheorems \global\@namedef{#1}{\@thm{#1}{#2}}%
     \else \global\@namedef{#1}{\thmcontfont\@thm{#1}{#2}}\fi%
\global\@namedef{end#1}{\@endtheorem}}}

\def\@othm#1[#2]#3{\expandafter\@ifdefinable\csname #1\endcsname
  {\global\@namedef{the#1}{\@nameuse{the#2}}%
\ifplaintheorems \global\@namedef{#1}{\@thm{#2}{#3}}%
\else \global\@namedef{#1}{\thmcontfont\@thm{#2}{#3}}\fi%
\global\@namedef{end#1}{\@endtheorem}}}

\def\@begintheorem#1#2%
     {\trivlist\item[\hskip\labelsep
     \thmheadfont #1\ #2\unskip]}
\def\@opargbegintheorem#1#2#3
     {\trivlist\item[\hskip\labelsep
     \thmheadfont #1\ #2\unskip\ (#3)]}
\end{verbatim}
\caption{Revised code to give flexible changes to fonts in theorems}
\label{rabcode}
\end{figure*}
If you put this code into your style file then you can make all your theorem 
heads come out in italic by doing
\begin{verbatim}
  \theoremheadfontis{\it}
\end{verbatim}
To put all the theorem bodies in slanted type do
\begin{verbatim}
  \theoremcontfontis{\sl}
\end{verbatim}
Each of these commands should be used at most once in the document. However, 
you can also use the command
\begin{verbatim}
  \plaintheorems
\end{verbatim}
After this command has been issued, any theorem environments declared 
subsequently will have their bodies set in `ordinary' type: not necessarily in 
roman, but in {\em whatever font the surrounding text is in}. This seems to me 
most suitable for remarks, definitions and so on. The command 
\verb+\fancytheorems+ nullifies \verb+\plaintheorems+.

\end{Article}
