| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% |
| 5 |
% The LaTeX Project and any individual authors listed elsewhere |
| 6 |
% in this file. |
| 7 |
% |
| 8 |
% This file is part of the Standard LaTeX `Tools Bundle'. |
| 9 |
% ------------------------------------------------------- |
| 10 |
% |
| 11 |
% It may be distributed and/or modified under the |
| 12 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 13 |
% of this license or (at your option) any later version. |
| 14 |
% The latest version of this license is in |
| 15 |
% https://www.latex-project.org/lppl.txt |
| 16 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 17 |
% version 2005/12/01 or later. |
| 18 |
% |
| 19 |
% The list of all files belonging to the LaTeX `Tools Bundle' is |
| 20 |
% given in the file `manifest.txt'. |
| 21 |
% |
| 22 |
% \fi |
| 23 |
% |
| 24 |
%% |
| 25 |
% |
| 26 |
% |
| 27 |
\def\FMithmInfo{2024/08/06 v2.2c Theorem extension package (FMi)} |
| 28 |
% |
| 29 |
% \ProvidesFile{theorem.dtx}[\FMithmInfo] |
| 30 |
%\iffalse % this is a METACOMMENT ! |
| 31 |
%% |
| 32 |
%% Package `theorem' to use with LaTeX2e |
| 33 |
%% Copyright (C) 1989-1995 Frank Mittelbach, all rights reserved. |
| 34 |
%<+package>\@ifundefined{theorem@style}{}{\endinput} |
| 35 |
%<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] |
| 36 |
%<+package>\ProvidesPackage{theorem} |
| 37 |
%<+package> [\FMithmInfo] |
| 38 |
% |
| 39 |
% \fi |
| 40 |
% |
| 41 |
% \changes{v1.0}{87/05/07}{First draft.} |
| 42 |
% \changes{v1.0a}{87/05/07}{`thistheoremstyle' added.} |
| 43 |
% \changes{v1.1a}{87/07/29}{New concept: redefine the internal |
| 44 |
% \protect\LaTeX{} commands `@xnthm' etc.} |
| 45 |
% \changes{v1.1b}{87/07/31}{`theoremfont' used to specify font.} |
| 46 |
% \changes{v1.2a}{88/01/08}{`@endtheorem' now globally defined.} |
| 47 |
% \changes{v1.2b}{88/01/11}{`newtheorem' only allowed in the preamble.} |
| 48 |
% \changes{v1.3a}{88/02/14}{`theoremfont' now a toks register.} |
| 49 |
% |
| 50 |
% \changes{v2.0a}{88/11/16}{New implementation and new documentation.} |
| 51 |
% \changes{v2.0a}{88/11/16}{No layout changes but internal modifications |
| 52 |
% old substyles won't work.} |
| 53 |
% \changes{v2.0b}{89/01/30}{`global' used for all definitions.} |
| 54 |
% \changes{v2.0c}{89/06/15}{Documentation translated to English. |
| 55 |
% Thanks to LLL and Nina} |
| 56 |
% \changes{v2.1a}{90/02/15}{Support for new font selection.} |
| 57 |
% \changes{v2.2a}{94/02/03}{Cleanup for LaTeX2e} |
| 58 |
% |
| 59 |
% \DoNotIndex{\@endparenv,\@ifdefinable,\@ifnextchar,\@ifundefined} |
| 60 |
% \DoNotIndex{\@namedef,\@nameuse,\@spaces,\@tempa,\@warning} |
| 61 |
% \DoNotIndex{\ } |
| 62 |
% \DoNotIndex{\begingroup,\bfseries} |
| 63 |
% \DoNotIndex{\csname} |
| 64 |
% \DoNotIndex{\def,\do,\docdate} |
| 65 |
% \DoNotIndex{\endcsname,\endgroup,\endinput,\endtrivlist,\expandafter} |
| 66 |
% \DoNotIndex{\filedate,\fileversion} |
| 67 |
% \DoNotIndex{\gdef,\global} |
| 68 |
% \DoNotIndex{\hbox,\hskip} |
| 69 |
% \DoNotIndex{\ignorespaces,\input,\itshape,\item} |
| 70 |
% \DoNotIndex{\labelsep,\let,\llap} |
| 71 |
% \DoNotIndex{\makeatletter} |
| 72 |
% \DoNotIndex{\noexpand} |
| 73 |
% \DoNotIndex{\refstepcounter,\relax,\rlap} |
| 74 |
% \DoNotIndex{\setlength,\slshape,\space,\string,\strut} |
| 75 |
% \DoNotIndex{\the,\trivlist,\typeout} |
| 76 |
% \DoNotIndex{\vbox} |
| 77 |
% \DoNotIndex{\xdef} |
| 78 |
% |
| 79 |
% \def\deflabel#1{\ttfamily #1\hfill} |
| 80 |
% \def\deflist#1{\begin{list}{}{\settowidth\labelwidth{\ttfamily #1}% |
| 81 |
% \setlength\leftmargin\labelwidth |
| 82 |
% \addtolength\leftmargin\labelsep |
| 83 |
% \let\makelabel\deflabel}} |
| 84 |
% \def\enddeflist{\end{list}} |
| 85 |
% \def\envfont{\normalfont\ttfamily} |
| 86 |
% |
| 87 |
% \MakeShortVerb{\|} |
| 88 |
% |
| 89 |
% \newcommand{\TUB}{{\sl TUGboat\/}} |
| 90 |
% |
| 91 |
% \GetFileInfo{theorem.dtx} |
| 92 |
% \title{An Extension of the |
| 93 |
% \LaTeX{} theorem environment\thanks{This file |
| 94 |
% has version number \fileversion, last |
| 95 |
% revised \filedate.}} |
| 96 |
% \author{Frank Mittelbach} |
| 97 |
% |
| 98 |
% \MaintainedByLaTeXTeam{tools} |
| 99 |
% \maketitle |
| 100 |
% |
| 101 |
% \changes{v2.2c}{2025-06-04}{Add notice pointing to \textsf{amsthm}} |
| 102 |
% \begin{flushleft} |
| 103 |
% \bfseries |
| 104 |
% This package is retained in the \LaTeX{} \pkg{tools} bundle for |
| 105 |
% stability reasons. Whilst bug fixes will be applied to \pkg{theorem}, |
| 106 |
% no \emph{new} features will be considered. For new material, the |
| 107 |
% \LaTeX{} team recommends that \textsf{amsthm} is used in place of |
| 108 |
% \pkg{theorem}. |
| 109 |
% \end{flushleft} |
| 110 |
% |
| 111 |
% \begin{abstract} |
| 112 |
% The macros described in this paper yield an extension of the |
| 113 |
% \LaTeX{} theorem mechanism. It is designed to satisfy the |
| 114 |
% different requirements of various journals. Thus, the |
| 115 |
% layout of the ``theorems'' can be manipulated by determining a |
| 116 |
% ``style''. This article describes not only the use, but |
| 117 |
% also the definition, of the necessary macros. |
| 118 |
% \end{abstract} |
| 119 |
% |
| 120 |
% \section*{Preface to version 2.2} |
| 121 |
% |
| 122 |
% For \LaTeXe{} this package did not need any fundamental changes. I |
| 123 |
% only modified the messages generated so that theorem layout styles |
| 124 |
% will show up with the |\listfiles| command and cleaned the section |
| 125 |
% on the New Font Selection Scheme since this is now included in |
| 126 |
% \LaTeX. |
| 127 |
% |
| 128 |
% \section*{Preface to version 2.1} |
| 129 |
% |
| 130 |
% This version is identical to 2.0g described in \TUB\ 10\#3 except |
| 131 |
% for some internal defaults which are now set depending on the used |
| 132 |
% font selection scheme. |
| 133 |
% |
| 134 |
% This was done to avoid unpleasant surprises if the new font selection |
| 135 |
% scheme is in force. For further details see |
| 136 |
% section~\ref{sec:newfonts} and \cite{bk:GMS94}. |
| 137 |
% |
| 138 |
% \section{Introduction} |
| 139 |
% |
| 140 |
% For our purposes here, ``theorems'' are labelled enunciations, |
| 141 |
% often set off from the main text by extra space and a font change. |
| 142 |
% Theorems, corollaries, conjectures, definitions, and remarks |
| 143 |
% are all instances of ``theorems''. The ``header'' of these structures |
| 144 |
% is composed of a label (such as \textsc{Theorem} or \textsc{Remark}) |
| 145 |
% and a number which serializes an item in the sequence of items |
| 146 |
% with the same label. |
| 147 |
% |
| 148 |
% Shortly after the introduction of \LaTeX{} at the Fachbereich |
| 149 |
% Mathematik in Mainz, the desire to manipulate the layout of |
| 150 |
% ``theorems'' arose. In Mainz, the following two conventions came |
| 151 |
% into general use: |
| 152 |
% \begin{enumerate} |
| 153 |
% \item The number of the theorem is shown in the margin. |
| 154 |
% \item There is a line break at |
| 155 |
% the end of the theorem header. |
| 156 |
% \end{enumerate} |
| 157 |
% |
| 158 |
% Additionally, some journals require different formats which depend on |
| 159 |
% the ``sort of theorem'': e.g.\ often remarks and definitions are set |
| 160 |
% in |\upshape|, while |\itshape| is employed for main theorems. |
| 161 |
% |
| 162 |
% Confronted with these requirements, a theorem environment was |
| 163 |
% developed in Mainz which allows separate determination of the |
| 164 |
% layout of the ``theorems sets'', comparable to |\pagestyle|. |
| 165 |
% |
| 166 |
% |
| 167 |
% \section{The user interface} |
| 168 |
% \subsection{Defining new theorem sets} |
| 169 |
% |
| 170 |
% \DescribeMacro\newtheorem |
| 171 |
% As in the original \LaTeX{} version, the command |\newtheorem| |
| 172 |
% defines a new ``theorem set'' or ``theorem-like structure''. |
| 173 |
% Two required arguments name the new environment and give the text |
| 174 |
% to be typeset with each instance of the new ``set'', while |
| 175 |
% an optional argument determines how |
| 176 |
% the ``set'' is enumerated: |
| 177 |
% \begin{description} |
| 178 |
% \item[\ttfamily \bslash newtheorem\{foo\}\{bar\}] |
| 179 |
% The theorem set {\envfont foo} (whose name is \texttt{bar}) |
| 180 |
% uses its own counter. |
| 181 |
% \item[\ttfamily \bslash newtheorem\{foo2\}{[foo]}\{bar2\}] |
| 182 |
% The theorem set {\envfont foo2} (printed name \texttt{bar2}) |
| 183 |
% uses the same counter as the theorem set \texttt{foo}. |
| 184 |
% \item[\ttfamily \bslash newtheorem\{foo3\}\{bar3\}{[section]}] |
| 185 |
% The theorem set {\envfont foo3} (printed name \texttt{bar3}) is |
| 186 |
% enumerated within the counter \texttt{section}, i.e.\ with every |
| 187 |
% new |\section| the enumeration begins again with 1, and |
| 188 |
% the enumeration is composed from the section-number and the |
| 189 |
% theorem counter itself. |
| 190 |
% \end{description} |
| 191 |
% |
| 192 |
% \DescribeMacro\theoremstyle |
| 193 |
% Additionally, the command |\theoremstyle| can define the layout |
| 194 |
% of various, or all, theorem sets. It should be noted that any |
| 195 |
% theorem set defined by |\newtheorem| is typeset in the |
| 196 |
% |\theoremstyle| that is current at the time of the definition. |
| 197 |
% Thus, the following |
| 198 |
% \begin{verbatim} |
| 199 |
% \theoremstyle{break} \newtheorem{Cor}{Corollary} |
| 200 |
% \theoremstyle{plain} \newtheorem{Exa}{Example}[section] |
| 201 |
%\end{verbatim} ^^A No blank at line start |
| 202 |
% leads to the result that the set {\envfont Cor} is formatted in the |
| 203 |
% style \texttt{break}, while the set {\envfont Exa} and all the |
| 204 |
% following ones are formatted in the style \texttt{plain}, unless |
| 205 |
% another |\theoremstyle| follows. Since the definitions installed by |
| 206 |
% |\newtheorem| are global, one also can limit |\theoremstyle| locally |
| 207 |
% by grouping braces. |
| 208 |
% |
| 209 |
% \DescribeMacro\theorembodyfont |
| 210 |
% The choice of the font for the theorem body is completely |
| 211 |
% independent of the chosen |\theoremstyle|; this has proven to |
| 212 |
% be very advantageous. For example, |
| 213 |
% \begin{verbatim} |
| 214 |
% {\theorembodyfont{\upshape} \newtheorem{Rem}{Remark}} |
| 215 |
%\end{verbatim} |
| 216 |
% defines a theorem set {\envfont Rem}, which will be set in |
| 217 |
% |\upshape| in the current layout (which in our example is |
| 218 |
% \texttt{plain}). As with |\theoremstyle|, the |\theorembodyfont| |
| 219 |
% chosen is that current at the time of |\newtheorem|. If |
| 220 |
% |\theorembodyfont| is not specified or one defines |
| 221 |
% |\theorembodyfont{}|, then the font used will be that defined by the |
| 222 |
% |\theoremstyle|. |
| 223 |
% |
| 224 |
% \DescribeMacro\theoremheaderfont It is also possible to customize |
| 225 |
% the font used for the theorem headers. This is, however, a global |
| 226 |
% declaration, and therefore there should be at most one |
| 227 |
% |\theoremheaderfont| declaration in the preamble.\footnote{If it is |
| 228 |
% actually necessary to have different header fonts, one has to define |
| 229 |
% new theorem styles (substituting the desired font) or specify the |
| 230 |
% information directly in the \texttt{\bslash newtheorem} declaration |
| 231 |
% (the unclean variant).} |
| 232 |
% |
| 233 |
% \DescribeMacro\theorempreskipamount |
| 234 |
% \DescribeMacro\theorempostskipamount Two additional parameters |
| 235 |
% affect the vertical space around the theorem environments: |
| 236 |
% |\theorempreskipamount| and |\theorempostskipamount| define, |
| 237 |
% respectively, the spacing before and after such an environment. |
| 238 |
% These parameters apply for all theorem sets and can be manipulated |
| 239 |
% with the ordinary length macros. They are rubber lengths |
| 240 |
% (`\textsf{skips}'), and therefore can contain \texttt{plus} and |
| 241 |
% \texttt{minus} parts. |
| 242 |
% |
| 243 |
% Since the definition of theorem sets should---most sensibly---be |
| 244 |
% placed in the preamble, we only allow installation there. |
| 245 |
% It is therefore possible to release the memory used here after |
| 246 |
% |\begin{document}|, in order to make room for other |
| 247 |
% applications. |
| 248 |
% |
| 249 |
% |
| 250 |
% \subsection{Existing theorem styles} |
| 251 |
% |
| 252 |
% The following theorem styles exist to date: |
| 253 |
% \begin{deflist}{marginbreak} |
| 254 |
% \item[plain] |
| 255 |
% This theorem style emulates the original \LaTeX{} definition, |
| 256 |
% except that additionally the parameters |
| 257 |
% |\theorem...skipamount| are used. |
| 258 |
% \item[break] |
| 259 |
% In this style, the theorem header is followed by a line |
| 260 |
% break. |
| 261 |
% \item[marginbreak] |
| 262 |
% The theorem number is set in the margin, and there is a line |
| 263 |
% break as in \texttt{break}. |
| 264 |
% \item[changebreak] |
| 265 |
% Like \texttt{break}, but with header number and text |
| 266 |
% interchanged. |
| 267 |
% \item[change] |
| 268 |
% Header number and text are interchanged, without a line break. |
| 269 |
% \item[margin] |
| 270 |
% The number is set in the left margin, without a line break. |
| 271 |
% \end{deflist} |
| 272 |
% All styles (except \texttt{plain}) select |\slshape| as the default |
| 273 |
% |\theorembodyfont|. |
| 274 |
% |
| 275 |
% |
| 276 |
% \subsection{Examples} |
| 277 |
% |
| 278 |
% Given the above theorem sets {\envfont Cor}, {\envfont Exa} |
| 279 |
% and {\envfont Rem}, |
| 280 |
% suppose that the preamble also contains the declarations: |
| 281 |
% \begin{verbatim} |
| 282 |
% \theoremstyle{marginbreak} \newtheorem{Lem}[Cor]{Lemma} |
| 283 |
% \theoremstyle{change} |
| 284 |
% \theorembodyfont{\itshape} \newtheorem{Def}[Cor]{Definition} |
| 285 |
% |
| 286 |
% \theoremheaderfont{\scshape} |
| 287 |
%\end{verbatim} |
| 288 |
% Then the following are some typical examples of the typeset output |
| 289 |
% resulting from their use. |
| 290 |
% |
| 291 |
% \begin{Cor} |
| 292 |
% This is a sentence typeset in the theorem environment {\envfont |
| 293 |
% Cor}. |
| 294 |
% \end{Cor} |
| 295 |
% |
| 296 |
% \begin{Exa} |
| 297 |
% This is a sentence typeset in the theorem environment {\envfont |
| 298 |
% Exa}. |
| 299 |
% \end{Exa} |
| 300 |
% |
| 301 |
% \begin{Rem} |
| 302 |
% This is a sentence typeset in the theorem environment {\envfont |
| 303 |
% Rem}. |
| 304 |
% \end{Rem} |
| 305 |
% |
| 306 |
% \begin{Lem}[Ben User] |
| 307 |
% This is a sentence typeset in the theorem environment {\envfont |
| 308 |
% Lem}. |
| 309 |
% \end{Lem} |
| 310 |
% |
| 311 |
% \begin{Def}[Very impressive Definition] |
| 312 |
% This is a sentence typeset in the theorem environment {\envfont |
| 313 |
% Def}. |
| 314 |
% \end{Def} |
| 315 |
% |
| 316 |
% The last two examples show the effect of the optional argument to |
| 317 |
% a theorem environment (it is the text typeset in parentheses). |
| 318 |
% |
| 319 |
% |
| 320 |
% \section{Special Considerations} |
| 321 |
% \label{sec:newfonts} |
| 322 |
% |
| 323 |
% Theoremheader and body are implemented as a unit. This means that |
| 324 |
% the |\theoremheaderfont| will inherit characteristics of the |
| 325 |
% |\theorembodyfont| in \LaTeXe. Thus, if for example |
| 326 |
% |\theorembodyfont| is |\itshape| and |\theoremheaderfont| |
| 327 |
% is |\bfseries| the font selected for the header will have the |
| 328 |
% characteristics `bold extended italic'. If this is not desired one |
| 329 |
% should set the |\theoremheaderfont| to something like |
| 330 |
% \begin{verbatim} |
| 331 |
% \theoremheaderfont{\normalfont\bfseries} |
| 332 |
%\end{verbatim} |
| 333 |
% i.e.\ supplying all necessary font information explicitly. |
| 334 |
% |
| 335 |
% |
| 336 |
% |
| 337 |
% \section{Acknowledgements} |
| 338 |
% |
| 339 |
% The publication of this set of macros was only possible with the |
| 340 |
% help of Christina Busse (translating the manuscript into English), |
| 341 |
% Joachim Pense (playing the r\^ole of typist), Chris Rowley |
| 342 |
% (looking everything over) and many others providing useful |
| 343 |
% suggestions. |
| 344 |
% |
| 345 |
% \MaybeStop{% |
| 346 |
% \begin{thebibliography}{9} |
| 347 |
% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach} |
| 348 |
% and \textsc{A.~Samarin}. |
| 349 |
% \newblock The \LaTeX{} Companion. |
| 350 |
% \newblock |
| 351 |
% Addison-Wesley, Reading, Massachusetts, 1994. |
| 352 |
% \bibitem{latex:source} \textsc{Lamport, Leslie.} \newblock |
| 353 |
% \texttt{latex.tex}, version 2.09, date |
| 354 |
% Feb. 1990. |
| 355 |
% \end{thebibliography} |
| 356 |
% \PrintIndex |
| 357 |
% \PrintChanges} |
| 358 |
% |
| 359 |
% |
| 360 |
% \section{The documentation driver file} |
| 361 |
% |
| 362 |
% The next bit of code contains the documentation driver file for |
| 363 |
% \TeX{}, i.e., the file that will produce the documentation you are |
| 364 |
% currently reading. It will be extracted from this file by the |
| 365 |
% \texttt{docstrip} program. Since it is the first code in the file |
| 366 |
% one can alternatively process this file directly with \LaTeXe{} to |
| 367 |
% obtain the documentation. |
| 368 |
% |
| 369 |
% \begin{macrocode} |
| 370 |
%<*driver> |
| 371 |
\documentclass{ltxdoc} |
| 372 |
|
| 373 |
\usepackage{theorem} |
| 374 |
|
| 375 |
%<+driver>% The next few lines define theorem sets which are used |
| 376 |
%<+driver>% in the example section of the documentation. |
| 377 |
|
| 378 |
\theoremstyle{break} \newtheorem{Cor}{Corollary} |
| 379 |
\theoremstyle{plain} \newtheorem{Exa}{Example}[section] |
| 380 |
{\theorembodyfont{\upshape}\newtheorem{Rem}{Remark}} |
| 381 |
\theoremstyle{marginbreak} \newtheorem{Lem}[Cor]{Lemma} |
| 382 |
\theoremstyle{change} |
| 383 |
\theorembodyfont{\itshape} \newtheorem{Def}[Cor]{Definition} |
| 384 |
|
| 385 |
\theoremheaderfont{\scshape} |
| 386 |
|
| 387 |
\RecordChanges |
| 388 |
|
| 389 |
\begin{document} |
| 390 |
\DocInput{theorem.dtx} |
| 391 |
\end{document} |
| 392 |
%</driver> |
| 393 |
% \end{macrocode} |
| 394 |
% |
| 395 |
% \section{Definition of the Macros} |
| 396 |
% |
| 397 |
% If the file has been loaded before, we abort immediately. If not the |
| 398 |
% package announces itself (this is actually done at the very top of |
| 399 |
% the file---the way it is done isn't good style so don't copy it). |
| 400 |
% \changes{v2.0e}{89/07/19}{Spaces removed from `typeout'.} |
| 401 |
% \changes{v2.2b}{95/11/19}{Announce moved to top of file} |
| 402 |
% \begin{macrocode} |
| 403 |
%<*package> |
| 404 |
%\@ifundefined{theorem@style}{}{\endinput} |
| 405 |
%\def\FMithmInfo{1995/11/19 v2.2b Theorem extension package (FMi)} |
| 406 |
%\ProvidesPackage{theorem}[\FMithmInfo] |
| 407 |
% \end{macrocode} |
| 408 |
% |
| 409 |
% |
| 410 |
% \subsection{Definition of theorem styles and fonts} |
| 411 |
% |
| 412 |
% All the definitions in this file are done globally to allow |
| 413 |
% inputting this file inside a group. |
| 414 |
% |
| 415 |
% \begin{macro}{\theoremstyle} |
| 416 |
% Before a theorem style can be installed, the chosen style must be |
| 417 |
% known. For that reason, we must test to see that |
| 418 |
% |\th@|\meta{style} is known or, more precisely, that it is |
| 419 |
% different from |\relax|. If the style is not known then |
| 420 |
% |\th@plain| is used. |
| 421 |
% \begin{macrocode} |
| 422 |
\gdef\theoremstyle#1{% |
| 423 |
\@ifundefined{th@#1}{\@warning |
| 424 |
{Unknown theoremstyle `#1'. Using `plain'}% |
| 425 |
\theorem@style{plain}}% |
| 426 |
% \end{macrocode} |
| 427 |
% We save the theorem style to be used in the token register |
| 428 |
% |\theorem@style|. |
| 429 |
% \begin{macrocode} |
| 430 |
{\theorem@style{#1}}% |
| 431 |
% \end{macrocode} |
| 432 |
% Now we ``evaluate'' the theorem style: this means, we call the |
| 433 |
% macro |\th@|\meta{style} which will activate the relevant |
| 434 |
% definitions which are contained in a separate file. This is done |
| 435 |
% in a group to suppress changes to the current font. This could |
| 436 |
% otherwise pose problems together with the new font selection |
| 437 |
% scheme\footnote{When I printed the original article using the new |
| 438 |
% font selection scheme I ended with a document with slanted |
| 439 |
% typefaces (text headings and all) simply because one of the |
| 440 |
% theorem styles used \texttt{\bslash sl} at toplevel.} if the |
| 441 |
% |\th@|\meta{style} is evaluated a second time. |
| 442 |
% \changes{v2.1a}{90/02/15}{Group added around `th@..} |
| 443 |
% \changes{v2.1a}{90/02/15}{Reseting of `..@begintheorem removed.} |
| 444 |
% \begin{macrocode} |
| 445 |
\begingroup |
| 446 |
\csname th@\the\theorem@style \endcsname |
| 447 |
\endgroup} |
| 448 |
% \end{macrocode} |
| 449 |
% \end{macro} |
| 450 |
% |
| 451 |
% |
| 452 |
% \begin{macro}{\@begintheorem} |
| 453 |
% \changes{v2.1a}{90/02/15}{Relaxed at toplevel.} |
| 454 |
% \begin{macro}{\@opargbegintheorem} |
| 455 |
% \changes{v2.1a}{90/02/15}{Relaxed at toplevel.} |
| 456 |
% We reset |\@begintheorem| and |\@opargbegintheorem| to |
| 457 |
% |\relax| since these commands are no longer necessary at |
| 458 |
% toplevel. This will save a few tokens. |
| 459 |
% \begin{macrocode} |
| 460 |
\global\let\@begintheorem\relax |
| 461 |
\global\let\@opargbegintheorem\relax |
| 462 |
% \end{macrocode} |
| 463 |
% \end{macro} |
| 464 |
% \end{macro} |
| 465 |
% |
| 466 |
% \begin{macro}{\theorem@style} |
| 467 |
% Obviously the \textsf{token} register used above has to be |
| 468 |
% allocated. To assure the utmost compatibility with the |
| 469 |
% original \LaTeX{} definition, we set the default theorem style to |
| 470 |
% \texttt{plain}, which implements the usual \LaTeX{} convention. |
| 471 |
% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} |
| 472 |
% \begin{macrocode} |
| 473 |
\newtoks\theorem@style |
| 474 |
\global\theorem@style{plain} |
| 475 |
% \end{macrocode} |
| 476 |
% \end{macro} |
| 477 |
% |
| 478 |
% \begin{macro}{\theorembodyfont} |
| 479 |
% \begin{macro}{\theorem@bodyfont} |
| 480 |
% If the |\theorembodyfont| is set by the user then it should not |
| 481 |
% interact with the default font set in the theorem style. When the |
| 482 |
% new font selection is in force this may happen if, for example, |
| 483 |
% the default is |\itshape| and the new |\theorembodyfont| is |
| 484 |
% |\sffamily|. So we add a |\reset@font| command in front of the |
| 485 |
% user definition. |
| 486 |
% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} |
| 487 |
% \changes{v2.0g}{89/09/19}{`theoremfont to `theorembodyfont.} |
| 488 |
% \changes{v2.1c}{92/06/22}{`reset@font added and logic changed.} |
| 489 |
% \changes{v2.1d}{92/10/28}{Reset to empty if arg is empty} |
| 490 |
% \begin{macrocode} |
| 491 |
\gdef\theorembodyfont#1{% |
| 492 |
% \end{macrocode} |
| 493 |
% We check if the argument supplied is empty and if so put nothing |
| 494 |
% into the |\theorem@bodyfont| token register to allow for |
| 495 |
% |\theorembodyfont{}| as a mean of using the default of the |
| 496 |
% current |\theoremstyle|. |
| 497 |
% \begin{macrocode} |
| 498 |
\def\@tempa{#1}% |
| 499 |
\ifx\@tempa\@empty |
| 500 |
\theorem@bodyfont{}% |
| 501 |
\else |
| 502 |
\theorem@bodyfont{\reset@font#1}% |
| 503 |
\fi |
| 504 |
} |
| 505 |
\newtoks\theorem@bodyfont |
| 506 |
\global\theorem@bodyfont{} |
| 507 |
% \end{macrocode} |
| 508 |
% \end{macro} |
| 509 |
% \end{macro} |
| 510 |
% |
| 511 |
% |
| 512 |
% \begin{macro}{\theoremheaderfont} |
| 513 |
% \changes{v2.0g}{89/09/19}{Macro added.} |
| 514 |
% The font for the theorem headers is handled differently because |
| 515 |
% this definition applies to all theorem styles. |
| 516 |
% \begin{macrocode} |
| 517 |
\gdef\theoremheaderfont#1{\gdef\theorem@headerfont{#1}% |
| 518 |
% \end{macrocode} |
| 519 |
% After using the macro once it is redefined to produce an error |
| 520 |
% message. |
| 521 |
% \begin{macrocode} |
| 522 |
\gdef\theoremheaderfont##1{% |
| 523 |
\typeout{\string\theoremheaderfont\space should be used |
| 524 |
only once.}}} |
| 525 |
% \end{macrocode} |
| 526 |
% \end{macro} |
| 527 |
% |
| 528 |
% \begin{macro}{\theorem@headerfont} |
| 529 |
% \changes{v2.0g}{89/09/19}{Macro added.} |
| 530 |
% To set the |\theorem@headerfont| default we first test if |
| 531 |
% the new fontselection scheme is in force. |
| 532 |
% \changes{v2.1a}{90/02/15}{Support for new font selection.} |
| 533 |
% \begin{macrocode} |
| 534 |
\ifx\upshape\undefined |
| 535 |
% \end{macrocode} |
| 536 |
% If not we define it to expand into |\bfseries|. We don't use |
| 537 |
% |\let| just in case a following style option redefines this |
| 538 |
% macro. |
| 539 |
% \begin{macrocode} |
| 540 |
\gdef\theorem@headerfont{\bfseries} |
| 541 |
% \end{macrocode} |
| 542 |
% Otherwise we reset the current shape before calling |\bfseries|. |
| 543 |
% \begin{macrocode} |
| 544 |
\else \gdef\theorem@headerfont{\normalfont\bfseries}\fi |
| 545 |
% \end{macrocode} |
| 546 |
% \end{macro} |
| 547 |
% |
| 548 |
% \begin{macro}{\th@plain} |
| 549 |
% \begin{macro}{\th@break} |
| 550 |
% \begin{macro}{\th@marginbreak} |
| 551 |
% \begin{macro}{\th@changebreak} |
| 552 |
% \begin{macro}{\th@change} |
| 553 |
% \begin{macro}{\th@margin} |
| 554 |
% The different styles are defined in macros such as |
| 555 |
% |\th@plain|. Since memory space is precious in |
| 556 |
% ``non-Big-versions'', we have to avoid offering too many unused |
| 557 |
% definitions. Therefore we define these styles in separate files |
| 558 |
% that can be loaded on demand. Thus the commands themselves only |
| 559 |
% load these files. We use |\@input@|, a \LaTeXe{} internal command |
| 560 |
% that ensures that the file will be listed with |\listfiles|. |
| 561 |
% \changes{v2.2a}{94/02/02}{Use `@input@ to load theorem layout files} |
| 562 |
% \begin{macrocode} |
| 563 |
\gdef\th@plain{\@input@{thp.sty}} |
| 564 |
\gdef\th@break{\@input@{thb.sty}} |
| 565 |
\gdef\th@marginbreak{\@input@{thmb.sty}} |
| 566 |
\gdef\th@changebreak{\@input@{thcb.sty}} |
| 567 |
\gdef\th@change{\@input@{thc.sty}} |
| 568 |
\gdef\th@margin{\@input@{thm.sty}} |
| 569 |
% \end{macrocode} |
| 570 |
% This list will be expanded when new styles become |
| 571 |
% available. For testing, just append new theorem substyles |
| 572 |
% as document options. |
| 573 |
% \end{macro} |
| 574 |
% \end{macro} |
| 575 |
% \end{macro} |
| 576 |
% \end{macro} |
| 577 |
% \end{macro} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% |
| 581 |
% |
| 582 |
% \subsection{Definition of a new theorem set} |
| 583 |
% |
| 584 |
% As already pointed out, a new theorem environment can be defined in |
| 585 |
% three different ways: |
| 586 |
% \begin{verbatim} |
| 587 |
% \newtheorem{Lem}{Lemma} |
| 588 |
% \newtheorem{Lem}{Lemma}[section] |
| 589 |
% \newtheorem{Lem}[Theorem]{Lemma} |
| 590 |
%\end{verbatim} |
| 591 |
% The function of the macro |\newtheorem| is to recognize these cases |
| 592 |
% and then to branch into one of the three macros |\@ynthm|, |\@xnthm| |
| 593 |
% or |\@othm|. This mechanism is adopted unchanged from |
| 594 |
% \cite{latex:source}; the essential point here is that, for example, |
| 595 |
% in the second case, the arguments \texttt{Lem}, \texttt{Lemma} and |
| 596 |
% \texttt{section} are passed over to the macro |\@xnthm|. |
| 597 |
% |
| 598 |
% We inspect this case first because the others present fewer problems, |
| 599 |
% and thus are easily derived from this one. |
| 600 |
% |
| 601 |
% \begin{macro}{\@xnthm} |
| 602 |
% For our example arguments, the macro |\@xnthm| must fulfill |
| 603 |
% the following: |
| 604 |
% \begin{itemize} |
| 605 |
% \item |
| 606 |
% Define a new \LaTeX-counter `Lem' |
| 607 |
% \item |
| 608 |
% reset this counter within a |\section| |
| 609 |
% \item |
| 610 |
% define the macro |\theLem| |
| 611 |
% \item |
| 612 |
% define the environment macros |\Lem| and |
| 613 |
% |\endLem| using the current |
| 614 |
% |\theoremstyle| and |\theorem@bodyfont|. |
| 615 |
% \end{itemize} |
| 616 |
% Obviously, all this should happen only if the first argument |
| 617 |
% of |\@xnthm| (i.e.\ \texttt{Lem} in our example) is chosen so |
| 618 |
% as not to conflict with any previously defined commands or |
| 619 |
% environments. This test is performed by the \LaTeX{} macro |
| 620 |
% |\@ifdefinable|. |
| 621 |
% \begin{macrocode} |
| 622 |
\gdef\@xnthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname |
| 623 |
% \end{macrocode} |
| 624 |
% Therefore, the first argument of |\@ifdefinable| is the |
| 625 |
% expansion (in the example, |\Lem|) of |
| 626 |
% |\csname||#1\endcsname|. The second argument is |
| 627 |
% executed only if the test has been completed successfully. |
| 628 |
% \begin{macrocode} |
| 629 |
{% |
| 630 |
% \end{macrocode} |
| 631 |
% Now we define the new counter. The names of the \LaTeX{} |
| 632 |
% macros employed should speak for themselves: |
| 633 |
% \changes{v2.2b}{1995/10/07}{Use \cs{@newctr}} |
| 634 |
% \changes{v2.2c}{1995/11/23}{Use \cs{@newctr} properly.} |
| 635 |
% \begin{macrocode} |
| 636 |
\@definecounter{#1}\@newctr{#1}[#3]% |
| 637 |
% \end{macrocode} |
| 638 |
% Using |\@newctr| will give a proper error message if the counter |
| 639 |
% in |#3| is not defined. |
| 640 |
% In defining `|\theLem|' we must generate the desired macro |
| 641 |
% name by use of |\expandafter| and |\csname|. |
| 642 |
% \begin{macrocode} |
| 643 |
\expandafter\xdef\csname the#1\endcsname |
| 644 |
% \end{macrocode} |
| 645 |
% An |\xdef| is used in order to make the definition global, |
| 646 |
% and to ensure that it contains the replacement texts of |
| 647 |
% |\@thmcountersep| and |\@thmcounter|.\footnote{These |
| 648 |
% two macros can be defined by the document style. Their default |
| 649 |
% values produce a `\texttt{.}' as separation and an arabic |
| 650 |
% representation of the number.} However, not everything should be |
| 651 |
% expanded. For example, it saves space to use |\thesection| |
| 652 |
% instead of its---at times---lengthy expansion. |
| 653 |
% \begin{macrocode} |
| 654 |
{\expandafter \noexpand \csname the#3\endcsname |
| 655 |
\@thmcountersep \@thmcounter{#1}}% |
| 656 |
% \end{macrocode} |
| 657 |
% Thus with the defaults of \LaTeX{}, |\theLem| would be |
| 658 |
% replaced by the command sequence |\thesection.\arabic{Lem}|. |
| 659 |
% |
| 660 |
% We will now look at the definition of the macro which is executed |
| 661 |
% at the beginning of the actual environment (in our example this |
| 662 |
% macro is |\Lem|). It should be noted that we use an |
| 663 |
% ``|\expandafter| trick'' to expand only certain parts of the |
| 664 |
% replacement text at the time of the definition. |
| 665 |
% \begin{macrocode} |
| 666 |
\def\@tempa{\global\@namedef{#1}}% |
| 667 |
\expandafter \@tempa \expandafter{% |
| 668 |
% \end{macrocode} |
| 669 |
% First, the macro that contains the current definitions of |
| 670 |
% |\@begintheorem| and |\@opargtheorem| should be called |
| 671 |
% up. The name of this macro---as is already known---has the form |
| 672 |
% |\th@|\meta{theorem\ style}; therefore, it must be called by |
| 673 |
% \begin{macrocode} |
| 674 |
\csname th@\the \theorem@style |
| 675 |
% \end{macrocode} |
| 676 |
% In addition the default theorem font should be changeable, i.e.\ |
| 677 |
% we have to insert the contents of |\theorem@bodyfont|. For |
| 678 |
% that reason, we expand even further, beyond |\endcsname|, |
| 679 |
% and thus insert the contents of the \textsf{token} register |
| 680 |
% |\theorem@bodyfont| in the replacement text. |
| 681 |
% \begin{macrocode} |
| 682 |
\expandafter \endcsname \the \theorem@bodyfont |
| 683 |
% \end{macrocode} |
| 684 |
% Now it is time to call the macro |\@thm| which takes over |
| 685 |
% the further processing. It has two arguments: the current |
| 686 |
% counter name (in our example, \texttt{Lem}), and the text of the |
| 687 |
% label (in our example, \texttt{Lemma}). |
| 688 |
% \begin{macrocode} |
| 689 |
\@thm{#1}{#2}}% |
| 690 |
% \end{macrocode} |
| 691 |
% With this, the `sub-definition' is complete. The macro |
| 692 |
% |\@endtheorem| ends a theorem environment and is, so far, nothing |
| 693 |
% but an |\endtrivlist|. (Hence it is defined globally, and not |
| 694 |
% within the theorem styles.\footnote{This has to be changed as |
| 695 |
% soon as theorem styles that change \texttt{\bslash @endtheorem} |
| 696 |
% exist. In such a case, all existing styles must be changed as |
| 697 |
% well since they will have to reset the macro.}) Therefore, we can |
| 698 |
% set it equivalent to the macro that ends the theorem set (in our |
| 699 |
% example, |\endLem|). However, if some day theorem styles exist |
| 700 |
% that do change |\@endtheorem|, we would have to use the |
| 701 |
% commented-out line instead. |
| 702 |
% \begin{macrocode} |
| 703 |
\global \expandafter \let \csname end#1\endcsname \@endtheorem |
| 704 |
% \global\@namedef{end#1}{\@endtheorem}% |
| 705 |
% \end{macrocode} |
| 706 |
% With these commands all the required definitions are employed, |
| 707 |
% unless the test |\@ifdefinable| has failed. Therefore, we |
| 708 |
% end the second argument of this macro and with it the definition |
| 709 |
% of |\@xnthm|. |
| 710 |
% \begin{macrocode} |
| 711 |
}} |
| 712 |
% \end{macrocode} |
| 713 |
% \end{macro} |
| 714 |
% |
| 715 |
% \begin{macro}{\@ynthm} |
| 716 |
% The definition of |\@ynthm| is completely analogous. In |
| 717 |
% this case the new counter that is defined is not reset within |
| 718 |
% another counter; thus the definition of |\the...| |
| 719 |
% is simplified: |
| 720 |
% \begin{macrocode} |
| 721 |
\gdef\@ynthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname |
| 722 |
{\@definecounter{#1}% |
| 723 |
\expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}% |
| 724 |
% \end{macrocode} |
| 725 |
% The rest of the definition corresponds literally to that of |
| 726 |
% |\@xnthm|: |
| 727 |
% \begin{macrocode} |
| 728 |
\def\@tempa{\global\@namedef{#1}}\expandafter \@tempa |
| 729 |
\expandafter{\csname th@\the \theorem@style \expandafter |
| 730 |
\endcsname \the\theorem@bodyfont \@thm{#1}{#2}}% |
| 731 |
\global \expandafter \let \csname end#1\endcsname \@endtheorem}} |
| 732 |
% \end{macrocode} |
| 733 |
% \end{macro} |
| 734 |
% |
| 735 |
% \begin{macro}{\@othm} |
| 736 |
% The definition of |\@othm| does not contain anything new. |
| 737 |
% \begin{macrocode} |
| 738 |
\gdef\@othm#1[#2]#3{% |
| 739 |
% \end{macrocode} |
| 740 |
% \changes{v2.2b}{95/10/07}{Build in check for counter defined} |
| 741 |
% We do not define a new counter but instead use one that has |
| 742 |
% already been defined. Thus the only definition we need is that |
| 743 |
% of this pseudo-counter (i.e.\ |\the|\meta{env.\ name}). |
| 744 |
% First we check if |#2| corresponds to a known counter name. |
| 745 |
% \begin{macrocode} |
| 746 |
\expandafter\ifx\csname c@#2\endcsname\relax |
| 747 |
\@nocounterr{#2}% |
| 748 |
\else |
| 749 |
\expandafter\@ifdefinable\csname #1\endcsname |
| 750 |
{\expandafter \xdef \csname the#1\endcsname |
| 751 |
{\expandafter \noexpand \csname the#2\endcsname}% |
| 752 |
% \end{macrocode} |
| 753 |
% All other parts of the definition can be adopted from |
| 754 |
% |\@xnthm|. We have to remember, though, that in this case |
| 755 |
% the name of the current counter and the theorem label have moved |
| 756 |
% to the second and third arguments. |
| 757 |
% \begin{macrocode} |
| 758 |
\def\@tempa{\global\@namedef{#1}}\expandafter \@tempa |
| 759 |
\expandafter{\csname th@\the \theorem@style \expandafter |
| 760 |
\endcsname \the\theorem@bodyfont \@thm{#2}{#3}}% |
| 761 |
\global \expandafter \let \csname end#1\endcsname \@endtheorem}% |
| 762 |
\fi} |
| 763 |
% \end{macrocode} |
| 764 |
% \end{macro} |
| 765 |
% |
| 766 |
% \subsection{Macros that are employed in a {\envfont theorem} |
| 767 |
% environment} |
| 768 |
% |
| 769 |
% \begin{macro}{\@thm} |
| 770 |
% The macro |\@thm| has to increase the current counter. Then, |
| 771 |
% depending on whether the environment has (or does not have) an |
| 772 |
% optional argument, it has to branch into either |\@begintheorem| |
| 773 |
% or |\@opargtheorem|. |
| 774 |
% \begin{macrocode} |
| 775 |
\gdef\@thm#1#2{\refstepcounter{#1}% |
| 776 |
% \end{macrocode} |
| 777 |
% Now we start a {\envfont trivlist} environment, and give |
| 778 |
% |\@topsep| and |\@topsepadd| the values of the \textsf{skip} |
| 779 |
% registers |\theorempreskipamount| and |\theorempostskipamount|. |
| 780 |
% The value in |\@topsep| is the vertical space that is inserted by |
| 781 |
% the first (and only) |\item| in our |\trivlist| whilst |
| 782 |
% |\@topsepadd| is inserted by |\@endparenv| at the end of that |
| 783 |
% {\envfont trivlist} environment. By using these registers, we |
| 784 |
% obtain the desired space around a {\envfont theorem} environment. |
| 785 |
% \begin{macrocode} |
| 786 |
\trivlist |
| 787 |
\@topsep \theorempreskipamount % used by first \item |
| 788 |
\@topsepadd \theorempostskipamount % used by \@endparenv |
| 789 |
% \end{macrocode} |
| 790 |
% Now we have to test whether an optional argument has been given. |
| 791 |
% \changes{v2.0d}{89/07/18}{Forgotten percent added.} |
| 792 |
% \begin{macrocode} |
| 793 |
\@ifnextchar [% |
| 794 |
% \end{macrocode} |
| 795 |
% If there is an optional argument, we will call |\@ythm|, and |
| 796 |
% move the arguments read back into the input stream. |
| 797 |
% \begin{macrocode} |
| 798 |
{\@ythm{#1}{#2}}% |
| 799 |
% \end{macrocode} |
| 800 |
% If not, we call |\@begintheorem|. Its first argument is the |
| 801 |
% name of the theorem set (hence the second argument of |
| 802 |
% |\@thm|). Its second argument is the macro that produces the |
| 803 |
% current number. |
| 804 |
% \begin{macrocode} |
| 805 |
{\@begintheorem{#2}{\csname the#1\endcsname}\ignorespaces}} |
| 806 |
% \end{macrocode} |
| 807 |
% \end{macro} |
| 808 |
% |
| 809 |
% \begin{macro}{\@xthm} |
| 810 |
% \begin{macro}{\@ythm} |
| 811 |
% Both these macros were originally called by |\@thm|. We do |
| 812 |
% not need |\@xthm| anymore, hence we reset it to |
| 813 |
% |\relax|. The definition of |\@ythm| has not changed at |
| 814 |
% all from its definition in \LaTeX. In order to make the macros |
| 815 |
% easier to understand, we will |
| 816 |
% nevertheless present it (commented out). |
| 817 |
% \begin{macrocode} |
| 818 |
\global\let\@xthm\relax |
| 819 |
% \def\@ythm#1#2[#3]{\@opargbegintheorem{#2}{\csname |
| 820 |
% the#1\endcsname}{#3}\ignorespaces} |
| 821 |
%</package> |
| 822 |
% \end{macrocode} |
| 823 |
% The primitive |\ignorespaces| in |\@ythm| and |
| 824 |
% |\@thm| is needed to remove the spaces between the |
| 825 |
% |\begin{...}| and the actual text. |
| 826 |
% \end{macro} |
| 827 |
% \end{macro} |
| 828 |
% |
| 829 |
% |
| 830 |
% \subsection{Definition of the theorem substyles} |
| 831 |
% |
| 832 |
% As already pointed out, the theorem substyles, defined below, are |
| 833 |
% only loaded when necessary. Note that all these substyles, except |
| 834 |
% \texttt{plain}, have |\slshape| as the default body font. |
| 835 |
% |
| 836 |
% \subsubsection{The \texttt{plain} style} |
| 837 |
% |
| 838 |
% \label{dok:th@plain} As the following macros use |@|, we have |
| 839 |
% to locally set the |\catcode| of this symbol to ``letter''. |
| 840 |
% This happens within a group, so that we do not have to worry about |
| 841 |
% which |\catcode| that symbol had before. |
| 842 |
% \begin{macrocode} |
| 843 |
%<*thp> |
| 844 |
\begingroup \makeatletter |
| 845 |
% \end{macrocode} |
| 846 |
% Since we are now within a group, we must make all definitions |
| 847 |
% globally. First we make sure that \texttt{theorem.sty} is loaded. |
| 848 |
% This will allow us to use this file as a document style option |
| 849 |
% without having to call \texttt{theorem} itself as an option. At the |
| 850 |
% same time, we assure that at least version 2 is loaded, since |
| 851 |
% |\theorem@style| was not defined in earlier versions. |
| 852 |
% \begin{macrocode} |
| 853 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 854 |
\ProvidesFile{thp.sty} |
| 855 |
[\FMithmInfo] |
| 856 |
% \end{macrocode} |
| 857 |
% |
| 858 |
% |
| 859 |
% \begin{macro}{\th@plain} |
| 860 |
% \begin{macro}{\@begintheorem} |
| 861 |
% \begin{macro}{\@opargbegintheorem} |
| 862 |
% |\theoremstyle{plain}| corresponds to the original |
| 863 |
% definition, except that the distances to the surrounding text are |
| 864 |
% determined by the parameters |\theorempreskipamount| and |
| 865 |
% |\theorempostskipamount|. |
| 866 |
% First we set the default body font. |
| 867 |
% \begin{macrocode} |
| 868 |
\gdef\th@plain{\normalfont\itshape |
| 869 |
% \end{macrocode} |
| 870 |
% Then we define |\@begintheorem| and |
| 871 |
% |\@opargbegintheorem|. These two macros define how the |
| 872 |
% header of a theorem is typeset. |\@opargbegintheorem| will |
| 873 |
% be called if a \textsf{theorem} environment with an optional |
| 874 |
% argument is encountered; otherwise, the header is constructed by |
| 875 |
% calling |\@begintheorem|. If one of these macros is |
| 876 |
% executed, we are within a \textsf{trivlist} environment started by |
| 877 |
% |\@thm|. So the theorem header is produced with an |
| 878 |
% |\item| command. |
| 879 |
% |
| 880 |
% Instead of specifying the header font directly, all standard |
| 881 |
% theorem styles use the |\theorem@headerfont| macro to allow |
| 882 |
% customization. The extra space (|\labelsep|) is necessary |
| 883 |
% because of problems in the \textsf{trivlist} environment. |
| 884 |
% \begin{macrocode} |
| 885 |
\def\@begintheorem##1##2{% |
| 886 |
\item[\hskip\labelsep \theorem@headerfont ##1\ ##2]}% |
| 887 |
% \end{macrocode} |
| 888 |
% The definition of |\@opargbegintheorem| is completely |
| 889 |
% analogous. The only difference is the fact that there exists a |
| 890 |
% third argument (which is the optional parameter of the |
| 891 |
% environment and contains additional information about the |
| 892 |
% theorem). Customarily we enclose it in parentheses. |
| 893 |
% \begin{macrocode} |
| 894 |
\def\@opargbegintheorem##1##2##3{% |
| 895 |
\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)]}} |
| 896 |
% \end{macrocode} |
| 897 |
% \end{macro} |
| 898 |
% \end{macro} |
| 899 |
% \end{macro} |
| 900 |
% |
| 901 |
% \noindent |
| 902 |
% We conclude with an |\endgroup| to restore the |
| 903 |
% |\catcode| of |@|. |
| 904 |
% \begin{macrocode} |
| 905 |
\endgroup |
| 906 |
%</thp> |
| 907 |
% \end{macrocode} |
| 908 |
% |
| 909 |
% |
| 910 |
% \subsubsection{The \texttt{break} style} |
| 911 |
% |
| 912 |
% This style option is stored in the file |thb.sty|. |
| 913 |
% For the next two lines see the documentation for |\th@plain| on |
| 914 |
% page~\pageref{dok:th@plain}. |
| 915 |
% \begin{macrocode} |
| 916 |
%<*thb> |
| 917 |
\begingroup \makeatletter |
| 918 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 919 |
\ProvidesFile{thb.sty} |
| 920 |
[\FMithmInfo] |
| 921 |
% \end{macrocode} |
| 922 |
% |
| 923 |
% \begin{macro}{\th@break} |
| 924 |
% |\theoremstyle{break}| produces a line break after the name |
| 925 |
% of the theorem. The font is |\slshape|. Hence, we define |
| 926 |
% |\th@break| as follows: |
| 927 |
% \begin{macrocode} |
| 928 |
\gdef\th@break{\normalfont\slshape |
| 929 |
\def\@begintheorem##1##2{\item[% |
| 930 |
% \end{macrocode} |
| 931 |
% We run into the following problem: it is not possible to create |
| 932 |
% the header with |\item[|\meta{title}|]| and then start |
| 933 |
% a new line by, for example, |\mbox{}\\|. Such a definition |
| 934 |
% will fail whenever a list environment follows immediately. With |
| 935 |
% the above construction, the |\mbox{}| causes the switch |
| 936 |
% |@inlabel| (cf.\ definition of |\list| and |
| 937 |
% |\trivlist| in \cite{latex:source}) to be set to \texttt{false} |
| 938 |
% and so the following list will insert additional vertical |
| 939 |
% space (|\topskip|). This is quite annoying. Therefore, we |
| 940 |
% create the line break within the |\item|. In order to ensure |
| 941 |
% that the text will begin at the proper position in the following |
| 942 |
% line, we simply pretend that the label does not take any |
| 943 |
% room.\footnote{This will lead to problems whenever very high |
| 944 |
% symbols occurring in the line tower into the |
| 945 |
% heading. So, something else has to be done here sometime.} |
| 946 |
% \begin{macrocode} |
| 947 |
\rlap{\vbox{\hbox{\hskip \labelsep\theorem@headerfont ##1\ ##2}% |
| 948 |
\hbox{\strut}}}]}% |
| 949 |
% \end{macrocode} |
| 950 |
% Again, the definition of |\@opargbegintheorem| is |
| 951 |
% completely analogous. |
| 952 |
% \begin{macrocode} |
| 953 |
\def\@opargbegintheorem##1##2##3{% |
| 954 |
\item[\rlap{\vbox{\hbox{\hskip \labelsep \theorem@headerfont |
| 955 |
##1\ ##2\ (##3)}% |
| 956 |
\hbox{\strut}}}]}} |
| 957 |
\endgroup |
| 958 |
%</thb> |
| 959 |
% \end{macrocode} |
| 960 |
% \end{macro} |
| 961 |
% |
| 962 |
% |
| 963 |
% \subsubsection{The \texttt{changebreak} style} |
| 964 |
% |
| 965 |
% This style option is stored in the file |thcb.sty|. |
| 966 |
% \begin{macrocode} |
| 967 |
%<*thcb> |
| 968 |
\begingroup \makeatletter |
| 969 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 970 |
\ProvidesFile{thcb.sty} |
| 971 |
[\FMithmInfo] |
| 972 |
% \end{macrocode} |
| 973 |
% |
| 974 |
% \begin{macro}{\th@changebreak} |
| 975 |
% The \texttt{change-break} theorem style is like \texttt{break} |
| 976 |
% but with interchange of theorem name and theorem number. Thus we |
| 977 |
% define |\th@changebreak| as follows: |
| 978 |
% \begin{macrocode} |
| 979 |
\gdef\th@changebreak{\normalfont\slshape |
| 980 |
\def\@begintheorem##1##2{\item |
| 981 |
[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont ##2\ ##1}% |
| 982 |
\hbox{\strut}}}]}% |
| 983 |
\def\@opargbegintheorem##1##2##3{% |
| 984 |
\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont |
| 985 |
##2\ ##1\ (##3)}% |
| 986 |
\hbox{\strut}}}]}} |
| 987 |
\endgroup |
| 988 |
%</thcb> |
| 989 |
% \end{macrocode} |
| 990 |
% \end{macro} |
| 991 |
% |
| 992 |
% |
| 993 |
% \subsubsection{The \texttt{change} style} |
| 994 |
% |
| 995 |
% This style option is stored in the file |thc.sty|. |
| 996 |
% \begin{macrocode} |
| 997 |
%<*thc> |
| 998 |
\begingroup \makeatletter |
| 999 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 1000 |
\ProvidesFile{thc.sty} |
| 1001 |
[\FMithmInfo] |
| 1002 |
% \end{macrocode} |
| 1003 |
% |
| 1004 |
% \begin{macro}{\th@change} |
| 1005 |
% The \texttt{change} theorem style corresponds to the |
| 1006 |
% \texttt{change break} style without a linebreak after the header. |
| 1007 |
% To say it in another way, it's the same as the \texttt{plain} |
| 1008 |
% style but with number and name interchanged and |\slshape| as the |
| 1009 |
% default font. |
| 1010 |
% \begin{macrocode} |
| 1011 |
\gdef\th@change{\normalfont\slshape |
| 1012 |
\def\@begintheorem##1##2{\item |
| 1013 |
[\hskip\labelsep \theorem@headerfont ##2\ ##1]}% |
| 1014 |
\def\@opargbegintheorem##1##2##3{% |
| 1015 |
\item[\hskip\labelsep \theorem@headerfont ##2\ ##1\ (##3)]}} |
| 1016 |
\endgroup |
| 1017 |
%</thc> |
| 1018 |
% \end{macrocode} |
| 1019 |
% \end{macro} |
| 1020 |
% |
| 1021 |
% |
| 1022 |
% \subsubsection{The \texttt{marginbreak} style} |
| 1023 |
% |
| 1024 |
% This style option is the one used most often at Mainz. It is saved |
| 1025 |
% in the file |thmb.sty|. |
| 1026 |
% \begin{macrocode} |
| 1027 |
%<*thmb> |
| 1028 |
\begingroup \makeatletter |
| 1029 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 1030 |
\ProvidesFile{thmb.sty} |
| 1031 |
[\FMithmInfo] |
| 1032 |
% \end{macrocode} |
| 1033 |
% |
| 1034 |
% \begin{macro}{\th@marginbreak} |
| 1035 |
% The \texttt{margin break} style is nearly the same as the |
| 1036 |
% \texttt{change break} style. The only difference is the placement |
| 1037 |
% of the theorem number. We use |\llap| to place it in the left |
| 1038 |
% margin. |
| 1039 |
% |
| 1040 |
% In this style |\labelsep| denotes the separation between the |
| 1041 |
% number and the text. |
| 1042 |
% \begin{macrocode} |
| 1043 |
\gdef\th@marginbreak{\normalfont\slshape |
| 1044 |
\def\@begintheorem##1##2{\item |
| 1045 |
[\rlap{\vbox{\theorem@headerfont |
| 1046 |
\hbox{\llap{##2}\hskip\labelsep ##1}% |
| 1047 |
\hbox{\strut}}}]}% |
| 1048 |
\def\@opargbegintheorem##1##2##3{% |
| 1049 |
\item[\rlap{\vbox{\theorem@headerfont |
| 1050 |
\hbox{\llap{##2}\hskip\labelsep ##1\ (##3)}% |
| 1051 |
\hbox{\strut}}}]}} |
| 1052 |
\endgroup |
| 1053 |
%</thmb> |
| 1054 |
% \end{macrocode} |
| 1055 |
% \changes{v2.1c}{90/02/17}{`endgroup outside macrocode env.} |
| 1056 |
% \end{macro} |
| 1057 |
% |
| 1058 |
% |
| 1059 |
% |
| 1060 |
% \subsubsection{The \texttt{margin} style} |
| 1061 |
% |
| 1062 |
% This style option is stored in the file |thm.sty|. |
| 1063 |
% \begin{macrocode} |
| 1064 |
%<*thm> |
| 1065 |
\begingroup \makeatletter |
| 1066 |
\@ifundefined{theorem@style}{\input{theorem.sty}}{} |
| 1067 |
\ProvidesFile{thm.sty} |
| 1068 |
[\FMithmInfo] |
| 1069 |
% \end{macrocode} |
| 1070 |
% |
| 1071 |
% \begin{macro}{\th@margin} |
| 1072 |
% Again this is only a variant of the theorem styles described |
| 1073 |
% above without any new ideas. |
| 1074 |
% \begin{macrocode} |
| 1075 |
\gdef\th@margin{\normalfont\slshape |
| 1076 |
\def\@begintheorem##1##2{\item |
| 1077 |
[\theorem@headerfont \llap{##2}\hskip\labelsep ##1]}% |
| 1078 |
\def\@opargbegintheorem##1##2##3{% |
| 1079 |
\item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\ (##3)]}} |
| 1080 |
\endgroup |
| 1081 |
%</thm> |
| 1082 |
% \end{macrocode} |
| 1083 |
% \end{macro} |
| 1084 |
% |
| 1085 |
% |
| 1086 |
% |
| 1087 |
% |
| 1088 |
% \subsection{Final Definitions} |
| 1089 |
% |
| 1090 |
% \begin{macro}{\theorempreskipamount} |
| 1091 |
% \begin{macro}{\theorempostskipamount} |
| 1092 |
% The \textsf{skip} parameters that regulate the vertical empty space |
| 1093 |
% before and after the {\envfont theorem} environment have |
| 1094 |
% to be allocated as well. |
| 1095 |
% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} |
| 1096 |
% \begin{macrocode} |
| 1097 |
%<*package> |
| 1098 |
\newskip\theorempreskipamount |
| 1099 |
\newskip\theorempostskipamount |
| 1100 |
% \end{macrocode} |
| 1101 |
% Since we have used the same values for all theorem sets, we now can |
| 1102 |
% assign them. |
| 1103 |
% \begin{macrocode} |
| 1104 |
\global\setlength\theorempreskipamount{12pt plus 5pt minus 3pt} |
| 1105 |
\global\setlength\theorempostskipamount{8pt plus 3pt minus 1.5pt} |
| 1106 |
% \end{macrocode} |
| 1107 |
% \end{macro} |
| 1108 |
% \end{macro} |
| 1109 |
% |
| 1110 |
% |
| 1111 |
% \begin{macro}{\@endtheorem} |
| 1112 |
% The same holds for the macro |\@endtheorem|, which ends a |
| 1113 |
% {\envfont theorem} environment. Since it is the same for all |
| 1114 |
% theorem sets, it is removed from the macros |\th@|\meta{style}. |
| 1115 |
% It simply ends the {\envfont trivlist} environment, which was |
| 1116 |
% begun in |\@thm|. |
| 1117 |
% \begin{macrocode} |
| 1118 |
\global\let\@endtheorem=\endtrivlist |
| 1119 |
% \end{macrocode} |
| 1120 |
% \end{macro} |
| 1121 |
% |
| 1122 |
% |
| 1123 |
% |
| 1124 |
% \begin{macro}{\@preamblecmds} |
| 1125 |
% All macros defined above are to be used only in the preamble. |
| 1126 |
% Therefore, we insert them in |\@preamblecmds| which will disable |
| 1127 |
% them at begin document. This is done by the internal \LaTeXe{} |
| 1128 |
% command |\@onlypreamble|. |
| 1129 |
% \changes{v2.0g}{89/09/19}{`theoremheaderfont and `theorembodyfont |
| 1130 |
% added.} |
| 1131 |
% \changes{v2.2a}{94/02/03}{Use \LaTeXe{} interface} |
| 1132 |
% \begin{macrocode} |
| 1133 |
\@onlypreamble\@xnthm |
| 1134 |
\@onlypreamble\@ynthm |
| 1135 |
\@onlypreamble\@othm |
| 1136 |
\@onlypreamble\newtheorem |
| 1137 |
\@onlypreamble\theoremstyle |
| 1138 |
\@onlypreamble\theorembodyfont |
| 1139 |
\@onlypreamble\theoremheaderfont |
| 1140 |
% \end{macrocode} |
| 1141 |
% \end{macro} |
| 1142 |
% |
| 1143 |
% Finally we declare the \texttt{plain} theorem style to be the default. |
| 1144 |
% \changes{v2.1b}{90/06/04}{Fixed missing `item by declaring default |
| 1145 |
% style.} |
| 1146 |
% \begin{macrocode} |
| 1147 |
\theoremstyle{plain} |
| 1148 |
%</package> |
| 1149 |
% \end{macrocode} |
| 1150 |
% |
| 1151 |
% \Finale |
| 1152 |
|
| 1153 |
\endinput |