%%% An item for Topical Tips \title{Topical tip: Numbering theorems and corollaries in \LaTeX} \newtheorem{prequestion}{Question} \newtheorem{preanswer}{Answer} \renewcommand{\thepreanswer}{} \newenvironment{question}{\begin{prequestion}\rm}{\end{prequestion}} %%% %%% Dear Mr Editor, I should like the content of questions and answers %%% to come out in what all copy-editors call ROMAN, not in what %%% Frank Mittelbach calls roman. And this should be irrespective %%% of the surrounding text. %%% \newenvironment{answer}{\begin{preanswer}\rm}{\end{preanswer}} \author[R.~A.~Bailey]{R.~A.~Bailey\\Goldsmiths' College, University of London} %%% \newcommand{\latexword}[1]{{\ttfamily\fontshape{n}{#1}}} %%% and the above should be in typewriter-ordinary IRRESPECTIVE of the %%% surrounding fonts %%% \newcommand{\theoremheadfont}[1]{\textbf{#1}} %%% %%% 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. %%% \newcommand{\lamport}{{\itshape \LaTeX: A Document Preparation System\/} by Leslie Lamport} \newcommand{\shortlamp}{{\itshape The Manual}} \begin{Article} \begin{question} We Mathematicians can't use \LaTeX. We need to be able to choose how to label our theorems. For example, I like to have my important theorems numbered in a sequence Theorem~A, Theorem~B and so on, and the less important theorems numbered Theorem~1, Theorem~2 and so on. You can't do that in \LaTeX. \label{sieb} \end{question} \begin{answer} Oh yes you can, and using nothing more than you can find in \lamport, hereafter called \shortlamp. Pages 58--59 of \shortlamp\ show how to set up a simple theorem environment. The command \begin{verbatim} \newtheorem{thm}{Theorem} \end{verbatim} creates an environment called \latexword{thm}. Then each use of this environment produces something whose heading is \theoremheadfont{Theorem}. It is true that these theorems are numbered 1, 2,~3, etc. To obtain something numbered A, B,~C, etc., use the numbering commands given on page~92 of \shortlamp. Thus \begin{verbatim} \newtheorem{main}{Theorem} \renewcommand{\themain}{\Alph{main}} \end{verbatim} creates an environment called \latexword{main} whose heading is also \theoremheadfont{Theorem} but whose instances are numbered A, B, \ldots. Cross-references work correctly too: if you label the third \latexword{main} with \verb+\label{mmm}+ and refer to it with \verb+Theorem~\ref{mmm}+ then it will be called Theorem~C. \end{answer} \begin{question} Journal editors are so fussy. They all want me to number my corollaries in different ways. The first wants corollaries numbered in the same sequence as theorems; the second wants them numbered in a separate sequence of their own; the third wants the corollaries after Theorem~7 to be numbered Corollary~7.1, Corollary~7.2, etc.; while the fourth also wants the corollaries to start renumbering after each theorem, but wants the corollaries after Theorem~7 to be numbered Corollary~1, Corollary~2 etc. How do I do all of this? \end{question} \begin{answer} It is not hard to do these things, because \LaTeX\ is provided with the \latexword{newtheorem} command. I shall assume that you have defined an environment \latexword{thm} as in the answer to Question~\ref{sieb}. The instructions on pages~58--59 of \shortlamp\ show us how to satisfy the first three editors. For the first, put \begin{verbatim} \newtheorem{cor}[thm]{Corollary} \end{verbatim} and you will get an environment called \latexword{cor} whose instances are called \theoremheadfont{Corollary} numbered in the same sequence as the theorems. For the second, put \begin{verbatim} \newtheorem{cor}{Corollary} \end{verbatim} and for the third put \begin{verbatim} \newtheorem{cor}{Corollary}[thm] \end{verbatim} For the fourth editor, we need the extra information from page~92. The third command above makes the \latexword{cor} counter start again after each \latexword{thm}, but it causes the Corollary number to be printed as, say, 7.1 rather than~1. We can cure this by putting \begin{verbatim} \newtheorem{cor}{Corollary}[thm] \renewcommand{\thecor}{\arabic{cor}} \end{verbatim} In each of the four cases you get an environment called \latexword{cor} whose instances are called \theoremheadfont{Corollary}. Only the system of numbering is different. You should now be able to work out how to make the corollaries after Theorem~5 come out as Corollary~5a, Corollary~5b, and so on. \end{answer} \end{Article}