An Extension of the L^{A}TEX theorem environment^{∗}

Frank Mittelbach Electronic Data Systems (Deutschland) GmbH Eisenstraße 56 D-65424 Rüsselsheim Federal Republic of Germany

August 19, 1996

Abstract

The macros described in this paper yield an extension of the L^{A}TEX theorem mechanism. It is designed is to satisfy the different requirements of various journals. Thus, the layout of the “theorems” can be manipulated by determining a “style”. This article describes not only the use, but also the definition, of the necessary macros.

Preface to version 2.2

For L^{A}TEX 2ε this package did not need any fundamental changes. I only modified the messages generated so that theorem layout styles will show up with the \listfiles command and cleaned the section on the New Font Selection Scheme since this is now included in L^{A}TEX.

Preface to version 2.1

This version is identical to 2.0g described in TUGboat 10#3 except for some internal defaults which are now set depending on the used font selection scheme.

This was done to avoid unpleasant surprises if the new font selection scheme is in force. For further details see section 3 and [1].

1 Introduction

For our purposes here, “theorems” are labelled enunciations, often set off from the main text by extra space and a font change. Theorems, corollaries, conjectures, definitions, and remarks are all instances of “theorems”. The “header” of these structures is composed of a label (such as Theorem or Remark) and a number which serializes an item in the sequence of items with the same label.

∗This file has version number v2.2c, last revised 1995/11/23.

Shortly after the introduction of L^{A}TEX at the Fachbereich Mathematik in Mainz, the desire to manipulate the layout of “theorems” arose. In Mainz, the following two conventions came into general use:

1. The number of the theorem is shown in the margin.

2. There is a line break at the end of the theorem header.

Additionally, some journals require different formats which depend on the “sort of theorem”: e.g. often remarks and definitions are set in \upshape, while \itshape is employed for main theorems.

Confronted with these requirements, a theorem environment was developed in Mainz which allows separate determination of the layout of the “theorems sets”, comparable to \pagestyle.

2 The user interface

2.1 Defining new theorem sets

\newtheorem As in the original L^{A}TEX version, the command \newtheorem defines a new “theorem set” or “theorem-like structure”. Two required arguments name the new environment and give the text to be typeset with each instance of the new “set”, while an optional argument determines how the “set” is enumerated:

\newtheorem{foo}{bar} The theorem set foo (whose name is bar) uses its own counter.

\newtheorem{foo2}[foo]{bar2} The theorem set foo2 (printed name bar2)

uses the same counter as the theorem set foo.

\newtheorem{foo3}{bar3}[section] The theorem set foo3 (printed name bar3)

is enumerated within the counter section, i.e. with every new \section the enumeration begins again with 1, and the enumeration is composed from the section-number and the theorem counter itself.

\theoremstyle Additionally, the command \theoremstyle can define the layout of various, or all, theorem sets. It should be noted that any theorem set defined by \newtheorem is typeset in the \theoremstyle that is current at the time of the definition. Thus, the following

    \theoremstyle{break}        \newtheorem{Cor}{Corollary}
    \theoremstyle{plain}        \newtheorem{Exa}{Example}[section]

leads to the result that the set Cor is formatted in the style break, while the set Exa and all the following ones are formatted in the style plain, unless another \theoremstyle follows. Since the definitions installed by \newtheorem are global, one also can limit \theoremstyle locally by grouping braces.

\theorembodyfont The choice of the font for the theorem body is completely independent of the chosen \theoremstyle; this has proven to be very advantageous. For example,

   {\theorembodyfont{\upshape}          \newtheorem{Rem}{Remark}}

defines a theorem set Rem, which will be set in \upshape in the current layout

(which in our example is plain). As with \theoremstyle, the \theorembodyfont

chosen is that current at the time of \newtheorem. If \theorembodyfont is not specified or one defines \theorembodyfont{}, then the font used will be that

defined by the \theoremstyle.

\theoremheaderfont It is also possible to customize the font used for the theorem headers. This is, however, a global declaration, and therefore there should be at most one \theoremheaderfont declaration in the preamble.^{1}

\theorempreskipamount Two additional parameters affect the vertical space around the theorem en-

\theorempostskipamount vironments: \theorempreskipamount and \theorempostskipamount define, re-

spectively, the spacing before and after such an environment. These parameters apply for all theorem sets and can be manipulated with the ordinary length macros. They are rubber lengths, (‘skips’), and therefore can contain plus and minus parts.

Since the definition of theorem sets should—most sensibly—be placed in the preamble, we only allow installation there. It is therefore possible to release the memory used here after \begin{document}, in order to make room for other applications.

2.2 Existing theorem styles

The following theorem styles exist to date:

plain This theorem style emulates the original L^{A}TEX definition, except that additionally the parameters \theorem...skipamount are used.

break In this style, the theorem header is followed by a line break.

marginbreak The theorem number is set in the margin, and there is a line break

            as in break.

changebreak Like break, but with header number and text interchanged.

change Header number and text are interchanged, without a line break.

margin The number is set in the left margin, without a line break.

All styles (except plain) select \slshape as the default \theorembodyfont.

2.3 Examples

Given the above theorem sets Cor, Exa and Rem, suppose that the preamble also contains the declarations:

    \theoremstyle{marginbreak}   \newtheorem{Lem}[Cor]{Lemma}
    \theoremstyle{change}
    \theorembodyfont{\itshape}        \newtheorem{Def}[Cor]{Definition}
    \theoremheaderfont{\scshape}

1If it is actually necessary to have different header fonts, one has to define new theorem styles (substituting the desired font) or specify the information directly in the \newtheorem declaration (the unclean variant).

Then the following are some typical examples of the typeset output resulting from their use.

Corollary 1 This is a sentence typeset in the theorem environment Cor.

Example 2.1 This is a sentence typeset in the theorem environment Exa.

Remark 1 This is a sentence typeset in the theorem environment Rem.

2 Lemma (Ben User) This is a sentence typeset in the theorem environment Lem.

3 Definition (Very impressive Definition) This is a sentence typeset in the theorem environment Def.

The last two examples show the effect of the optional argument to a theorem environment (it is the text typeset in parentheses).

3 Special Considerations

Theoremheader and body are implemented as a unit. This means that the

\theoremheaderfont will inherit characteristics of the \theorembodyfont in
L^{A}TEX 2ε. Thus, if for example \theorembodyfont is \itshape and \theoremheaderfont

is \bfseries the font selected for the header will have the characteristics ‘bold extended italic’. If this is not desired one should set the \theoremheaderfont to something like

      \theoremheaderfont{\normalfont\bfseries}

i.e. supplying all necessary font informations explicitly.

4 Acknowledgements

The publication of this set of macros was only possible with the help of Christina Busse (translating the manuscript into English), Joachim Pense (playing the rôle of typist), Chris Rowley (looking everything over) and many others providing useful suggestions.

References

[1] M. Goossens, F. Mittelbach and A. Samarin. The L^{A}TEX Companion. Addison-Wesley, Reading, Massachusetts, 1994.

[2] Lamport, Leslie. latex.tex, version 2.09, date Feb. 1990.