Debian Codegraph @

texmf-dist/source/latex/ntheorem/ntheorem.dtx

raw
1 \def\filedate{2011/08/15}
2 \def\docdate{2011/08/15}
3 \def\fileversion{1.33}
4 \def\basename{ntheorem}
5 % \iffalse
6 %
7 % Package 'ntheorem' to use with LaTeX2e
8 % Copyright 1997 - 2011 by Wolfgang May and Andreas Schedler.
9 %
10 % Written and maintained by
11 % Wolfgang May (Uni Goettingen, formerly Uni Freiburg)
12 % [theorem-marks, general layout]
13 % and Andreas Schedler (formerly TU Clausthal; formerly
14 % Andreas Schlechte)
15 % [theorem-lists, list layout]
16 %
17 %% This file may be distributed and/or modified under the
18 %% conditions of the LaTeX Project Public License, either version 1.2
19 %% of this license or (at your option) any later version.
20 %% The latest version of this license is in
21 %% http://www.latex-project.org/lppl.txt
22 %% and version 1.2 or later is part of all distributions of LaTeX
23 %% version 1999/12/01 or later.
24 %
25 % Please send bugreports and suggestions to
26 %
27 % Wolfgang May
28 % Institut f"ur Informatik, Universit"at Goettingen
29 % e-mail: [email protected]
30 %
31 % Andreas Schedler
32 % e-mail: [email protected]
33 %
34 % \fi
35 %
36 % \CheckSum{2850}
37 %% \CharacterTable
38 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
39 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
40 %% Digits \0\1\2\3\4\5\6\7\8\9
41 %% Exclamation \! Double quote \" Hash (number) \#
42 %% Dollar \$ Percent \% Ampersand \&
43 %% Acute accent \' Left paren \( Right paren \)
44 %% Asterisk \* Plus \+ Comma \,
45 %% Minus \- Point \. Solidus \/
46 %% Colon \: Semicolon \; Less than \<
47 %% Equals \= Greater than \> Question mark \?
48 %% Commercial at \@ Left bracket \[ Backslash \\
49 %% Right bracket \] Circumflex \^ Underscore \_
50 %% Grave accent \` Left brace \{ Vertical bar \|
51 %% Right brace \} Tilde \~}
52 %
53 % \RecordChanges
54 % \changes{v0.80}{1997/02/11}{Started integration of `thmmarks.sty' with
55 % `newthm.sty':}
56 % \changes{v0.82}{1997/02/12}{included handling of theoremlists from
57 % newthm.sty (WM)}
58 % \changes{v0.85}{1997/02/14}{replaced `bf' by corresponding \LaTeXe-commands (AS)}
59 % \changes{v0.87}{1997/02/18}{Renamed style to `ntheorem.sty' (WM)}
60 % \changes{v0.88}{1997/02/18}{fixed some package-infos (AS)}
61 % \changes{v0.90}{1997/02/19}{changed `addtheoremline, @nthm, @othm' (WM)}
62 % \changes{v0.90}{1997/02/19}{counter only active if `if@thmmarks' (WM)}
63 % \changes{v0.91}{1997/02/24}{moved things from @othm, @xnthm, @ynthm to
64 % @newtheorem, introduced @@name (WM)}
65 % \changes{v0.91}{1997/02/24}{added name* (no entry in list) (WM)}
66 % \changes{v0.91}{1997/02/28}{included .sty in .dtx file (WM)}
67 % \changes{v1.00}{1997/04/21}{First official version, not changed against 0.94 (WM)}
68 % \changes{v1.01}{1997/05/01}{changed some `def' to `gdef' and `edef'
69 % to `xdef' in `newtheorem' and related
70 % macros (WM)}
71 % \changes{v1.17}{1999/09/06}{Y2K for changes in documentation (AS)}
72 % \changes{v1.17}{1999/09/06}{included option noconfig in driver (AS)}
73 % \changes{v1.18}{1999/12/23}{debugged starred version of 'newtheorem'
74 % (WM, reported by Jonathan King)}
75 % \changes{v1.18}{1999/12/25}{adapted for complex theorem keywords
76 % (WM, reported by Jonathan King)}
77 % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (WM, several
78 % solutions by Giovanni Dore)}
79 % \changes{v1.19}{2001/01/13}{added handling of amsmath-labels with thref;
80 % moved option thref before amsmath (amsmath needs redefinition of
81 % `label') (WM)}
82 % \changes{v1.21}{2002/12/30}{added theoremprework and postwork (WM)}
83 % \changes{v1.32}{2011/02/28}{implemented new theorem skip scheme (WM)}
84 %
85 % \MakeShortVerb{\|}
86 % \def\envfont{\normalfont\ttfamily}
87 % \def\deflabel#1{\ttfamily #1\hfill}
88 % \def\deflist#1{\begin{list}{}{\settowidth\labelwidth{\ttfamily #1}%
89 % \setlength\leftmargin\labelwidth
90 % \addtolength\leftmargin\labelsep
91 % \let\makelabel\deflabel}}
92 % \def\enddeflist{\end{list}}
93 %
94 % \def\packedlist#1{%
95 % \begin{list}{}{\settowidth\labelwidth{#1}\setlength\leftmargin\labelwidth
96 % \addtolength\leftmargin\labelsep
97 % \topsep=0pt\itemsep=0.05cm\parsep=0.05cm
98 % \let\makelabel\nlabel}}
99 % \def\endpackedlist{\end{list}}
100 % \makeatletter
101 % \def\packeddescr{%
102 % \begin{list}{}{\leftmargin0.5cm
103 % \labelwidth\z@\itemindent-\leftmargin
104 % \topsep=0pt\itemsep=0.05cm\parsep=0.05cm
105 % \let\makelabel\nlabel}}
106 % \def\endpackeddescr{\end{list}}
107 %
108 % \def\Codelabel#1{\@bsphack
109 % \protected@write\@auxout{}{\string\newlabel{#1}{{\number\the
110 % \c@CodelineNo}{\thepage}}}\@esphack}
111 % \newcounter{tmpcount}
112 % \def\Coderef#1#2{\setcounter{tmpcount}{0}\@ifundefined{r@#1}\relax
113 % {\setcounter{tmpcount}{\ref{#1}}}\relax
114 % \addtocounter{tmpcount}{#2}\arabic{tmpcount}}
115 % \makeatother
116 %
117 % \def\nlabel#1{#1\hfill}
118 % \def\nlist#1{\begin{list}{}{\settowidth\labelwidth{#1}%
119 % \setlength\leftmargin\labelwidth
120 % \addtolength\leftmargin\labelsep
121 % \let\makelabel\nlabel}}
122 % \def\endnlist{\end{list}}
123 % \def\DANGER{{\LARGE\textbf{! }\rule{0pt}{2ex}}}
124 % \def\env{\meta{env}}
125 % \def\envx{\meta{env'}}
126 %
127 % \theoremstyle{marginbreak}
128 % \theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
129 % \theoremsymbol{\ensuremath{\diamondsuit}}
130 % \theoremseparator{:}
131 % \newtheorem{Theorem}{Theorem}
132 %
133 % \theoremstyle{changebreak}
134 % \theoremsymbol{\ensuremath{\heartsuit}}
135 % \theoremindent0.5cm
136 % \theoremnumbering{greek}
137 % \newtheorem{Lemma}{Lemma}
138 %
139 % \theoremindent0cm
140 % \theoremsymbol{\ensuremath{\spadesuit}}
141 % \theoremnumbering{arabic}
142 % \newtheorem{Corollary}[Theorem]{Corollary}
143 %
144 % \theoremstyle{change}
145 % \theorembodyfont{\upshape}
146 % \theoremsymbol{\ensuremath{\ast}}
147 % \theoremseparator{}
148 % \newtheorem{Example}{Example}
149 %
150 % \theoremstyle{plain}
151 % \theoremsymbol{\ensuremath{\clubsuit}}
152 % \theoremseparator{.}
153 % \theoremprework{\bigskip\hrule}
154 % \theorempostwork{\hrule\bigskip}
155 % \newtheorem{Definition}{Definition}
156 %
157 % \theoremheaderfont{\sc}\theorembodyfont{\upshape}
158 % \theoremstyle{nonumberplain}
159 % \theoremseparator{}
160 % \theoremsymbol{\rule{1ex}{1ex}}
161 % \newtheorem{Proof}{Proof}%
162 %
163 %
164 % \title{An Extension of the \LaTeX-Theorem Evironment\thanks{This
165 % file has version number \fileversion{}, last revised \filedate.}}
166 % \author{\setcounter{footnote}{2}%
167 % Wolfgang May\thanks{\texttt{[email protected]}}\\
168 % Institut f\"ur Informatik, \\
169 % Universit\"at G\"ottingen \\
170 % Germany
171 % \and
172 % Andreas Schedler\thanks{\texttt{[email protected]}}\\
173 % }
174 % \date{\filedate}
175 % \maketitle
176 %
177 % \begin{abstract}
178 % \noindent
179 % |ntheorem.sty| is a package for handling theorem-like
180 % environments.
181 % Aditionally to several features for defining the layout of
182 % theorem-like environments which can be regarded to be standard
183 % requirements for a theorem-package, it provides solutions for
184 % two related problems: placement of endmarks and generation of
185 % lists of theorem-like environments.
186 %
187 % In contrast to former approaches, it solves the problem of
188 % setting endmarks of theorem-like environments (theorems,
189 % definitions, examples, and proofs) \emph{automatically} at the
190 % right positions, even if the environment ends with a |displaymath|
191 % or (even nested) list environments, it also copes with the
192 % |amsmath| package.
193 % This is done in the same manner as the handling of labels by
194 % using the |.aux| file.
195 %
196 % It also introduces the generation of lists of theorem-like
197 % environments in the same manner as |listoffigures|. Additionally,
198 % more comfortable referencing is supported.
199 %
200 % After running \LaTeX\ several times (depending on the complexity
201 % of references, in general, three runs are sufficient), the endmarks
202 % are set correctly, and theoremlists are generated.
203 %
204 % Since |ntheorem.sty| uses the standard \LaTeX\ |\newtheorem|
205 % command, existing documents can be switched to
206 % |ntheorem.sty| without having to change the |.tex| file.
207 % Also, it is compatible with \LaTeX\ files using |theorem.sty|
208 % written by Frank Mittelbach.
209 % \end{abstract}
210 % \newpage
211 %
212 % \tableofcontents
213 %
214 %
215 % \section{Introduction}
216 %
217 % For our purposes here, ``theorems'' are labelled enunciations,
218 % often set off from the main text by extra space and a font change.
219 % Theorems, corollaries, conjectures, definitions, examples,
220 % remarks, and proofs are all instances of ``theorems''.
221 % The ``header'' of
222 % these structures is composed of the type of the structure
223 % (such as \textsc{Theorem} or \textsc{Remark}), a number
224 % which serializes the instances of the same type throughout the
225 % document, and an optional name (such as ``Correctness Theorem'').
226 %
227 % The layout of theorems can be changed by parameters as the fonts
228 % of the header and the body, the way how to arrange the headers,
229 % the indentation, and the way of numbering it.
230 % Confronted with these requirements, |theorem.sty|, a style for
231 % dealing with theorem layout was developed by Frank Mittelbach
232 % which was the standard theorem-environment for long time.
233 %
234 % But then the desire for additional features like ``endmarks''
235 % and ``theorem-lists'' arose.
236 % Two extensions of |theorem.sty| were developped: One for handling
237 % endmarks, |thmmarks.sty| and one for generating lists, |newthm.sty|.
238 % Thus, Frank Mittelbach suggested to combine the new features into
239 % one ``standard-to-be'' package.
240 % And now, here it is.
241 %
242 % \section{The User-Interface}
243 % \subsection{How to include the package}
244 %
245 % The package |ntheorem.sty| is included by
246 % \begin{quote}
247 % |\usepackage[|\meta{options}|]{ntheorem}|,
248 % \end{quote}
249 % where the optional parameter \meta{options} selects predefined
250 % configurations and special requirements.
251 %
252 % The following \meta{options} are available by now, concerning
253 % partially independent issues:
254 % \begin{description}
255 % \item[Predefined environments:] (see Section~\ref{sec:standard})
256 % With [standard] and [noconfig], it can be chosen, if and what
257 % file is used for activating a (user-defined) standard set of
258 % theorem environments.
259 % \item[Fancy boxes around theorems:] The [framed] option allows
260 % to use |framed.sty| that provides boxes even across pagebreaks.
261 % \item[Activation of endmarks:]
262 % [thmmarks] enables the automatical placement of endmarks
263 % (see \ref{sec:general}); when using the |amsmath|-package,
264 % [thmmarks] must be complemented by [amsmath]
265 % (see Section~\ref{sec:amslatex}).
266 % \item[Activation of extended reference features:]
267 % [thref] enables the extended reference features
268 % (see Section~\ref{sec-ExtRef}); when using the |amsmath|-package,
269 % [thref] must be complemented by [amsmath]
270 % (see Section~\ref{sec:amslatex}).
271 % \item[Compatibility with amsthm:] option [amsthm] provides
272 % compatibility with the theorem-layout
273 % commands of the |amsthm|-package (see Section~\ref{sec:amslatex}).
274 % \item[Compatibility with hyperref:] option [hyperref] provides
275 % compability with the |hyperref|-package
276 % (see Section~\ref{sec:hyperref}).
277 % \end{description}
278 %
279 % The package itself loads |ifthen.sty|.
280 %
281 % \subsection{Defining New Theorem Sets}
282 %
283 % \DescribeMacro\newtheorem
284 % The syntax and semantics is exactly the same as in standard
285 % \LaTeX{}: the command |\newtheorem| defines a new ``theorem set''
286 % or ``theorem-like structure''.
287 % Two required arguments name the new environment set and give the
288 % text to be typeset with each instance of the new ``set'', while
289 % an optional argument determines how the ``set'' is enumerated:
290 % \begin{description}
291 % \item[\ttfamily \bslash newtheorem\{foo\}\{bar\}]
292 % The theorem set {\envfont foo} (whose name is \texttt{bar})
293 % uses its own counter.
294 % \item[\ttfamily \bslash newtheorem\{foo2\}{[foo]}\{bar2\}]
295 % The theorem set {\envfont foo2} (printed name \texttt{bar2})
296 % uses the same counter as the theorem set \texttt{foo}.
297 % \item[\ttfamily \bslash newtheorem\{foo3\}\{bar\}{[section]}]
298 % The theorem set {\envfont foo3} (printed name \texttt{bar}) is
299 % enumerated within the counter \texttt{section}, i.e.\ with every
300 % new |\section| the enumeration begins again with 1, and
301 % the enumeration is composed from the section-number and the
302 % theorem counter itself.
303 % \end{description}
304 %
305 % For every environment \meta{name}\ defined by |\newtheorem|,
306 % \emph{two} enviroments \meta{name} and \meta{name|*|}\ are defined.
307 % In the main document, they have exactly the same effect, but
308 % the latter causes no entry in the respective list of theorems
309 % (cf.\ |\section| and |\section*|), see also Section
310 % \ref{sec:thmlists}.
311 %
312 % \DescribeMacro\renewtheorem
313 % Theorem sets can be redefined by |\renewtheorem|, with the same arguments
314 % as explained for |\newtheorem|. When redefining a theorem set, the
315 % counter is not re-initialized.
316 %
317 % \subsection{Defining the Layout of Theorem Sets}\label{sec:general}
318 %
319 % For theorem-like environments, the user can set parameters
320 % by setting several switches and then calling |\newtheorem|.
321 % The layout of a theorem set is defined with the values of the switches
322 % at the time |\newtheorem| is called.
323 %
324 % \subsubsection{Parameters for Individual Sets}
325 % \label{se-new-skips}
326 %
327 % The layout of individual theorem sets can be further determined
328 % by switches controlling the appearance of the headers and the
329 % header-body-layout:
330 %
331 % \begin{itemize}
332 % \item
333 % \DescribeMacro\theoremstyle
334 % |\theoremstyle{|\meta{style}|}|: The general structure of the
335 % theorem layout is defined via its |\theoremstyle|. |\ntheorem|
336 % provides several predefined styles including those of
337 % Frank Mittelbach's |theorem.sty|
338 % (cf.\ Section \ref{sec:predefdstyles}.
339 % Additional styles can be defined by |\newtheoremstyle|
340 % (cf.\ Section\ref{sec:newtheoremstyle}).
341 % \item
342 % \DescribeMacro\theoremheaderfont
343 % |\theoremheaderfont{|\meta{fontcmds}|}|: The theorem header is set
344 % in the font specified by \meta{fontcmds}.
345 %
346 % In contrast to |theorem.sty|, |\theoremheaderfont| can be set
347 % individually for each environment type.
348 % \item
349 % \DescribeMacro\theorembodyfont
350 % |\theorembodyfont{|\meta{fontcmds}|}|: The theorem body is set
351 % in the font specified by \meta{fontcmds}.
352 % \item
353 % \DescribeMacro\theoremnumbering
354 % |\theoremnumbering{|\meta{style}|}| specifies the appearance of
355 % the numbering of the theorem set. Possible \meta{styles} are
356 % |arabic| (default), |alph|, |Alph|, |roman|,
357 % |Roman|, |greek|, |Greek|, and |fnsymbol|.
358 %
359 % Clearly, if a theorem-environment uses the counter of another
360 % environment type, also the numbering style of that environment
361 % is used.
362 % \item
363 % \DescribeMacro\theoremseparator
364 % |\theoremseparator{|\meta{thing}|}|: \meta{thing} separates the
365 % header from the body of the theorem-environment.
366 % E.g., \meta{thing} can be
367 % ``:'' or ``.''.
368 % \item
369 % \DescribeMacro\theorempreskip
370 % \DescribeMacro\theorempostskip
371 % |\theorempreskip{|\meta{skip}|}| and
372 % |\theorempostskip{|\meta{skip}|}| can be used to specify the
373 % vertical space before/after the theorem environment (note that
374 % Section~\ref{sec-framed} that allows framed and shaded theorems
375 % also defines additional skip parameters).
376 % The arguments are rubber lengths,
377 % (`\textsf{skips}'), and therefore can contain \texttt{plus} and
378 % \texttt{minus} parts.
379 % (Note that these parameters changed with version 1.32; see
380 % Section~\ref{sec-old-skips}.)
381 % \item
382 % \DescribeMacro\theoremindent
383 % |\theoremindent|\meta{dimen} can be used to indent the theorem wrt.\
384 % the surrounding text (note that |\theoremindent| is specified
385 % without |{|\ldots|}|).
386 %
387 % \DANGER It's a `\textsf(dimen)', so the user shouldn't try to specify a
388 % \texttt{plus} or \texttt{minus} part, because this leads to an error.
389 % \item
390 % \DescribeMacro\theoremsymbol
391 % |\theoremsymbol{|\meta{thing}|}|: This is only active if
392 % |ntheorem.sty| is loaded with option |[thmmarks]|.
393 % \meta{thing} is set as an endmark at the end of every instance
394 % of the environment.
395 % If no symbol should appear, say |\theoremsymbol{}|.
396 % \end{itemize}
397 %
398 % The above properties carry over to all subsequent |\newtheorem|
399 % statements until they are set differently. Initially, they have
400 % default values.
401 %
402 % The following two properties apply only to the very next |\newtheorem|
403 % and are then automatically reset:
404 %
405 % \begin{itemize}
406 % \item
407 % \DescribeMacro\theoremprework
408 % \changes{v1.30}{2010/08/14}{`theoremprework': added comment on
409 % `leavevmode' to documentation (WM)}
410 % |\theoremprework{|\meta{thing}|}|: \meta{thing} is performed
411 % before starting the theorem structure.
412 % E.g., \meta{thing} can be |\bigskip\hrule\leavevmode|.
413 % If the vertical space after your theoremprework does not look as
414 % intended, try to put |\leavevmode| at its end (as in the above
415 % example).
416 % \item
417 % \DescribeMacro\theorempostwork
418 % |\theorempostwork{|\meta{thing}|}|: \meta{thing} is performed
419 % after finishing the theorem structure.
420 % E.g., \meta{thing} can be |\hrule|.
421 % \end{itemize}
422 %
423 % The flexibility provided by these command should relieve the
424 % users from the ugly hacking in |\newtheorem| to fit most of
425 % the requirements stated by publishers or supervisors.
426 %
427 % \DescribeMacro\theoremclass
428 % With the command |\theoremclass{|\meta{theorem-type}|}|
429 % (where \meta{theorem-type} must be an already defined theorem type),
430 % these parameters can be set to the values which were used when
431 % |\newtheorem| was called for \meta{theorem-type}.
432 %
433 % With |\theoremclass{LaTeX}|, the standard \LaTeX\ layout can be
434 % chosen.
435 %
436 % \subsubsection{Font Selection}
437 %
438 % From the document structuring point of view, theorem environments
439 % are regarded as special parts inside a document. Furthermore,
440 % the theorem header is only a distinguished part of a theorem
441 % environment.
442 % Thus, |\theoremheaderfont| inherits characteristics of
443 % |\theorembodyfont| which also inherits in characteristics of
444 % the font of the surrounding environment.
445 % Thus, if for example |\theorembodyfont| is |\itshape| and
446 % |\theoremheaderfont| is |\bfseries| the font selected for the
447 % header will have the characteristics `bold extended italic'.
448 % If this is not desired, the corresponding property has to be
449 % explicitly overwritten in |\theoremheaderfont|, e.g.
450 % by |\theoremheaderfont{\normalfont\bfseries}|
451 %
452 % \subsubsection{Predefined theorem styles}\label{sec:predefdstyles}
453 %
454 % The following theorem styles are predefined, covering those
455 % from |theorem.sty|:
456 % \begin{deflist}{nonumberbreak:}
457 % \item[plain]
458 % This theorem style emulates the original \LaTeX{} definition,
459 % except that additionally the parameters
460 % |\theorem...skipamount| are used.
461 % \item[break]
462 % In this style, the theorem header is followed by a line
463 % break.
464 % \item[change]
465 % Header number and text are interchanged, without a line break.
466 % \item[changebreak]
467 % Like \texttt{change}, but with a line break after the header.
468 % \item[margin]
469 % The number is set in the left margin, without a line break.
470 % \item[marginbreak]
471 % Like \texttt{margin}, but with a line break after the header.
472 % \item[nonumberplain]
473 % Like \texttt{plain}, without number (e.g.\ for proofs).
474 % \item[nonumberbreak]
475 % Like \texttt{break}, without number.
476 % \item[empty]
477 % No number, no name. Only the optional argument is typeset.
478 % \end{deflist}
479 %
480 % \subsubsection{Default Setting}
481 %
482 % If no option is given, i.e.\ |ntheorem.sty| is loaded by
483 % |\usepackage{ntheorem.sty}|, the following default is set up:
484 % \begin{quote}
485 % |\theoremstyle{plain}|,\\
486 % |\theoremheaderfont{\normalfont\bfseries}| and\\
487 % |\theorembodyfont{\itshape}|,\\
488 % |\theoremseparator{}|,\\
489 % |\theorempreskip{\topsep}|, \\
490 % |\theorempostskip{\topsep}|, where |\topsep| refers to the space
491 % that \LaTeX\ inserts above and below lists, \\
492 % |\theoremindent0cm|,\\
493 % |\theoremnumbering{arabic}|, \\
494 % |\theoremsymbol{}|.
495 % \end{quote}
496 % Thus, by only saying |\newtheorem{...}{...}|, the user gets
497 % the same layout as in standard \LaTeX.
498 %
499 %
500 % \subsubsection{Deprecated: Skips until Version 1.32}
501 % \label{sec-old-skips}
502 %
503 % \DescribeMacro\theorempreskipamount
504 % \DescribeMacro\theorempostskipamount
505 % Until version 1.31, there was only a simplified handling
506 % of vertical space before/after theorems that did not consider
507 % framed and shaded theorems (that have been introduced with v1.21).
508 % |\theorempreskipamount|\meta{skip} and
509 % |\theorempostskipamount|\meta{skip} defined,
510 % respectively, the spacing before and after such an environment
511 % (note that both are specified without |{|\ldots|}|).
512 % These parameters applied for all theorem sets and can be manipulated
513 % with the ordinary length macros. They are rubber lengths,
514 % (`\textsf{skips}'), and therefore can contain \texttt{plus} and
515 % \texttt{minus} parts.
516 %
517 % Unchanged, older \LaTeX\ sources that used these commands yield the
518 % same output as before since the new skip scheme described in
519 % Section~\ref{se-new-skips} is only activated if one of its commands
520 % is used. Otherwise, the old scheme is applied.
521 %
522 %
523 % \subsubsection{A Standard Set of Theorems}\label{sec:standard}
524 %
525 % A standard configuration of theorem sets is provided within
526 % the file |ntheorem.std|, which will be included by the option
527 % |[standard]|. It uses the |amssymb| and |latexsym| (automatically
528 % loaded) packages and defines the following sets:
529 % \begin{nlist}{Definitions:}
530 % \item[Theorems:] % |Theorem|, |Lemma|, |Proposition|,
531 % |Corollary|, |Satz|, |Korollar|,
532 % \item[Definitions:] |Definition|,
533 % \item[Examples:] |Example|, |Beispiel|,
534 % \item[Remarks:] |Anmerkung|, |Bemerkung|, |Remark|,
535 % \item[Proofs:] |Proof| and |Beweis|.
536 % \end{nlist}
537 % These theorem sets seem to be the most frequently used environments
538 % in english and german
539 % documents.
540 %
541 % The layout is defined to be theoremstyle |plain|, bodyfont |\itshape|,
542 % Headerfont |\bfseries|, and endmark (theoremsymbol)
543 % |\ensuremath{_\Box}| for all theorem-like environments\footnote{Note,
544 % that mathmode is ensured for the symbol.}.
545 % For the definition-, remark- and example-like sets,
546 % the above setting is used, except bodyfont |\upshape|.
547 % The proof-like sets are handled a bit differently. There, the layout
548 % is defined as theoremstyle |nonumberplain|, bodyfont |\upshape|,
549 % headerfont |\scshape| and endmark |\ensuremath{_\blacksquare}|.
550 % For a more detailed information look at
551 % |ntheorem.std| or at the code-section.
552 %
553 % \subsubsection{Framed and Boxed Theorems}\label{sec:frames-and-boxes}
554 %
555 % With the advent of the |framed| package (by Donald Arseneau) in 2001,
556 % a feature that has often been asked for for ntheorem could be
557 % implemented: theorems that are framed, or that are put into a colored
558 % box.
559 % It requires to load the |framed| package; shaded theorems also
560 % require the |pstricks| package.
561 % Frames and colored boxes are orthogonal to the existing
562 % theoremstyles -- thus, they can be combined in arbitrary ways.
563 %
564 % \DescribeMacro\newframedtheorem
565 % A theorem type can be framed by defining it by
566 % \begin{quote}
567 % |\newframedtheorem{...}{...}|
568 % \end{quote}
569 % with the same parameters as usually for |\newtheorem|.
570 % Note that the use of the |framed| package also allows to have longer
571 % theorems across a page break framed (in this case, by default, there
572 % are horizontal lines before and after the page break; this can
573 % even be circumvented by combining with \texttt{mdframed} package
574 % (since 2010)).
575 %
576 % \DescribeMacro\newshadedtheorem
577 %
578 % The same ideas hold for theorems in shaded boxes. The declaration
579 % \begin{quote}
580 % |\newshadedtheorem{...}{...}|
581 % \end{quote}
582 % declares a theorem environment that is shaded. By default, the
583 % background color is |gray|. This can be changed by defining \\
584 % \begin{quote}
585 % |\shadecolor{|\meta{color}|}|
586 % \end{quote}
587 % before declaring the theorem type. Note that later declarations
588 % of other shaded theorem types can use another shadecolor.
589 %
590 % By default, the box is given as a |\psframebox| (see |pstricks|
591 % package) with shadecolor as |linecolor| and |fillcolor|. All
592 % these parameters can be changed by setting
593 % \begin{quote}
594 % |\def\theoremframecommand{|\meta{any box command}|}|
595 % \end{quote}
596 % before declaring the theorem type (for examples, the
597 % user is referred to section \ref{sec:examples}).
598 %
599 % For using pdflatex (where pstricks is not available), e.g.
600 % |\usepackage{color}| and
601 % |\theoremframecommand{\colorbox[rgb]{1,.9,.9}}| can be used.
602 %
603 % \paragraph{Vertical Spacing of Framed Theorems}
604 %
605 % The New Skip Scheme introduced with version 1.32 allows
606 % a detailed specification of vertical space also for framed
607 % theorems (specified individually for each theorem class):
608
609 % \begin{itemize}
610 % \item |\theorempreskip{|\meta{skip}|}| and
611 % |\theorempostskip{|\meta{skip}|}| have no effect for
612 % framed theorems.
613 % \item
614 % \DescribeMacro\theoremframepreskip
615 % \DescribeMacro\theoremframepostskip
616 % |\theoremframepreskip{|\meta{skip}|}| and
617 % |\theoremframepostskip{|\meta{skip}|}| can be used to specify the
618 % vertical space before/after the frame/box.
619 % \item
620 % \DescribeMacro\theoreminframepreskip
621 % \DescribeMacro\theoreminframepostskip
622 % |\theoreminframepreskip{|\meta{skip}|}| and
623 % |\theoreminframepostskip{|\meta{skip}|}| can be used to specify the
624 % vertical space around the theorem text \emph{inside} the
625 % frame/box.
626 % \item The arguments of the above commands are rubber lengths,
627 % (`\textsf{skips}'), and therefore can contain \texttt{plus} and
628 % \texttt{minus} parts.
629 % \item the default values of all above skips is |\topsep|, i.e.,
630 % the space \LaTeX\ normally inserts before/after lists.
631 % \end{itemize}
632 %
633 %
634 % Old Skip Scheme (until v 1.31):
635 % |\theorempreskipamount| and |\theorempostskipamount| are
636 % applied \emph{inside} the frame/box.
637 % To obtain vertical space \emph{before} and \emph{after} the
638 % frame/box in versions 1.30--v.1.31, |\theoremframepreskipamount| and
639 % |\theoremframepostskipamount| could be used (both defined by default to
640 % 0pt) analogously (i.e., they are also common to all theorem types.)
641 %
642 % \subsubsection{Customization and Local Settings}
643 %
644 % Since the user should not change |ntheorem.std|,
645 % we've added the possibility to use an own configuration-file.
646 % If one places the file |ntheorem.cfg| in the path searched by
647 % \TeX, this file is read automatically (if |[standard]|
648 % is not given). The usage of |ntheorem.cfg| can be prevented by the
649 % |[noconfig]| option. Thus, just
650 % a copy of |ntheorem.std| to |ntheorem.cfg| must be made
651 % which then can freely be modified by the user. Note, that if a
652 % configuration-file exists, this will always be used (I.e.\ with
653 % option |standard| and an existing configuration-file, the |.cfg|
654 % file will be used and the |.std| file won't.
655 %
656 % \subsection{Generating Theoremlists}\label{sec:thmlists}
657 %
658 % \DescribeMacro\listtheorems
659 % Similar to the \LaTeX\ command |\listoffigures|,
660 % any theorem set defined with a |\newtheorem| statement
661 % may be listed at any place in your document by
662 % \begin{quote}
663 % |\listtheorems{|\meta{list}|}|
664 % \end{quote}
665 % The argument \meta{list} is a comma-separated list
666 % of the theorem sets to be listed.
667 % For a theorem set \meta{name}, only the instances are listed
668 % which are instantiated by |\begin{|\meta{name}|}|. Those
669 % instantiated by |\begin{|\meta{name}|*}| are omitted
670 % (cf.\ |\section| and |\section*|).
671 %
672 % For example,
673 % |\listtheorems{Corollary,Lemma}|
674 % leads to a list of all instances of one of the theorem sets
675 % ``Corollary'' or ``Lemma''.
676 % Note, that the set name given to the command is the first
677 % argument which is specified by |\newtheorem| which is also
678 % the one to be used in |\begin{theorem} ... \end{theorem}|.
679 %
680 % If |\listtheorems| is called for a set name which is not defined
681 % via |\newtheorem|, the user is informed that a list is generated,
682 % but there will be no typeset output at all.
683 %
684 % Note that in contrast to similar \LaTeX\ commands like
685 % |\listoffigures| etc.\, there is no automatically created
686 % heading. Users have to write it themselves -- but are free
687 % to choose what they want to have.
688 %
689 % \subsubsection{Defining the List Layout}
690 %
691 % \DescribeMacro\theoremlisttype
692 % Theoremlists can be formatted in different ways. Analogous to
693 % theorem layout, there are several predefined types which can be
694 % selected by
695 % \begin{quote}
696 % |\theoremlisttype{|\meta{type}|}|
697 % \end{quote}
698 % The following four \meta{type}s are available (for examples, the
699 % user is referred to section \ref{sec:examples}).
700 % \begin{deflist}{allname}
701 % \item[all] List any theorem of the specified set by number,
702 % (optional) name and pagenumber. This one is also the
703 % default value.
704 % \item[allname] Like |all|, additionally with leading theoremname.
705 % \item[opt] Analogous to |all|, but only the theorems which have an
706 % optional name are listed.
707 % \item[optname] Like |opt|, with leading theoremname.
708 % \end{deflist}
709 %
710 % \subsubsection{Writing Extra Stuff to the Theorem File}
711 %
712 % Similar to |\addcontentsline| and |\addtocontents|,
713 % additional entries to theoremlists are supported.
714 % Since entries to theoremlists are a bit more intricate than
715 % entries to the lists maintained by standard \LaTeX\,
716 % |\addcontentsline| and |\addtocontents| cannot be used in a
717 % straightforward way\footnote{for a theorem, its number has
718 % to be stored explicitly since different theorem sets can use
719 % the same counter. Also, it is optional to reset the counter for
720 % each section.}.
721 %
722 % \DescribeMacro\addtheoremline
723 % Analogous to |\addcontentsline|, an extra entry for a theorem
724 % list can be made by
725 % \begin{quote}
726 % |\addtheoremline{|\meta{name}|}{|\meta{text}|}|
727 % \end{quote}
728 % where \meta{name} is the name of a valid theorem set and \meta{text}
729 % is the text, which should appear in the list. For example,
730 % \begin{quote}
731 % |\addtheoremline{Example}{Extra Entry with number}|
732 % \end{quote}
733 % \addtheoremline{Example}{Extra Entry with number}
734 % generates an entry with the following characteristics:
735 % \begin{itemize}
736 % \item The Label of the theorem ``Example'' is used.
737 % \item The current value of the counter for ``Example'' is used
738 % \item The current pagenumber is used.
739 % \item The specified text is the optional text for the theorem.
740 % \end{itemize}
741 % Thus, the above command has the same effect as it would be for
742 % \begin{quote}
743 % |\begin{Example}[Extra Entry with number] \end{Example}|
744 % \end{quote}
745 % except, that there would be no output of the theorem, and the counter
746 % isn't advanced.
747 %
748 % \DescribeMacro{\addtheoremline*}
749 % Alternatively you can use
750 % \begin{quote}
751 % |\addtheoremline*{Example}{Extra Entry}|
752 % \end{quote}
753 % \addtheoremline*{Example}{Extra Entry}
754 % which is the same as above, except that the entry appears without
755 % number.
756 %
757 % \DescribeMacro\addtotheoremfile
758 % Sometimes, e.g.\ for long lists, special control sequences
759 % (e.g.\ a pagebreak) or additional text should be inserted into a
760 % list. This is done by
761 % \begin{quote}
762 % |\addtotheoremfile[|\meta{name}|]{|\meta{text}|}|
763 % \end{quote}
764 % where \meta{name} is the name of a theorem set and
765 % \meta{text} is the text to be written into the theorem file.
766 % If the optional argument \meta{name} is omitted, the given
767 % text is inserted in every list, otherwise it is only inserted
768 % for the given theorem set.
769 %
770 % \subsection{For Experts: Defining Layout Styles}
771 % \subsubsection{Defining New Theorem Layouts}\label{sec:newtheoremstyle}
772 %
773 % \DescribeMacro\newtheoremstyle
774 % Additional layout styles for theorems can be defined by
775 % \begin{quote}
776 % |\newtheoremstyle{|\meta{name}|}{|\meta{head}|}{|\meta{opt-head}|}|.
777 % \end{quote}
778 % After this, |\theoremstyle{|\meta{name}|}| is a valid
779 % |\theoremstyle|.
780 % Here, \meta{head} has to be a statement using two arguments,
781 % |##1|, containing the keyword, and |##2|, containing the number.
782 % \meta{opt-head} has to be a statement using three arguments where
783 % the additional argument |##3| contains the optional parameter.
784 %
785 % Since \LaTeX\ implements theorem-like environments by |\trivlist|s,
786 % both header declarations must be of the form
787 % |\item[... \theorem@headerfont ...]...|, where
788 % the dotted parts can be formulated by the user.
789 % If there are some statements producing
790 % output after the |\item[...]|, you have to care about implicit
791 % spaces.
792 %
793 % Because of the |@|, if |\newtheoremstyle| is used in a
794 % |.tex| file, it has to be put between |\makeatletter| and
795 % |\makeatother|.
796 %
797 % For details, look at the code documentation or the
798 % definitions of the predefined theoremstyles.
799 %
800 % \DescribeMacro\renewtheoremstyle
801 % Theorem styles can be redefined by |\renewtheoremstyle|, with the
802 % same arguments as explained for |\newtheoremstyle|.
803 %
804 % \subsubsection{Defining New Theorem List Layouts}\label{sec:listtypes}
805 %
806 % \DescribeMacro\newtheoremlisttype
807 % Analogous, additional layouts for theorem lists can be defined by
808 % \begin{quote}
809 % |\newtheoremlisttype{|\meta{name}|}{|\meta{start}|}{|\meta{line}%
810 % |}{|\meta{end}|}|.
811 % \end{quote}
812 % The first argument, \meta{name}, is the name of the listtype,
813 % which can the be used as a valid |\theoremlisttype|.
814 % \meta{start} is the sequence of commands to be executed at
815 % the very beginning of the list.
816 % Corresponding, \meta{end} will be executed at the end of the list.
817 % These two are set to do nothing in the standard-types.
818 % \meta{line} is the part to be called for every entry of the list.
819 % It has to be a statement using four arguments: |##1| will be
820 % replaced with the name of the theorem, |##2| with the number,
821 % |##3| with the theorem's optional text and |##4| with the pagenumber.
822 %
823 % WARNING: Self-defined Layouts will break with the |hyperref|-package.
824 %
825 % \DescribeMacro\renewtheoremlisttype
826 % Theorem list types can be redefined by |\renewtheoremlisttype|, with
827 % the same arguments as explained for |\newtheoremlisttype|.
828 %
829 % \subsection{Setting End Marks}
830 %
831 % The automatic placement of endmarks is activated by calling
832 % |ntheorem.sty| with the option |[thmmarks]|.
833 % Since then, the endmarks are set automatically, there are only
834 % a few commands for dealing with very special situations.
835 %
836 % \DescribeMacro\qed
837 % \DescribeMacro\qedsymbol
838 % If in a single environment, the user wants to replace the standard
839 % endmark by some other, this can be done by saying |\qed|,
840 % if |\qedsymbol| has been defined by |\qedsymbol{|\meta{something}|}|
841 % (in option standard, |\qedsymbol| is defined to be the symbol
842 % used for proofs, since a potential use of this features is to
843 % close trivial corollaries without explicitly proving them).
844 %
845 % Additionally, if in a single environment of a theorem set, that
846 % is defined without an endmark, the user wants to set an endmark,
847 % this is done with |\qedsymbol| and |\qed| as described above.
848 % |\qedsymbol| can be redefined everywhere in the document.
849 %
850 % \DescribeMacro\NoEndMark
851 % \DescribeMacro\TheoremSymbol
852 % On the other hand, if in some situation, the user decides to set
853 % the endmark manually (e.g.\ inside a figure or a minipage), the
854 % automatic handling can be turned off by |\NoEndMark| for the
855 % current environment.
856 % Then -- assumed that he current environment is of type \meta{name},
857 % the endmark can manually be set by just saying
858 % |\|\meta{name}|Symbol|.
859 %
860 % Note that there must be no empty line in the input before the
861 % |\end{theorem}|, since then, the end mark is ignored (cf.\
862 % Theorem~\ref{ex-empty-line} in Section~\ref{sec:examples}).
863 %
864 % \subsection{Extended Referencing Features}
865 %
866 % The extended referencing features are activated by calling
867 % |ntheorem.sty| with the option |[thref]|.
868 %
869 % Often, when writing a paper, one changes propositions into
870 % theorems, theorems into corollaries, lemmata into remarks
871 % an so on. Then, it is necessary to adjust also the references,
872 % i.e., from ``|see Proposition~\ref{completeness}|'' to
873 % ``|see Theorem~\ref{completeness}|''. For relieving the user
874 % from this burden, the type of the respective labeled entities
875 % can be associated with the label itself:
876 %
877 % \begin{quote}
878 % |\label{|\meta{label}|}[|\meta{type}|]|
879 % \end{quote}
880 % associates the type \meta{type} with \meta{label}. \\
881 % This task is automated for theorem-like environments:
882 %
883 % \begin{quote}
884 % |\begin{Theorem}[|\meta{name}|]\label{|\meta{label}|}|
885 % \end{quote}
886 % is equivalent to
887 % \begin{quote}
888 % |\begin{Theorem}[|\meta{name}|]\label{|\meta{label}|}[Theorem]|
889 % \end{quote}
890 %
891 % The additional information is used by
892 % \DescribeMacro\thref
893 % \begin{quote}
894 % |\thref{|\meta{label}|}|
895 % \end{quote}
896 % which outputs the respective environment-type \emph{and} the number,
897 % e.g., ``Theorem~42''. Note that \LaTeX\ has to be run twice after
898 % changing labels (similar to getting references OK; in the
899 % intermediate run, warnings about undefined reference types can
900 % occur).
901 %
902 % The |[thref]| option interferes with the |babel| package, thus in
903 % this case, |ntheorem| has to be loaded \emph{after} |babel|. It also
904 % interferes with |amsmath|; see Section~\ref{sec:amslatex}.
905 %
906 %
907 % \subsection{Miscellaneous}
908 %
909 % Inside a theorem-like environment \meta{env}, the name given as optional
910 % argument is accessible by |\|\meta{env}|name|.
911 %
912 % \section{Possible Interferences}
913 % Since |ntheorem| reimplements the handling of theorem-environments
914 % completely, it is incompatible with every package also concerning
915 % those macros.
916 %
917 % Additionally, the |thmmarks| algorithm for placing endmarks
918 % requires modifications of several environments (cf.\ Section
919 % \ref{sec:code}).
920 % Thus, environments which are reimplemented or additionally defined
921 % by document options or styles are not covered by the endmark
922 % algorithm of |ntheorem.sty|.
923 %
924 % The |[thref]| option changes the |\label| command and the treatment
925 % of labels when reading the |.aux| file. Thus it is potentially
926 % incompatible with all packages also changing |\label| (or
927 % |\newlabel|). Compatibility with babel's |\newlabel| isa
928 % achieved if babel is loaded before ntheorem.
929 %
930 % \subsection{Interfering Document Options.}
931 %
932 % |ntheorem.sty| also copes with the usual document options
933 % |leqno| and |fleqn|\footnote{although for \texttt{fleqn} and
934 % long formulas
935 % reaching to the right margin, equation numbers and endmarks can
936 % be smashed over the formula since \texttt{fleqn} does not use
937 % \texttt{\bslash eqno} for controlling the setting of the equation
938 % number.}.
939 % If one of those options is used in the |\documentclass|
940 % declaration, it is automatically recognized by the |thmmarks| part
941 % of |ntheorem.sty|.
942 %
943 % If one of those options is not used in |\documentclass|, but
944 % with |amsmath| (see next section), it must not be specified
945 % for |ntheorem|, since all |amsmath| environments detect this option
946 % by themselves.
947 %
948 % \subsection{Combination with amslatex.}\label{sec:amslatex}
949 %
950 % |ntheorem.sty| interferes with |amsmath.sty| and |amsthm.sty|.
951 %
952 % Note, that the LaTeX amstex package |amstex.sty| (\LaTeX2.09) is
953 % obsolete and you should use |amsmath| and |amstext| for
954 % \LaTeXe\ instead. Up to |ntheorem-1.18|, it is compatible with
955 % |amsmath-1.x|. Since |ntheorem-1.19|, it is (hopefully) compatible
956 % with |amsmath-2.x|.
957 %
958 % We would be happy if someone knowing and using |amsmath| would
959 % join the development and maintenance of this style.
960 %
961 % \subsubsection{amsmath}
962 %
963 % Compatibility with amsmath (end marks for math environments, and
964 % handling of labels in math environments) is provided in the option
965 % |[amsmath]|, (i.e., if |\usepackage{amsmath}| is used then
966 % \begin{itemize}
967 % \item |\usepackage[thmmarks]{ntheorem}| must be completed to \\
968 % |\usepackage[amsmath,thmmarks]{ntheorem}|), and also
969 % \item |\usepackage[thref]{ntheorem}| must be completed to \\
970 % |\usepackage[amsmath,thref]{ntheorem}|).
971 % \end{itemize}
972 % Note, that |amsmath| has to be loaded \emph{before} |ntheorem|
973 % since the definitions have to be overwritten.
974 %
975 % \subsubsection{amsthm}
976 %
977 % |amsthm.sty| conflicts with the definition of theorem
978 % layouts in |theorem.sty|, some features of |amsthm.sty|
979 % have been incorporated into option |[amsthm]| which has
980 % to be used \emph{instead of} |\usepackage{amsthm}|.
981 %
982 % The option provides theoremstyles |plain|, |definition|, and
983 % |remark|, and a |proof| environment as in |amsthm.sty|.
984 %
985 % The |\newtheorem*| command is defined even without this
986 % option. Note that |\newtheorem*| always switches to the
987 % nonumbered version of the current theoremstyle which
988 % thus must be defined.
989 %
990 % The command |\newtheoremstyle| is not taken over from
991 % |amsthm.sty|. Also, |\swapnumbers| is not implemented.
992 % Here, the user has to express his definitions by the
993 % |\newtheoremstyle| command provided by |ntheorem.sty|,
994 % including the use of |\theoremheaderfont| and |\theorembodyfont|.
995 % The options |[amsthm]| and |[standard]| are in conflict
996 % since they both define an environment |proof|.
997 %
998 % Thus, we recommend not to use
999 % |amsthm|, since the features for defining theorem-like
1000 % environments in |ntheorem.sty|---following
1001 % |theorem.sty|---seem to be more intuitive and user-friendly.
1002 %
1003 % \subsection{Babel}\label{sec:babel}
1004 %
1005 % The |[thref]| option interferes with the |babel| package, thus in
1006 % case that |babel| is used, |ntheorem| has to be loaded \emph{after}
1007 % |babel|.
1008 %
1009 % \subsection{Hyperref}\label{sec:hyperref}
1010 %
1011 % Since |hyperref| redefines the \LaTeX\ |\contentsline|-command, it
1012 % breaks with |ntheorem| below version 1.17. Since version 1.17, the
1013 % option |[hyperref]| makes |ntheorem| work with |hyperref|.
1014 % The entries of theoremlists then act as hyperlinks to the actual
1015 % theorems. Version 1.31 incorporated some bugfixes wrt.\ hyperref
1016 % for theorem lists and for the |thref| option. One should always
1017 % load |\usepackage{hyperref}| \emph{before} the first use of
1018 % |\newtheorem| to obtain correct handling and referencing of
1019 % counters.
1020 % \medskip
1021 %
1022 % WARNING: The definition and redefinition of Theorem List Layouts
1023 % (see Section~\ref{sec:listtypes}) isn't yet working with
1024 % the |hyperref|-package.
1025 %
1026 % \subsection{Mathtools and Empheq}\label{sec:mathtools}
1027 %
1028 % The |mathtools| and |empheq| packages should be loaded \emph{before}
1029 % |ntheorem| as follows:
1030 % \begin{verbatim}
1031 % \usepackage[ntheorem]{empheq} % this loads amsmath as well
1032 % \usepackage[thmmarks,amsmath]{ntheorem} \end{verbatim}
1033 % Note that |empheq| provides an enhanced vertical placement
1034 % of the endmarks (see the paragraph on |ntheorem| in the
1035 % documentation of the |empheq| package) in math environments.
1036 %
1037 % \section{Examples}\label{sec:examples}
1038 %
1039 % The setting is as follows.
1040 % \begin{itemize}
1041 % \item For Theorems:
1042 % \begin{verbatim}
1043 % \theoremstyle{marginbreak}
1044 % \theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
1045 % \theoremsymbol{\ensuremath{\diamondsuit}}
1046 % \theoremseparator{:}
1047 % \newtheorem{Theorem}{Theorem}\end{verbatim}
1048 % \item For Lemmas:
1049 % \begin{verbatim}
1050 % \theoremstyle{changebreak}
1051 % \theoremsymbol{\ensuremath{\heartsuit}}
1052 % \theoremindent0.5cm
1053 % \theoremnumbering{greek}
1054 % \newtheorem{Lemma}{Lemma}\end{verbatim}
1055 % \item For Corollaries:
1056 % \begin{verbatim}
1057 % \theoremindent0cm
1058 % \theoremsymbol{\ensuremath{\spadesuit}}
1059 % \theoremnumbering{arabic}
1060 % \newtheorem{Corollary}[Theorem]{Corollary}\end{verbatim}
1061 % \item For Examples:
1062 % \begin{verbatim}
1063 % \theoremstyle{change}
1064 % \theorembodyfont{\upshape}
1065 % \theoremsymbol{\ensuremath{\ast}}
1066 % \theoremseparator{}
1067 % \newtheorem{Example}{Example}\end{verbatim}
1068 % \item For Definitions:
1069 % \begin{verbatim}
1070 % \theoremstyle{plain}
1071 % \theoremsymbol{\ensuremath{\clubsuit}}
1072 % \theoremseparator{.}
1073 % \theoremprework{\bigskip\hrule}
1074 % \theorempostwork{\hrule\bigskip}
1075 % \newtheorem{Definition}{Definition}\end{verbatim}
1076 % \item For Proofs (note that |\theoremprework| and
1077 % |\theorempostwork| are automatically reset with the next
1078 % |\newtheorem| -- proofs do not have lines above and below):
1079 % \begin{verbatim}
1080 % \theoremheaderfont{\sc}\theorembodyfont{\upshape}
1081 % \theoremstyle{nonumberplain}
1082 % \theoremseparator{}
1083 % \theoremsymbol{\rule{1ex}{1ex}}
1084 % \newtheorem{Proof}{Proof}\end{verbatim}
1085 % \end{itemize}
1086 % Note, that parts of the setting are inherited. For instance, the
1087 % fonts are not reset before defining ``Lemma'', so the font setting
1088 % of ``Theorem'' is used.
1089 %
1090 % \begin{Example}[Simple one]
1091 % The first example is just a text.
1092 %
1093 % In the next examples, it is shown how an endmark is put at a
1094 % displaymath, a single equation and both types of eqnarrays.
1095 % \end{Example}
1096 %
1097 % \begin{Theorem}[Long Theorem]
1098 % The examples are put into this theorem environment.
1099 %
1100 % The next example will not appear in the list of examples since
1101 % it is written as
1102 % \begin{quote}
1103 % |\begin{Example*} ... \end{Example*}|
1104 % \end{quote}
1105 % \begin{Example*}[Ending with a displayed formula]
1106 % Look, the endmark is really at the bottom of the line:
1107 % \[ f^{(n)}(z) =
1108 % \frac{n!}{2\pi i} \int \limits _{\partial D}
1109 % \frac{f(\zeta)}{(\zeta-z)^{n+1}} d\zeta \]
1110 % \end{Example*}
1111 % At this point, we add an additional entry without number
1112 % in the Example list:
1113 % \begin{verbatim}
1114 % \addtheoremline*{Example}{Extra Entry}\end{verbatim}
1115 % \addtheoremline*{Example}{Extra Entry}
1116 % \begin{Lemma}[Display with array]
1117 % Lemmata are indented and numbered with greek symbols.
1118 % Also for displayed arrays of this form, it looks good:
1119 % \begin{verbatim}
1120 % \[\begin{array}{l}
1121 % a = \begin{array}[t]{l}
1122 % first\ line \\
1123 % second\ line
1124 % \end{array}%
1125 % \mbox{try to put this text in the lowest line}\end{array}\] \end{verbatim}
1126 % Just try to get this with the presented array structure ... without
1127 % using dirty tricks, you can position the outer array either [t], [c],
1128 % or [b], and you will not get the desired effect.
1129 % \[\begin{array}{l}
1130 % a = \begin{array}[t]{l}
1131 % first\ line \\
1132 % second\ line
1133 % \end{array} \mbox{try to put this text in the lowest line}
1134 % \end{array}\]
1135 % \end{Lemma}
1136 % \begin{Lemma}[Equation]
1137 % For |equation|s, we decided to put the endmark after the equation
1138 % number, which is vertically centered.
1139 % Currently, we do not know, how to get the equation number centered and
1140 % the endmark at the bottom (one has to know the internal height of the
1141 % math material) ... If anyone knows, please inform us.
1142 % \begin{equation}
1143 % \int_{\gamma} f(z)\, dz := \int_a^b f(\gamma (t)) \gamma'(t) \, dt
1144 % \end{equation}
1145 % \end{Lemma}
1146 %
1147 % With the |break|-theoremstyles, if the environment is labeled and
1148 % written as
1149 % \begin{quote}
1150 % |\begin{Lemma}[Breakstyle]\label{breakstyle}|
1151 % \end{quote}
1152 % \begin{Lemma}[Breakstyle]\label{breakstyle}
1153 % you see, there is a leading space \dots \\
1154 % If a percent (comment) (or an explicit |\ignorespaces|) is put directly
1155 % after the label, e.g.
1156 % \begin{quote}
1157 % |\begin{Lemma}[Breakstyle]\label{breakstyle}%|,
1158 % \end{quote}
1159 % the space disappears.
1160 %
1161 % From the predefined styles, this is exactly the case for the break-styles.
1162 % That's no bug, it's \LaTeX-immanent.
1163 %
1164 % The example goes on with an |eqnarray|:
1165 % \begin{eqnarray}
1166 % f(z) &=&
1167 % \frac{1}{2\pi i}
1168 % \int \limits_{\partial D} \frac{f(\zeta)}{\zeta-z} d\zeta \\
1169 % &= &
1170 % \frac{1}{2\pi}
1171 % \int \limits_0^{2\pi}
1172 % f(z_0 + re^{it}) dt
1173 % \end{eqnarray}
1174 % \end{Lemma}
1175 %
1176 % \begin{Proof}[of nothing]
1177 % \begin{eqnarray*}
1178 % f(z) &=&
1179 % \frac{1}{2\pi i}
1180 % \int \limits_{\partial D} \frac{f(\zeta)}{\zeta-z} d\zeta \\
1181 % &= &
1182 % \frac{1}{2\pi}
1183 % \int \limits_0^{2\pi}
1184 % f(z_0 + re^{it}) dt
1185 % \end{eqnarray*}
1186 % \end{Proof}
1187 % That's it (the end of the Theorem).
1188 % \end{Theorem}
1189 %
1190 %
1191 % If there are some environments in the same thm-environment,
1192 % the last one gets the endmark:
1193 % \begin{Definition}[With a list]
1194 % \begin{equation}
1195 % \int_{\gamma} f(z)\, dz := \int_a^b f(\gamma (t)) \gamma'(t) \, dt
1196 % \end{equation}
1197 % \begin{itemize}
1198 % \item you've seen, how it works for text and
1199 % \item math environments,
1200 % \item and it works for lists.
1201 % \end{itemize}
1202 % \end{Definition}
1203 %
1204 % \begin{Corollary}[Q.E.D.]
1205 % And here is a trivial corollary, which is ended by
1206 % |\qedsymbol{\textrm{q.e.d}}| and |\qed|.
1207 % \qedsymbol{q.e.d}\qed
1208 % \end{Corollary}
1209 %
1210 % \begin{Example}
1211 % \[ f^{(n)}(z) =
1212 % \frac{n!}{2\pi i} \int \limits _{\partial D}
1213 % \frac{f(\zeta)}{(\zeta-z)^{n+1}} d\zeta \]
1214 % If there is some text after an environment, the endmark is put
1215 % after the text.
1216 % \end{Example}
1217 %
1218 % The next one is done by the following sequence. Note, that
1219 % |~\hfill~| is inserted to prevent \LaTeX\ from using its nested list
1220 % management (a verbatim is also a trivlist),
1221 % i.e.\ this causes \LaTeX\ to start the |verbatim|-Part in a new line.
1222 % \begin{quote}
1223 % |\begin{Example}| \\
1224 % |~\hfill~| \\
1225 % |\begin{verbatim}| \\
1226 % |And, it also works for verbatim|\\
1227 % |... when the \end{verbatim} is in the|\\
1228 % |same line as the text ends. \end{verbatim}|\\
1229 % | ^| this space is important !!\\
1230 % |\end{Example}|
1231 % \end{quote}
1232 %
1233 % \begin{Example}[Using |verbatim|]
1234 % ~\hfill~
1235 % \begin{verbatim}
1236 % And, it also works for verbatim
1237 % ... when the end{verbatim} is in the
1238 % same line as the text ends. \end{verbatim}
1239 % \end{Example}
1240 %
1241 % There must be no empty line in the input before the |\end{theorem}|
1242 % (since then, the end mark is ignored) \\
1243 % \begin{quote}
1244 % |\begin{Theorem}| \\
1245 % |some text ... but no end mark| \\
1246 % | | \\
1247 % |\end{Theorem}|
1248 % \end{quote}
1249 %
1250 % \begin{Theorem}\label{ex-empty-line}
1251 % some text ... but no end mark
1252 %
1253 % \end{Theorem}
1254 %
1255 %
1256 % Now, there is a corollary which should appear with a different
1257 % name in the list of corollaries:
1258 % \begin{quote}
1259 % |\begin{Corollary*}[title in text]\label{otherlabel}| \\
1260 % |...|\\
1261 % |\end{Corollary*}|
1262 % |\addtheoremline{Corollary}{title in list}| \\
1263 % \end{quote}
1264 % \begin{Corollary*}[title in text]\label{otherlabel}\ignorespaces
1265 % let's do something weird:
1266 % \begin{center}
1267 % It also works in the \\
1268 % center \\
1269 % environment.
1270 % \end{center}
1271 % \end{Corollary*}
1272 % \addtheoremline{Corollary}{title in list}
1273 %
1274 % \begin{Theorem}[Quote]
1275 % \begin{quote}
1276 % In quote environments, the text is normally indented from left
1277 % and right by the same space. The endmark is not indented from the
1278 % right margin, i.e., it is typeset to the right margin of the
1279 % surrounding text.
1280 % \end{quote}
1281 % \end{Theorem}
1282 %
1283 % Here is an example for turning off the endmark automatics and
1284 % manual handling:
1285 %
1286 % \begin{verbatim}
1287 % \begin{Theorem}[Manual End Mark]\label{somelabel}
1288 % a line of text with a manually set endmark \hfill\TheoremSymbol \\
1289 % some more text, but no automatic endmark set. \NoEndMark
1290 % \end{Theorem}\end{verbatim}
1291 %
1292 % \begin{Theorem}[Manual End Mark]\label{somelabel}
1293 % a line of text with a manually set endmark \hfill\TheoremSymbol \\
1294 % some more text, but no automatic endmark set. \NoEndMark
1295 % \end{Theorem}
1296 % Also, one should note, that |\hfill| is inserted to set
1297 % the endmark at the right margin.
1298 %
1299 % \begin{Example}[Quickie] It also works for short one's.
1300 % \end{Example}
1301 %
1302 % If you are tired of the greek numbers and the indentation for lemmata ...
1303 % you can redefine it:
1304 % \theoremstyle{changebreak}
1305 % \theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
1306 % \theoremsymbol{\ensuremath{\heartsuit}}
1307 % \theoremsymbol{\ensuremath{\diamondsuit}}
1308 % \theoremseparator{:}
1309 % \theoremindent0cm
1310 % \theoremnumbering{arabic}
1311 % \renewtheorem{Lemma}{Lemma}
1312 % \begin{quote}
1313 % |\theoremstyle{changebreak}| \\
1314 % |\theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}| \\
1315 % |\theoremsymbol{\ensuremath{\heartsuit}}|\\
1316 % |\theoremsymbol{\ensuremath{\diamondsuit}}|\\
1317 % |\theoremseparator{:}|\\
1318 % |\theoremindent0.5cm|\\
1319 % |\theoremnumbering{arabic}|\\
1320 % |\renewtheorem{Lemma}{Lemma}|
1321 % \end{quote}
1322 % \begin{Lemma}
1323 % another lemma, with arabic numbering ... note that the numbering
1324 % continues.
1325 % \end{Lemma}
1326 %
1327 % the optional argument (i.e.\ the `theorem'-name) can be accessed by
1328 % |\|\meta{env}|name|.
1329 %
1330 % \begin{quote}
1331 % |\begin{Theorem}[somename]|\\
1332 % |Obviously, we are in Theorem~\Theoremname|.\\
1333 % |\end{Theorem}|
1334 % \end{quote}
1335 % \begin{Theorem}[somename]
1336 % Obviously, we are in Theorem~\Theoremname.
1337 % \end{Theorem}
1338 %
1339 % This feature can e.g.\ be used for automatically generating
1340 % executable code and a commented solution sheet:
1341 % \begin{quote}
1342 % |\begin{exercise}[quicksort]| \\
1343 % \meta{the exercise text} \\
1344 % |\begin{verbatimwrite}{solutions/\exercisename.c}|\\
1345 % \meta{C-code} \\
1346 % |\end{verbatimwrite}|\\
1347 % |\verbatiminput{solutions/\exercisename.c}|\\
1348 % |\end{exercise}|
1349 % \end{quote}
1350 % This will write the C-code to a file |solutions/quicksort.c| and
1351 % type it also on the solution sheet.
1352 %
1353 % Now, we define an environment |KappaTheorem| which uses the same
1354 % style parameters as Theorems and is numbered together with
1355 % Corollaries (Theorems are also numbered with Corollaries).
1356 % Note that we define a complex header text and a complex end mark.
1357 %
1358 % |\theoremclass{Theorem}|\\
1359 % |\theoremsymbol{\ensuremath{a\atop b}}| \\
1360 % |\newtheorem{KappaTheorem}[Corollary]{\(\kappa\)-Theorem}|
1361 %
1362 % \theoremclass{Theorem}
1363 % \theoremsymbol{\ensuremath{a\atop b}}
1364 % \newtheorem{KappaTheorem}[Theorem]{\(\kappa\)-Theorem}
1365 %
1366 % \begin{KappaTheorem}[1st \(\kappa\)-Theorem]\label{kappatheorem1}
1367 % That's the first Kappa-Theorem.
1368 % \end{KappaTheorem}
1369 %
1370 % \subsection{Extended Referencing Features}\label{sec-ExtRef}[Section]
1371 %
1372 % The standard |\label| command is extended by an optional argument
1373 % which is intended to contain the ``name'' of the structure which
1374 % is labeled, allowing more comfortable referencing; e.g., this
1375 % section has been started with
1376 %
1377 % \begin{quote}
1378 % |\subsection*{Extended Referencing Features}%|\\
1379 % |\label{sec-ExtRef}[Section]|
1380 % \end{quote}
1381 %
1382 % As already stated, for theorem-like environments the optional
1383 % argument is filled in automatically, i.e.,
1384 % \begin{quote}
1385 % |\begin{Theorem}[Manual End Mark]\label{somelabel}|
1386 % \end{quote}
1387 % (cf.\ page~\pageref{somelabel}) is equivalent to
1388 % \begin{quote}
1389 % |\begin{Theorem}[Manual End Mark]\label{somelabel}[Theorem]|
1390 % \end{quote}
1391 %
1392 % |\thref{|\meta{label}|}| additionally outputs the contents
1393 % of the optional argument which has been associated with \meta{label}:
1394 %
1395 % \begin{quote}
1396 % |This is \thref{sec-ExtRef}| \\
1397 % |A theorem end mark has been set manually in \thref{somelabel}.| \\
1398 % |A center environment has been shown in \thref{otherlabel}.| \\
1399 % |The first Kappa-Theorem has been given in \thref{kappatheorem1}.|
1400 % \end{quote}
1401 %
1402 % generates
1403 % \begin{quote}
1404 % This is \thref{sec-ExtRef}. \\
1405 % A theorem end mark has been set manually in \thref{somelabel}.
1406 % A center environment has been shown in \thref{otherlabel}.
1407 % The first Kappa-Theorem has been given in \thref{kappatheorem1}.
1408 % \end{quote}
1409 %
1410 % Here one must be careful that the handling of the optional
1411 % argument is automated
1412 % only for environments defined by |\newtheorem|, i.e., \emph{not}
1413 % for sectioning, equations, or enumerations.
1414 %
1415 % Calling |\thref{|\meta{label}|}| for a label which has been
1416 % set without an optional argument can result in different unintended
1417 % results: If \meta{label} is not inside a theorem-like environment, an
1418 % error message is obtained, otherwise the type of the surrounding
1419 % theorem-like environment is output, e.g., calling |\thref{label}|
1420 % then results in ``Theorem~\meta{number}''!
1421 % Additionally, currently there is no support for multiple references
1422 % such as ``see Theorems~5 and~7'' (this would require plural-forms
1423 % for different languages and handling of |\ref|-lists, probably
1424 % splitting into different sublists for different environments)\footnote{If
1425 % someone is interested in programming this, please contact us; it
1426 % seems to be algorithmically easy, but tedious.}.
1427 %
1428 % \subsection{Framed and Shaded Theorems}
1429 % \label{sec-framed}
1430 %
1431 % Framed theorem classes are defined as follows:
1432 % \begin{quote}
1433 % |\theoremclass{Theorem}| \\
1434 % |\theoremstyle{break}| \\
1435 % |\newframedtheorem{importantTheorem}[Theorem]{Theorem}|
1436 % \end{quote}
1437 % \theoremclass{Theorem}
1438 % \theoremstyle{break}
1439 % \newframedtheorem{importantTheorem}[Theorem]{Theorem}
1440 % defines important theorems to use the same design as for theorems
1441 % (except that the break header style is used except the margin header
1442 % style), number them with the same counter, and put a frame around
1443 % them:
1444 %
1445 % An instance is created by
1446 % \begin{quote}
1447 % |\begin{importantTheorem}[Important Theorem]| \\
1448 % |This is an important theorem.| \\
1449 % |\end{importantTheorem}|
1450 % \end{quote}
1451 % \begin{importantTheorem}[Important Theorem]
1452 % This is an important theorem.
1453 % \end{importantTheorem}
1454 %
1455 % Note that all skips have their default values (e.g.\
1456 % |\theoreminframepreskip| is |\topsep|).
1457 % More important theorems are shaded -- by default in grey:
1458 %
1459 % \begin{quote}
1460 % |\theoremclass{Theorem}| \\
1461 % |\theoremstyle{break}| \\
1462 % |\newshadedtheorem{moreImportantTheorem}[Theorem]{Theorem}| \\
1463 % |\begin{moreImportantTheorem}[More Important Theorem]| \\
1464 % |This is a more important theorem.| \\
1465 % |\end{moreImportantTheorem}|
1466 % \end{quote}
1467 % \theoremclass{Theorem}
1468 % \theoremstyle{break}
1469 % \newshadedtheorem{moreImportantTheorem}[Theorem]{Theorem}
1470 % \begin{moreImportantTheorem}[More Important Theorem]
1471 % This is a more important theorem.
1472 % \end{moreImportantTheorem}
1473 %
1474 % Even more important theorems are shaded in red, with 1/2cm
1475 % space inside the frame before and 1 cm space after the text,
1476 % but no additional space before/after the frame:
1477 %
1478 % \begin{quote}
1479 % |\theoremclass{Theorem}| \\
1480 % |\theoremstyle{break}| \\
1481 % |\theoreminframepreskip{0.5cm}| \\
1482 % |\theoreminframepostskip{1cm}| \\
1483 % |\theoremframepreskip{0cm}| \\
1484 % |\theoremframepostskip{0cm}| \\
1485 % |\shadecolor{red}| \\
1486 % |\newshadedtheorem{evenMoreImportantTheorem}[Theorem]{Theorem}| \\
1487 % |\begin{evenMoreImportantTheorem}[Even More Important Theorem]| \\
1488 % |This is an even more important theorem. | \\
1489 % |\end{evenMoreImportantTheorem}|
1490 % \end{quote}
1491 % \theoremclass{Theorem}
1492 % \theoremstyle{break}
1493 % \theoreminframepreskip{0.5cm}
1494 % \theoreminframepostskip{1cm}
1495 % \theoremframepreskip{0cm}
1496 % \theoremframepostskip{0cm}
1497 % \shadecolor{red}
1498 % \newshadedtheorem{evenMoreImportantTheorem}[Theorem]{Theorem}
1499 % \begin{evenMoreImportantTheorem}[Even More Important Theorem]
1500 % This is an even more important theorem.
1501 % \end{evenMoreImportantTheorem}
1502 %
1503 % Most important theorems get a framed, blue colored box with a shadow,
1504 % no space inside the frame, and 1cm before and after the frame.
1505 % Here, |\def\theoremframecommand| is used:
1506 %
1507 % \begin{quote}
1508 % |\theoremclass{Theorem}| \\
1509 % |\theoremstyle{break}| \\
1510 % |\theoreminframepreskip{0pt}| \\
1511 % |\theoreminframepostskip{0pt}| \\
1512 % |\theoremframepreskip{1cm}| \\
1513 % |\theoremframepostskip{1cm}| \\
1514 % |\theoremstyle{break}| \\
1515 % |\def\theoremframecommand{%| \\
1516 % | \psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]}| \\
1517 % |\newshadedtheorem{MostImportantTheorem}[Theorem]{Theorem}| \\
1518 % |\begin{MostImportantTheorem}[Most Important Theorem]| \\
1519 % |This is a most important theorem. | \\
1520 % |\end{MostImportantTheorem}|
1521 % \end{quote}
1522 % \theoremclass{Theorem}
1523 % \theoreminframepreskip{0pt}
1524 % \theoreminframepostskip{0pt}
1525 % \theoremframepreskip{1cm}
1526 % \theoremframepostskip{1cm}
1527 % \theoremstyle{break}
1528 % \def\theoremframecommand{%
1529 % \psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]}
1530 % \newshadedtheorem{MostImportantTheorem}[Theorem]{Theorem}
1531 % \begin{MostImportantTheorem}[Most Important Theorem]
1532 % This is a most important theorem.
1533 % \end{MostImportantTheorem}
1534 %
1535 % \subsection{Lists of Theorems and Friends}
1536 %
1537 % Note, that we put the following lists into the |quote|-environment
1538 % to emphazise them from the surrounding text. So the lists
1539 % are indented slightly at the margin.
1540 %
1541 % With
1542 % \begin{quote}
1543 % |\addtotheoremfile{Added into all theorem lists}|,
1544 % \end{quote}
1545 % in every list, an additional line of text would be inserted.
1546 % But it isn't actually done in this documentation since we want
1547 % to use different list formats.
1548 %
1549 % Only for the list of Examples, this one is added:
1550 % \begin{quote}
1551 % |\addtotheoremfile[Example]{Only concerning Example lists}|
1552 % \end{quote}
1553 % \addtotheoremfile[Example]{Only concerning Example lists}
1554 %
1555 % With
1556 % \begin{quote}
1557 % |\theoremlisttype{all}| \\
1558 % |\listtheorems{Lemma}|,
1559 % \end{quote}
1560 % all lemmas are listed:
1561 % \begin{quote}
1562 % \theoremlisttype{all}
1563 % \listtheorems{Lemma}
1564 % \end{quote}
1565 %
1566 % From the examples, only those are listed which have an optional name:
1567 % \begin{quote}
1568 % |\theoremlisttype{opt}| \\
1569 % |\listtheorems{Example}|
1570 % \end{quote}
1571 % leads to
1572 % \begin{quote}
1573 % \theoremlisttype{opt}
1574 % \listtheorems{Example}
1575 % \end{quote}
1576 % One should note the line \emph{Only concerning example lists}, which
1577 % was added by the |\addtotheoremfile|-statement above.
1578 %
1579 % For the next list, another layout, using the |tabular|-environment,
1580 % is defined:
1581 % \begin{verbatim}
1582 % \newtheoremlisttype{tab}%
1583 % {\begin{tabular*}{\linewidth}{@{}lrl@{\extracolsep{\fill}}r@{}}}%
1584 % {##1&##2&##3&##4\\}%
1585 % {\end{tabular*}}\end{verbatim}
1586 % Thus, by saying
1587 % \begin{quote}
1588 % |\theoremlisttype{tab}|\\
1589 % |\listtheorems{Theorem,importantTheorem,moreImportantTheorem,|
1590 % | evenMoreImportantTheorem,MostImportantTheorem,Lemma},|
1591 % \end{quote}
1592 % theorems (of all importance levels) and lemmata are listed:
1593 % \begin{quote}
1594 % \DeleteShortVerb{\|}
1595 % \newtheoremlisttype{tab}%
1596 % {\begin{tabular*}{\linewidth}{@{}lrl@{\extracolsep{\fill}}r@{}}}%
1597 % {##1&##2&##3&##4\\}%
1598 % {\end{tabular*}}
1599 % \theoremlisttype{tab}
1600 % \listtheorems{Theorem,importantTheorem,moreImportantTheorem,evenMoreImportantTheorem,MostImportantTheorem,Lemma}
1601 % \MakeShortVerb{\|}
1602 % \end{quote}
1603 %
1604 % \LaTeX-lists can also be used to format the theoremlist.
1605 % The input
1606 % \begin{verbatim}
1607 % \newtheoremlisttype{list}%
1608 % {\begin{trivlist}\item}
1609 % {\item[##2 ##1:]\ ##3\dotfill ##4}%
1610 % {\end{trivlist}}
1611 % \theoremlisttype{list}
1612 % \listtheorems{Corollary}\end{verbatim}
1613 % leads to%
1614 % \begin{quote}%
1615 % \DeleteShortVerb{\|}%
1616 % \newtheoremlisttype{list}%
1617 % {\begin{trivlist}}%
1618 % {\item[##2 ##1:]\ ##3\dotfill ##4}%
1619 % {\end{trivlist}}%
1620 % \theoremlisttype{list}\listtheorems{Corollary}%
1621 % \MakeShortVerb{\|}%
1622 % \end{quote}%
1623 % In this example, after the item, \verb*!\ ! is used instead of
1624 % \verb*! !, because in the latter case, |\dotfill| will produce an
1625 % error if the optional argument (|##3|)
1626 % is missing.
1627 %
1628 % \section{The End Mark Algorithm}
1629 %
1630 % \subsection{The Idea}
1631 %
1632 % The handling of endmarks with |thmmarks.sty| is based on the same
1633 % two-pass principle as the handling of labels: the necessary information
1634 % about endmarks is contained in the |.aux| file.
1635 %
1636 % With |thmmarks.sty|, \TeX\ is always aware whether it is in
1637 % some theorem-like environment.
1638 % There, potential positions for endmarks can be
1639 % \begin{enumerate}
1640 % \item\label{elist:1} at the end of simple text lines in open text,
1641 % \item\label{elist:2} at the end of displaymaths,
1642 % \item\label{elist:3} at the end of equations or equationarrays, or
1643 % \item\label{elist:4} at the end of text lines at the end of lists (or, more general,
1644 % |trivlists|, such as |verbatim| or |center|).
1645 % \end{enumerate}
1646 %
1647 % The problem is, that in the cases (\ref{elist:2})--(\ref{elist:4}), the endmarks has to
1648 % be placed in a box which is already shipped out, when
1649 % |\end{...}| is processed.
1650 % Thus, in those situations, \TeX\ needs to know from the |.aux|
1651 % file, whether is has to put an endmark.
1652 %
1653 % When \TeX\ is in a theorem-like environment and comes to one of
1654 % the points mentioned in (\ref{elist:2})--(\ref{elist:4}),
1655 % and the |.aux| file says that there is an endmark, then
1656 % it is put there.
1657 % Anyway, it maintains a counter of the potential positions of an end
1658 % mark in the current theorem-like environment.
1659 % When it comes to an |\end{theorem}|, it looks if it is in
1660 % situation (\ref{elist:1}) (then the endmark is simply put at the end of the
1661 % current line).
1662 % Otherwise, the last horizontal box is already shipped out
1663 % (thus it contains a situation (\ref{elist:2})--(\ref{elist:4})) and the endmark must be
1664 % set in it.
1665 % In this case, a note is written in the |.aux| file, where the
1666 % endmark actually has to be set (ie, at the latest potential point for
1667 % setting an endmark inside the theorem).
1668 %
1669 % \subsection{The Realization}
1670 %
1671 % Let \env\ be a theorem-like environment. Then, additional to
1672 % the counter \env, \TeX\ maintains two counters
1673 % |curr|\env|ctr| and |end|\env|ctr|.
1674 % In the $i$th environment of type \env, |curr|\env|ctr|$=i$
1675 % (the \LaTeX\ counter \env\ cannot be used since a)
1676 % environments can use the counter of other environments, and b)
1677 % often counters are reinitialized inside a document).
1678 % |end|\env|ctr| counts the potential situations for
1679 % putting an endmark inside an environment.
1680 % It is set to 1 when starting an environment. Each time, when
1681 % a situation (\ref{elist:2})--(\ref{elist:4}) is reached, the command
1682 % \begin{quote}
1683 % |\mark|$<$|\thm@romannum{curr|env|ctr}|$>$\env
1684 % $<$|\thm@romannum{end|\env|ctr}|$>$
1685 % \end{quote}
1686 % is called (where |\thm@romannum| just writes the value of a counter
1687 % as its roman numeral representation, e.g., 17 as xvii). \\
1688 % ($<$|\thm@romannum{curr|\env|ctr}|$>$\env
1689 % $<$|\thm@romannum{end|\env|ctr}|$>$
1690 % uniquely identifies all situations (\ref{elist:2})--(\ref{elist:4}) in a document).
1691 %
1692 % If at this position an endmark has to be set,
1693 % \begin{quote}
1694 % |\mark|$<$|\thm@romannum{curr|\env|ctr}|$>$\env
1695 % $<$|\thm@romannum{end|\env|ctr}|$>$
1696 % \end{quote}
1697 % is defined in the |.aux| file to be |\end|\env|Symbol|,
1698 % otherwise it is undefined and simply ignored.
1699 %
1700 % When \TeX\ comes to an |\end{|\env|}|, it looks if it is in
1701 % situation (\ref{elist:1}). If so, the endmark is simply put at the end of the
1702 % current line.
1703 % Otherwise,
1704 % \begin{quote}
1705 % |\def\mark|$<$|\thm@romannum{curr|env|ctr}|$>$\env|%|\\
1706 % $<$|\thm@romannum{end|\env|ctr}|$>$|{|\env|Symbol}|
1707 % \end{quote}
1708 % is written to the |.aux| file for setting the endmark
1709 % at the latest potential position inside the theorem in the next run.
1710 %
1711 % \begin{Theorem}[Correctness]
1712 % \begin{enumerate}
1713 % \item For a |.tex| file, which does not contain nested theorem-like
1714 % environments of the same type, in the above situation, the following
1715 % holds:
1716 % When compiling, at the $i$th situation in the $j$th environment of type
1717 % \env, |mark|$\;j\,$\env$\;i$ is handled.
1718 %
1719 % For |.tex| files which contain nested theorem-like environments of
1720 % the same type, |mark|$\;k\,$\env$\;l$ is handled, where
1721 % $k$ is the number of the latest environment of type \env\ which
1722 % has been called at this moment, and $l$ is the number of situations
1723 % (\ref{elist:2})--(\ref{elist:4}) which have occurred in
1724 % environments of type \env\ since
1725 % the the $k$th |\begin{|\env|}|.
1726 %
1727 % \item When finishing an environment, either an endmark is set directly
1728 % (when in a text line) or an order to put the end symbol at the latest
1729 % potential position is written to the |.aux| file.
1730 % \end{enumerate}
1731 % \end{Theorem}
1732 %
1733 % \begin{Theorem}[Completeness]
1734 % The handling of endmarks is complete wrt.\ plain text, |displaymath|,
1735 % |equation|,\\ |eqnarray|, |eqnarray*|, and all environments
1736 % ended by |endtrivlist|, including |center| and
1737 % |verbatim|.
1738 % \end{Theorem}
1739 %
1740 % So, where can be bugs ?
1741 % \begin{itemize}
1742 % \item in the plain \TeX\ handling of endmarks,
1743 % \item in some special situations which have not been tested yet,
1744 % \item in some special environments which have not been tested yet.
1745 % \item in the |amsmath| environments. We seldom use them, so we do not
1746 % know their pitfalls, and we ran only general test cases.
1747 % \end{itemize}
1748 %
1749 % \section{Problems and Questions}
1750 % \subsection{Known Limitations}
1751 %
1752 % \begin{itemize}
1753 % \item Since |ntheorem.sty| uses the |.aux| file for storing
1754 % information about the positions of endmarks, \LaTeX\ must be
1755 % run twice for correctly setting the endmarks.
1756 % \item Since |ntheorem.sty| uses the |.aux| file for storing
1757 % information about lists in the |.thm| file, a minimum of
1758 % two runs is needed. If theorems move in any of these
1759 % runs up to five runs can be needed to generate correct lists.
1760 % \item Since we need to expand the optional argument of theorems
1761 % in various ways for the lists, we decided to copy the text verbatim
1762 % into the |.thm| file. Thus, if you use things like |\thesection|
1763 % etc., the list won't show the correct text. Therefore you shouldn't
1764 % use any command that needs to be expanded.
1765 % \item In nested environments ending at the same time,
1766 % only the endmark for the inner environment is set, as the following
1767 % example shows:
1768 % \begin{verbatim}
1769 % \begin{Lemma}
1770 % Some text.
1771 % \begin{Proof} The Proof \end{Proof}
1772 % \end{Lemma}\end{verbatim}
1773 % yields to
1774 % \begin{Lemma}
1775 % Some text.
1776 % \begin{Proof} The Proof \end{Proof}
1777 % \end{Lemma}
1778 %
1779 % You can handle this by specifying something invisible after the end
1780 % of the inner theorem. Then the endmark for the outer theorem is
1781 % set in the next line:
1782 % \begin{verbatim}
1783 % \begin{Lemma}
1784 % Some text.
1785 % \begin{Proof} The Proof \end{Proof}~
1786 % \end{Lemma}\end{verbatim}
1787 % yields to
1788 % \begin{Lemma}
1789 % Some text.
1790 % \begin{Proof} The Proof \end{Proof}~
1791 % \end{Lemma}
1792 %
1793 % \item Document option |fleqn| is problematic: |fleqn| handles
1794 % equations not by |$$| but by lists (check what happens for
1795 % \begin{quote}
1796 % |\begin{theorem} \[ displaymath \] \end{theorem}|
1797 % \end{quote}
1798 % in standard \LaTeX:
1799 % The displaymath is \emph{not} set in an own line).
1800 % Also, for long formulas, the equation number and the endmark are
1801 % smashed into the formula at the right text margin.
1802 % \item Naturally, |ntheorem.sty| will not work correctly in
1803 % combination with other styles which change the handling
1804 % of
1805 % \begin{enumerate}
1806 % \item theorem-like environments, or
1807 % \item environments concerned with the handling of endmarks, e.g.
1808 % |\[...\]|, |eqnarray|, etc.
1809 % \end{enumerate}
1810 % \item |ntheorem.sty| is compatible with Frank Mittelbach's
1811 % |theorem.sty|, which is the most widespread style for setting
1812 % theorems.
1813 %
1814 % It cannot be used \emph{with} |theorem.sty|, but it can be
1815 % used instead of it.
1816 % \end{itemize}
1817 %
1818 % \subsection{Known ``Bugs'' and Problems}
1819 %
1820 % \begin{itemize}
1821 % \item Ending a theorem \emph{directly} after the text, e.g.
1822 % \begin{quote}
1823 % |\begin{Theorem} text\end{Theorem}|
1824 % \end{quote}
1825 % suppresses the endmark:
1826 % \begin{Theorem} text\end{Theorem}
1827 % Therefore a space or a newline should be inserted
1828 % before |\end{...}|.
1829 % \item With theoremstyle break, if the linebreak would cause
1830 % ugly linebreaking in the following text, it is suppressed.
1831 % \end{itemize}
1832 %
1833 % \subsection{Open Questions}
1834 % \begin{itemize}
1835 % \item
1836 % For |equation|s, we decided to put the endmark after the equation
1837 % number, which is vertically centered.
1838 % Currently, we do not know, how to get the equation number centered and
1839 % the endmark at the bottom (one has to know the internal height of the
1840 % math material).
1841 % \item
1842 % The placement of endmarks is mainly based on a check whether \LaTeX\
1843 % is in an ordinary text line when encountering an end-of-environment.
1844 % This question is \emph{partially} answered by |\ifhmode|: In a text
1845 % line, \LaTeX\ is always in |\hmode|.
1846 % But, after an displaymath, \LaTeX\ is also in |\hmode|. Thus,
1847 % additionally |\lastskip| is checked: after a displaymath,
1848 % |\lastskip|=0 holds.
1849 % In most situations, when text has been written into a line,
1850 % |\lastskip| $\neq$ 0. But, this does not hold, if the source code
1851 % is of the following form: |...text\label{bla}|: then, |\lastskip|=0.
1852 % In those situations, the endmark is suppressed. \\
1853 % ?? How can it be detected whether \LaTeX\ has just ended a displaymath?
1854 % \item
1855 % The above problem with the label: The break style enforces a linebreak
1856 % by |\hfill\penalty-8000| after the |\trivlist|-item. Thus, \TeX\
1857 % gets back into the horizontal mode. The label places a ``whatsit''
1858 % somewhere ... and, it seems that the ``whatsit'' makes \TeX\ think
1859 % that there is a line of text.
1860 % \end{itemize}
1861 % If someone has a solution to one of those questions, please inform us.
1862 % (You can be sure to be mentioned in the Acknowledgements.)
1863 %
1864 % \section{Code Documentation}\label{sec:code}
1865 % \iffalse
1866 % \subsection{The documentation driver file}
1867 %
1868 % The next bit of code contains the documentation driver file for
1869 % \TeX{}, i.e., the file that will produce the documentation you are
1870 % currently reading. It will be extracted from this file by the
1871 % \texttt{docstrip} program. Since it is the first code in the file
1872 % one can alternatively process this file directly with \LaTeXe{} to
1873 % obtain the documentation.
1874 %
1875 % \begin{macrocode}
1876 %<*driver>
1877 \documentclass{ltxdoc} \usepackage{latexsym}
1878 \usepackage{framed} \usepackage{pstricks}
1879 \usepackage[thmmarks,thref,noconfig,framed]{ntheorem} \parindent0pt\hfuzz2pt
1880 \setlength{\textwidth}{360pt}
1881 \begin{document}
1882 \DocInput{ntheorem.dtx}
1883 \end{document}
1884 %</driver>
1885 % \end{macrocode}
1886 %\fi
1887 % \subsection{Documentation of the Macros}
1888 % \setcounter{CodelineNo}{0}
1889 %\iffalse
1890 %<*package>\fi
1891 % \begin{macrocode}
1892 \typeout{Style `\basename', Version \fileversion\space <\filedate>}
1893 \ProvidesPackage{ntheorem}[\filedate \space\fileversion]
1894 \RequirePackage{ifthen}%
1895 \newif\if@thmmarks\@thmmarksfalse
1896 \newif\if@thref\@threffalse
1897 \newif\ifthm@inframe\thm@inframefalse
1898 \newif\ifthm@tempif
1899 % \end{macrocode}
1900 %
1901 % general setup. \medskip
1902 %
1903 % \subsubsection{Thmmarks-Related Stuff}
1904 %
1905 % \setcounter{CodelineNo}{0}
1906 % \changes{v0.87}{1997/02/18}{option 'thmmarks' added (WM)}
1907 % \begin{macrocode}
1908 \DeclareOption{thmmarks}{%*********************************
1909 \PackageInfo{\basename}{Option `thmmarks' loaded}%
1910 %
1911 \@thmmarkstrue
1912 \newcounter{endNonectr}
1913 \newcounter{currNonectr}
1914 \newif\ifsetendmark\setendmarktrue
1915 % \end{macrocode}
1916 %
1917 % activate placement of endmarks and define counters for upper
1918 % level. \\
1919 % |\ifsetendmark|: true if an endmark has to be set in a complex
1920 % situation which must be handled by the |.aux| file.
1921 % For further comments see |\@endtheorem|.
1922 %
1923 %
1924 % \begin{macro}{\thm@romannum}
1925 % \changes{v1.28}{2009/07/02}{duplicate latex's definition (WM),
1926 % reported by Ch. Garcia Duarte}
1927 % The functionality of |latex.ltx|'s |\roman| command converts
1928 % numbers into strings, e.g., 17 into xvii. It is used to put
1929 % notes into the |.aux| file. It must be
1930 % locally defined, just duplicating the definition of |\roman| in
1931 % latex.ltx since some packages redefine |\roman|:
1932 % \begin{macrocode}
1933 \gdef\thm@romannum#1{\expandafter\thm@roman@num\csname c@#1\endcsname}%
1934 \gdef\thm@roman@num#1{\romannumeral #1}%
1935 % \end{macrocode}
1936 % \end{macro}
1937 %
1938 % In the following, all relevant environments are changed for
1939 % handling potential end mark positions:
1940 %
1941 % \paragraph{Changes to List Environment}\ \\
1942 % Original: ltlists.dtx
1943 %
1944 % \begin{macro}{\endtrivlist}
1945 % \changes{v1.19}{2001/01/13}{changed hbox into unskip (OK/WM)}
1946 % Replaces \LaTeX's |\endtrivlist|. An augmented functionality of
1947 % \LaTeX's |\endtrivlist| is contained in |\@endtrivlist|.
1948 %
1949 % \begin{macrocode}
1950 \gdef\endtrivlist{%
1951 \@endtrivlist{\PotEndMark{\unskip\nobreak\hfill\nobreak}}}
1952 % \end{macrocode}
1953 %
1954 % At an |\endtrivlist| (which is called at the end
1955 % of |\list| environments and several other environments),
1956 % |\@endtrivlist| is called to end the |\trivlist| and
1957 % set a potential position for an endmark at the end of the line if
1958 % \TeX\ is in a text line.
1959 % \end{macro}
1960 %
1961 %
1962 % \begin{macro}{\@endtrivlist}
1963 % A new command] which augments \LaTeX's functionality of
1964 % |\endtrivlist| by checking if an end mark has to be set:
1965 %
1966 % \Codelabel{atendtrivlist}
1967 % \begin{macrocode}
1968 \gdef\@endtrivlist#1{% % from \endtrivlist
1969 \if@inlabel \indent\fi
1970 \if@newlist \@noitemerr\fi
1971 \ifhmode
1972 \ifdim\lastskip >\z@ #1\unskip \par %<<<<<<<<<<<<<<<<<<<<<<
1973 \else \unskip \par \fi
1974 \fi
1975 \if@noparlist \else
1976 \ifdim\lastskip >\z@
1977 \@tempskipa\lastskip \vskip -\lastskip
1978 \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
1979 \vskip\@tempskipa
1980 \fi
1981 \@endparenv
1982 \fi}
1983 % \end{macrocode}
1984 %
1985 % New: parameter |#1|. \\
1986 % |#1| is executed when the |\trivlist| ends with a text line (ie the
1987 % endmark can be put simply at the end of the line): \\
1988 % Line \Coderef{atendtrivlist}{5}:
1989 % case split: if in |hmode| and |\lastskip| $>$ 0,
1990 % then \TeX\ is in a text line, the endmark is set here.
1991 % \end{macro}
1992 %
1993 % \paragraph{Changes to Math Environments}\ \\
1994 % Original: ltmath.dtx
1995 %
1996 % \begin{macro}{\endequation}
1997 % For equations, end marks are placed behind the equation number:
1998 % \Codelabel{standard-endequation}
1999 % \begin{macrocode}
2000 \gdef\SetMark@endeqn{\quad}% as default, cf. option leqno
2001 \gdef\endequation{\eqno \hbox{\@eqnnum \PotEndMark{\SetMark@endeqn}}%
2002 $$\global\@ignoretrue}
2003 % \end{macrocode}
2004 %
2005 % \begin{packeddescr}
2006 % \item[Line \Coderef{standard-endequation}{1}:]
2007 % As default, work for equation numbers at the right:
2008 % Then, a |\quad| is placed between equation number and endmark.
2009 % \item[Line \Coderef{standard-endequation}{2}:]
2010 % In addition to the equation number (set by |\@eqnnum| at the
2011 % right of the line) |\SetMark@endeqn| is carried out.
2012 % \end{packeddescr}\end{macro}
2013 %
2014 % \begin{macro}{\[}
2015 % \changes{v1.27}{2008/06/18}{fixed: start array with no additional
2016 % space (WM, reported by Tillmann Berg)}
2017 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2018 % If an end mark is set, a displaymath is put into box such that
2019 % the end marks appears at its bottom level at the right. Thus, also
2020 % the definition of |\[| has to be changed:
2021 % \Codelabel{st-b-displ}
2022 % \begin{macrocode}
2023 \gdef\[{%
2024 \relax\ifmmode
2025 \@badmath
2026 \else
2027 \ifvmode
2028 \nointerlineskip
2029 \makebox[.6\linewidth]%
2030 \fi
2031 $$\stepcounter{end\InTheoType ctr}%
2032 \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
2033 \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
2034 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
2035 \boxmaxdepth=.5ex\begin{array}[b]{@{}l}%
2036 \boxmaxdepth=\maxdimen\displaystyle\fi}%
2037 \addtocounter{end\InTheoType ctr}{-1}%
2038 %%$$ BRACE MATCH HACK
2039 \fi}
2040 % \end{macrocode}
2041 %
2042 % \begin{packeddescr}
2043 % \item[Lines \Coderef{st-b-displ}{2}--\Coderef{st-b-displ}{8},
2044 % \Coderef{st-b-displ}{16}, \Coderef{st-b-displ}{17}:]
2045 % the old definition.
2046 % \item[Lines \Coderef{st-b-displ}{9}--\Coderef{st-b-displ}{12}:]
2047 % The end position of a displaymath inside a theorem-environment
2048 % corresponds to |end\InTheoType ctr|+1.
2049 % An endmark has to be set there, if \\
2050 % \hspace*{0.5cm} |\mark|$<$|\thm@romannum{curr#1ctr}|$>$|#1|%
2051 % $<$|\thm@romannum{end#1ctr}|$+1>$
2052 % is defined and not the empty symbol.
2053 % \item[Lines \Coderef{st-b-displ}{13}--\Coderef{st-b-displ}{14}:]
2054 % If so, the whole displayed stuff is put in an array with
2055 % maximal depth 0.5|ex| and vertically adjusted with its bottom line
2056 % (then, the endmarks will appear adjusted to its bottom line).
2057 % \item[Line \Coderef{st-b-displ}{15}:]The counter has to be re-decremented.
2058 % \end{packeddescr}\end{macro}
2059 %
2060 % \begin{macro}{\]}
2061 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2062 % At the end of a displaymath, the end marks is set at its bottom level:
2063 % \Codelabel{st-e-displ}
2064 % \begin{macrocode}
2065 \gdef\]{%
2066 \stepcounter{end\InTheoType ctr}%
2067 \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
2068 \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
2069 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
2070 \end{array}\fi}%
2071 \addtocounter{end\InTheoType ctr}{-1}%
2072 \relax\ifmmode
2073 \ifinner
2074 \@badmath
2075 \else
2076 \PotEndMark{\eqno}\global\@ignoretrue$$%%$$ BRACE MATCH HACK
2077 \fi
2078 \else
2079 \@badmath
2080 \fi
2081 \ignorespaces}
2082 % \end{macrocode}
2083 %
2084 % \begin{packeddescr}
2085 % \item[Lines \Coderef{st-e-displ}{2}--\Coderef{st-e-displ}{7}:]
2086 % Look, if an endmark has to be set in this displaymath
2087 % (analogous to lines
2088 % \Coderef{st-b-displ}{9}--\Coderef{st-b-displ}{15} of |\def\[|)
2089 % If so, there is an inner array which has to be closed
2090 % (line \Coderef{st-e-displ}{6}).
2091 % \item[Lines \Coderef{st-e-displ}{8}--\Coderef{st-e-displ}{17}:]
2092 % the old definition.
2093 % \item[Line \Coderef{st-e-displ}{12}:] changed to set an endmark at
2094 % the right of the line if necessary (this is done by |\eqno|).
2095 % \end{packeddescr}\end{macro}
2096 %
2097 % \begin{macro}{\endeqnarray}
2098 % For |\eqnarray|s, the end marks is set below the number
2099 % of the last equation:
2100 % \changes{v0.90}{1997/02/19}{fixed endmark for `eqnarrays' (WM)}
2101 % \changes{v0.91}{1997/02/22}{fixed `endeqnarray' (WM)}
2102 % \Codelabel{st-endeqnarray}
2103 % \begin{macrocode}
2104 \gdef\SetMark@endeqnarray#1{\llap{\raisebox{-1.3em}{#1}}}
2105 \gdef\endeqnarray{%
2106 \global\let\Oldeqnnum=\@eqnnum
2107 \gdef\@eqnnum{\Oldeqnnum\PotEndMark{\SetMark@endeqnarray}}%
2108 \@@eqncr
2109 \egroup
2110 \global\advance\c@equation\m@ne
2111 $$\global\@ignoretrue
2112 \global\let\@eqnnum\Oldeqnnum}
2113 % \end{macrocode}
2114 %
2115 % \begin{packeddescr}
2116 % \item[Line \Coderef{st-endeqnarray}{1}:]
2117 % As default work for equation numbers at the right:
2118 % Then, the endmark is placed below the last equation number at the
2119 % right margin.
2120 % \item[New: Lines \Coderef{st-endeqnarray}{3},%
2121 % \Coderef{st-endeqnarray}{4}, \Coderef{st-endeqnarray}{9}:]\
2122 % \item[Line \Coderef{st-endeqnarray}{3}:] save |\@eqnnum|.
2123 % \item[Line \Coderef{st-endeqnarray}{4}:]
2124 % define |\@eqnnum| to carry out |\Oldeqnnum|, then a potential endmark
2125 % position is handled:
2126 % if an endmark is set, between the equation number and the endmark,
2127 % the command sequence |\SetMark@endeqnarray| is carried out --
2128 % there, since |\SetMark@endeqnarray| is a function of one
2129 % argument, the endmark will be this argument.
2130 % \item[Lines \Coderef{st-endeqnarray}{5}--\Coderef{st-endeqnarray}{8}:]
2131 % from |latex.ltx|.
2132 % Line \Coderef{st-endeqnarray}{5} sets the equation number.
2133 % \item[Line \Coderef{st-endeqnarray}{9}:] restore |\@eqnnum|.
2134 % \end{packeddescr}\end{macro}
2135 %
2136 % \begin{macro}{\endeqnarray*}
2137 % In an |\eqnarray*|, the end mark is set at the right of the
2138 % last equation:
2139 % \Codelabel{st-endeqnarray-star}
2140 % \begin{macrocode}
2141 \@namedef{endeqnarray*}{%
2142 % from \@@eqncr:
2143 \let\reserved@a\relax
2144 \ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
2145 \or \def\reserved@a{&}\else
2146 \let\reserved@a\@empty
2147 \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
2148 \reserved@a {\normalfont \normalcolor \PotEndMark{}}%
2149 \global\@eqnswtrue\global\@eqcnt\z@\cr
2150 %
2151 \egroup
2152 \global\advance\c@equation\m@ne
2153 $$\global\@ignoretrue}
2154 % \end{macrocode}
2155 %
2156 % This is just \LaTeX's |\endeqnarray| where lines
2157 % \Coderef{st-endeqnarray-star}{3}--\Coderef{st-endeqnarray-star}{9}
2158 % are inserted from |\@@eqncr| and augmented (line
2159 % \Coderef{st-endeqnarray-star}{8}) to set a potential endmark
2160 % (with no additional commands) at the end of the current line.
2161 % \end{macro}
2162 %
2163 % \paragraph{Changes to Tabbing Environment}\ \\
2164 % Original: lttab.dtx
2165 %
2166 %\begin{macro}{\endtabbing}%
2167 % \changes{v1.04}{1998/05/26}{added 'endtabbing' (WM)}
2168 % Here, the |\endtrivlist| modification is not sufficient: \LaTeX\ is
2169 % not in hmode when it calls |\endtrivlist| from |\endtabbing|;
2170 % additionally, |\@stopline| already outputs a linebreak.
2171 % Thus, the end mark is inserted \emph{before} |\@stopline| at
2172 % the right margin (using |\`|).
2173 % \begin{macrocode}
2174 \gdef\endtabbing{%
2175 \PotEndMark{\`}\@stopline\ifnum\@tabpush >\z@ \@badpoptabs
2176 \fi\endtrivlist}
2177 % \end{macrocode}
2178 % \end{macro}
2179 %
2180 % \paragraph{Changes to Center Environment}\ \\
2181 % Original: ltmiscen.dtx
2182 %
2183 %\begin{macro}{\endcenter}%
2184 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2185 % In \LaTeX, |\endcenter| just calls |\endtrivlist|.
2186 % Here, the situation is more complex since the the endmark has
2187 % to be put in the last line without affecting its centering:
2188 % if in a text line (only then, here is a potential endmark
2189 % position):
2190 % \begin{macrocode}
2191 \gdef\endcenter{%
2192 \@endtrivlist
2193 {\PotEndMark{\rightskip0pt%
2194 \settowidth{\leftskip}%
2195 { \csname mark\thm@romannum{curr\InTheoType ctr}\InTheoType
2196 \thm@romannum{end\InTheoType ctr}\endcsname}%
2197 \advance\leftskip\@flushglue\hskip\@flushglue}}}
2198 % \end{macrocode}
2199 %
2200 % The |\rightskip| of the line is set to 0, |\leftskip|
2201 % is set to the width of one space (since on the right, one space is
2202 % added after the text) plus the endmark and infinitely stretchable glue
2203 % (|\@flushglue|), and also the line is continued with
2204 % |\@flushglue| (the actual position is one space after the text),
2205 % and then the endmark is placed (by |\PotEndMark|).
2206 % \end{macro}
2207 %
2208 % \paragraph{Handling of Endmarks}
2209 %
2210 % \begin{macro}{\@endtheorem-thmmarks}
2211 % |\@endtheorem| is called for every |\end{|\env|}|, where \env\ is a
2212 % theorem-like environment. |\@endtheorem| is extended to organize
2213 % the placement of the corresponding end mark
2214 % (|\InTheoType| gives the innermost theorem-like environment,
2215 % i.e.\ the one to be ended):
2216 %
2217 % \Codelabel{atendtheorem}
2218 % \begin{macrocode}
2219 \gdef\@empty{}
2220 \gdef\@endtheorem{%
2221 \expandafter
2222 \ifx\csname\InTheoType Symbol\endcsname\@empty\setendmarkfalse\fi
2223 \@endtrivlist
2224 {\ifsetendmark
2225 \unskip\nobreak\hfill\nobreak\csname\InTheoType Symbol\endcsname
2226 \setendmarkfalse \fi}%
2227 \ifsetendmark\OrganizeTheoremSymbol\else\global\setendmarktrue\fi
2228 \csname\InTheoType @postwork\endcsname
2229 }
2230 % \end{macrocode}
2231 % \changes{v0.91}{1997/02/27}{'@empty' fixed (WM)}
2232 % \changes{v0.94}{1997/03/19}{'setendmarktrue' globalized (WM)}
2233 % \changes{v1.19}{2001/01/13}{changed hbox into unskip (OK/WM)}
2234 % \changes{v1.21}{2002/12/30}{added handling of 'theorempostwork' (WM)}
2235 %
2236 % \begin{packeddescr}
2237 % \item[Lines \Coderef{atendtheorem}{3}, \Coderef{atendtheorem}{4}:]
2238 % if the end symbol of the environment $\env$ to be closed is
2239 % empty, simply no end symbol has to be set (it makes a difference, if no
2240 % end symbol is set, or if an empty end symbol is set).
2241 % \item[Lines \Coderef{atendtheorem}{5}, \Coderef{atendtheorem}{9}:]
2242 % (originally, it calls |\endtrivlist|):
2243 % \item[Lines \Coderef{atendtheorem}{5}, \Coderef{atendtheorem}{7},
2244 % \Coderef{atendtheorem}{8}:]
2245 % |\@endtrivlist| is called to put $\env$|Symbol|
2246 % at the end of the line and set |setendmark| to false
2247 % if \TeX\ is in a text line and |setendmark| is true. \\
2248 % At this point, |setendmark| is false iff the user has disabled
2249 % it locally or the end symbol is empty.
2250 % \item[Line \Coderef{atendtheorem}{6}:] the endmark is not set,
2251 % if |setendmark| is false.
2252 % \item[Line \Coderef{atendtheorem}{9}:]
2253 % if |setendmark| is true, the correct placement of the end
2254 % symbol is organized, else (ie either |setendmarkfalse| is set
2255 % by the user, or the endmark is already set by |\@endtrivlist|)
2256 % reset |setendmark| to true.\\
2257 % For further comments see |\@endtrivlist| and
2258 % |\OrganizeTheoremSymbol|.
2259 % \end{packeddescr}
2260 % The construction in line \Coderef{atendtheorem}{7} guarantees that
2261 % the endmark is put at the end of the line, even if it is the only
2262 % letter in this line.
2263 % \end{macro}
2264 %
2265 % \begin{macro}{\NoEndMark}
2266 % By |\NoEndMark|, the automatical setting of an end mark is blocked
2267 % for the \emph{current} environment.
2268 % \begin{macrocode}
2269 \gdef\NoEndMark{\global\setendmarkfalse}
2270 % \end{macrocode}
2271 % \changes{v0.94}{1997/03/19}{'NoEndMark' introduced (WM)}
2272 % \end{macro}
2273 %
2274 % set |setendmark| to false. It is automatically reset to |true| after
2275 % the end of the current environment.
2276 %
2277 % \begin{macro}{\qed}
2278 % With |\qed|, the user can locally change the end symbol to appear:
2279 % \begin{macrocode}
2280 \gdef\qed{\expandafter\def\csname \InTheoType Symbol\endcsname
2281 {\the\qedsymbol}}%
2282 % \end{macrocode}\end{macro}
2283 %
2284 % When calling |\qed|, the end symbol of the innermost theorem-like
2285 % environment at that time is set to the value stored in |\qedsymbol|
2286 % at that time.
2287 %
2288 % \begin{macro}{\PotEndMark}
2289 % Handling a potential endmark position:
2290 %
2291 % \changes{v1.32}{2011/24/02}{added optional argument (WM)}
2292 % \begin{macrocode}
2293 \gdef\PotEndMark#1{
2294 \@ifnextchar[%]
2295 {\PotEndMark@opt{#1}}{\SetEndMark{\InTheoType}{#1}{\relax}}}%
2296 \gdef\PotEndMark@opt#1[#2]{\SetEndMark{\InTheoType}{#1}{#2}}%
2297 % \end{macrocode}
2298 %
2299 % Arguments: \meta{cmd\_seq}:=|#1| is a command sequence to be
2300 % executed when setting the endmark. \\
2301 % \meta{else\_cmd\_seq}= |#2|: a command sequence that is executed
2302 % when no end mark is set (default is |\relax|; differs only in
2303 % amsmath equation*). \\
2304 % It adds the current theorem type \env\ to the parameters, and
2305 % calls \\
2306 % |\SetEndMark{|\env|}{|\meta{cmd\_seq}|}{|\meta{else\_cmd\_seq}|}|.
2307 % \end{macro}
2308 %
2309 % \begin{macro}{\SetEndMark}
2310 % |\SetEndMark| sets an endmark for an environment. It is
2311 % called by |\PotEndMark|.
2312 % \changes{v1.16}{1999/08/05}{extended for handling right indents (quote) (WM)}
2313 % \changes{v1.16}{2001/11/28}{removed tilde in hbox (WM)}
2314 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2315 % \changes{v1.32}{2011/24/02}{added third argument (WM)}
2316 % \Codelabel{SetEndMark}
2317 % \begin{macrocode}
2318 \gdef\SetEndMark#1#2#3{%
2319 \stepcounter{end#1ctr}%
2320 \@ifundefined{mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}}%
2321 {#3}%
2322 {#2{\csname mark\thm@romannum{curr#1ctr}#1\thm@romannum{end#1ctr}\endcsname
2323 \ifdim\rightmargin>\z@\hskip-\rightmargin\fi
2324 \hbox to 0cm{}}}}%
2325 % \end{macrocode}
2326 %
2327 % Arguments: \\
2328 % \env:=|#1|: current theorem-environment. \\
2329 % \meta{cmd\_seq}:= |#2|: is a command sequence to be executed when setting
2330 % the endmark. \\
2331 % \meta{else\_cmd\_seq}= |#3|: a command sequence that is executed
2332 % when no end mark is set (usually |\relax|; differs only in amsmath tags). \\
2333 % All three arguments are transmitted by |\PotEndMark|. \\
2334 % \begin{packeddescr}
2335 % \item[Line \Coderef{SetEndMark}{2}:]
2336 % increments |end|\env|ctr| for preparing the next situation
2337 % for setting a potential endmark.
2338 % \item[Line \Coderef{SetEndMark}{3}, \Coderef{SetEndMark}{4}:]
2339 % if
2340 % \begin{quote}
2341 % |\mark|$<$|\thm@romannum{curr|\env|ctr}|$>$\env%
2342 % $<$|\thm@romannum{end|\env|ctr}|$>$
2343 % \end{quote}
2344 % is undefined
2345 % -- which is the case iff at this position no endmark has to be set --,
2346 % \meta{else\_cmd\_seq} is executed,
2347 % \item[Line \Coderef{SetEndMark}{5}:]
2348 % otherwise, \meta{cmd\_seq} and then
2349 % \begin{quote}
2350 % |\mark|$<$|\thm@romannum{curr|\env|ctr}|$>$|\env|%
2351 % $<$|\thm@romannum{end|\env|ctr}|$>$,
2352 % \end{quote}
2353 % which is defined in the |.aux| file to be the end symbol are called. \\
2354 % The construction \meta{cmd\_seq}|{|\ldots|}| in line
2355 % \Coderef{SetEndMark}{5} allows the handling of the end symbol as an
2356 % argument of \meta{cmd\_seq} as needed for |\endeqnarray|.
2357 % \item[Line \Coderef{SetEndMark}{6}:]
2358 % By |\hskip-\rightmargin\hbox to 0cm{}|, a negative hspace of
2359 % amount |\rightmargin| is added \emph{after} the end symbol -- thus,
2360 % the symbol is set as there were no right margin (this concerns,
2361 % e.g., |\quote| environments). \\
2362 % (applied only if |\rightmargin| is more than 0 -- otherwise bug
2363 % if preceding line ends with hyphenation.)
2364 % \end{packeddescr}
2365 % \changes{v1.20}{2001/12/30}{apply negative hskip only if more than 0 (WM)}
2366 %\end{macro}
2367 %
2368 % \paragraph{Writing to .aux file.}
2369 % (copied from |\def\label| (ltxref.dtx))
2370 %
2371 % \changes{v0.91}{1997/02/20}{fixed `OrganizeTheoremSymbol' (WM)}
2372 % \changes{v1.20}{2001/10/09}{check that not in vmode in bbsphack (WM)}
2373 % \Codelabel{bbsphack}
2374 % \begin{macrocode}
2375 \newskip\mysavskip
2376 \gdef\@bbsphack{%
2377 \ifvmode\else\mysavskip\lastskip
2378 \unskip\fi}
2379 %
2380 \gdef\@eesphack{%
2381 \ifdim\mysavskip>\z@
2382 \vskip\mysavskip \else\fi}
2383 % \end{macrocode}
2384 % \begin{packeddescr}
2385 % \item[Lines \Coderef{bbsphack}{2}--\Coderef{bbsphack}{4} and
2386 % \Coderef{bbsphack}{5}--\Coderef{bbsphack}{7}]
2387 % are similar to |\@bsphack| and |\@bsphack|
2388 % of latex.ltx. They undo resp.\ redo the last |skip|.
2389 % \end{packeddescr}
2390 % Note that |@bbsphack| and |@eesphack| are also part of the
2391 % thref option. Change both if you change them.
2392 %
2393 % \begin{macro}{\OrganizeTheoremSymbol}
2394 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2395 % The information for setting the end marks is written to the .aux file:
2396 %
2397 % \Codelabel{OrgThSymb}
2398 % \begin{macrocode}
2399 \gdef\OrganizeTheoremSymbol{%
2400 \@bbsphack
2401 \edef\thm@tmp{\expandafter\expandafter\expandafter\thm@meaning
2402 \expandafter\meaning\csname\InTheoType Symbol\endcsname\relax}%
2403 \protected@write\@auxout{}%
2404 {\string\global\string\def\string\mark%
2405 \thm@romannum{curr\InTheoType ctr}\InTheoType \thm@romannum{end\InTheoType ctr}%
2406 {\thm@tmp}}%
2407 \@eesphack}
2408 % \end{macrocode}
2409 %
2410 % \begin{packeddescr}
2411 % \item[Lines \Coderef{OrgThSymb}{5}--\Coderef{OrgThSymb}{7}:]
2412 % Write \\
2413 % |\global\def\mark|$<$|\thm@romannum{curr|\env|ctr}|$>\env
2414 % <$|\thm@romannum{end|\env|ctr}|$>$%
2415 % |{<|\env|Symbol>}|
2416 % to the |.aux| file. \\
2417 % \env :=|\InTheoType| gives the innermost theorem-like environment,
2418 % i.e. the one the end symbol has to be set for.
2419 % \end{packeddescr}\end{macro}
2420 %
2421 % \begin{macrocode}
2422 } % end of option [thmmarks]
2423 % \end{macrocode}
2424 %
2425 % \subsubsection{Option leqno to Thmmarks}
2426 %
2427 % \Codelabel{Optleqno}
2428 % \begin{macrocode}
2429 \DeclareOption{leqno}{% *********************************************
2430 \if@thmmarks
2431 \PackageInfo{\basename}{Option `leqno' loaded}%
2432 \gdef\SetMark@endeqn#1{\hss\llap{#1}}
2433 \gdef\SetMark@endeqnarray#1{\hss\llap{#1}}
2434 \fi}%
2435 % \end{macrocode}
2436 % |leqno| is only active it |thmmarks| is also active. \\
2437 % \begin{packeddescr}
2438 % \item[Line \Coderef{Optleqno}{4}, \Coderef{Optleqno}{5}:]
2439 % Since with |leqno|, the equation number is placed on
2440 % the left, after infinitely stretchable glue, the endmark can be
2441 % set straight at the right margin.
2442 % \end{packeddescr}
2443 %
2444 % \subsubsection{Option fleqn to Thmmarks}
2445 %
2446 % \begin{macrocode}
2447 \DeclareOption{fleqn}{% *********************************************
2448 \if@thmmarks
2449 \PackageInfo{\basename}{Option `fleqn' loaded}%
2450 % \end{macrocode}
2451 %
2452 % |fleqn| is only active it |thmmarks| is also active.
2453 %
2454 % \begin{macro}{\[}
2455 % \changes{v1.27}{2008/06/18}{fixed: start array with no additional
2456 % space (WM, reported by Tillmann Berg)}
2457 % Since |fleqn| treats displayed math as trivlists, it's quite
2458 % another thing:
2459 %
2460 % \Codelabel{fleqn-b-displ}
2461 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2462 % \begin{macrocode}
2463 \renewcommand\[{\relax
2464 \ifmmode\@badmath
2465 \else
2466 \begin{trivlist}%
2467 \@beginparpenalty\predisplaypenalty
2468 \@endparpenalty\postdisplaypenalty
2469 \item[]\leavevmode
2470 \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
2471 \hskip\mathindent\bgroup
2472 \stepcounter{end\InTheoType ctr}%
2473 \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
2474 \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
2475 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
2476 \boxmaxdepth=.5ex\begin{array}[b]{@{}l}%
2477 \boxmaxdepth=\maxdimen\displaystyle\fi}%
2478 \addtocounter{end\InTheoType ctr}{-1}%
2479 \fi}
2480 % \end{macrocode}
2481 %
2482 % \begin{packeddescr}
2483 % \item[Lines \Coderef{fleqn-b-displ}{1}--\Coderef{fleqn-b-displ}{9},%
2484 % \Coderef{fleqn-b-displ}{17}:]
2485 % the old definition.
2486 % \item[Line \Coderef{fleqn-b-displ}{10}--\Coderef{fleqn-b-displ}{16}:]
2487 % if an endmark has to be set in this displaymath, it
2488 % is put into an array with depth $\le 0.5$|ex|, and vertically
2489 % adjusted to the bottom line.
2490 % \end{packeddescr}\end{macro}
2491 %
2492 % \begin{macro}{\]}
2493 % \changes{v1.28}{2009/07/02}{replaced roman by thm@romannum (WM)}
2494 % Here, the end mark is placed after a |\hfil| ate the end of the line
2495 % containing the displaymath:
2496 %
2497 % \Codelabel{fleqn-e-displ}
2498 % \begin{macrocode}
2499 \renewcommand\]{%
2500 \stepcounter{end\InTheoType ctr}%
2501 \@ifundefined{mark\thm@romannum{curr\InTheoType ctr}%
2502 \InTheoType\thm@romannum{end\InTheoType ctr}}{\relax}%
2503 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
2504 \end{array}\fi}%
2505 \addtocounter{end\InTheoType ctr}{-1}%
2506 \relax\ifmmode
2507 \egroup $\hfil\PotEndMark{}% $
2508 \egroup
2509 \end{trivlist}%
2510 \else \@badmath
2511 \fi}
2512 % \end{macrocode}
2513 %
2514 % \begin{packeddescr}
2515 % \item[Lines \Coderef{fleqn-e-displ}{2}--\Coderef{fleqn-e-displ}{6}:]
2516 % Look, if an endmark has to be set in this displaymath.
2517 % If so, close the inner array.
2518 % \item[Lines \Coderef{fleqn-e-displ}{8}--\Coderef{fleqn-e-displ}{13}:]
2519 % the old definition.
2520 % \item[Line \Coderef{fleqn-e-displ}{9}:] Added |\PotEndMark|.
2521 % \end{packeddescr}\end{macro}
2522 %
2523 % \begin{macro}{\endequation}
2524 % for equations, the end mark is also set with the equation number:
2525 % \Codelabel{fleqn-endeqn}
2526 % \begin{macrocode}
2527 \gdef\endequation{%
2528 $\hfil % $
2529 \displaywidth\linewidth\hbox{\@eqnnum \PotEndMark{\SetMark@endeqn}}%
2530 \egroup
2531 \endtrivlist}
2532 % \end{macrocode}
2533 %
2534 % \begin{packeddescr}
2535 % \item[Line \Coderef{fleqn-endeqn}{3}:]
2536 % When the equation number is set, also the endmark is set with
2537 % the same trick as for |\endequation| without |fleqn|.
2538 % \end{packeddescr}\end{macro}
2539 %
2540 % \begin{macro}{\endeqnarray}
2541 % When the equation number is set, also the endmark is set with
2542 % the same trick as for |\endeqnarray| without |fleqn| (see
2543 % Lines \Coderef{fleqn-endeqnarray}{2}, \Coderef{fleqn-endeqnarray}{3},%
2544 % \Coderef{fleqn-endeqnarray}{8}):
2545 %
2546 % \Codelabel{fleqn-endeqnarray}
2547 % \begin{macrocode}
2548 \gdef\endeqnarray{%
2549 \global\let\Oldeqnnum=\@eqnnum
2550 \gdef\@eqnnum{\Oldeqnnum\PotEndMark{\SetMark@endeqnarray}}%
2551 \@@eqncr
2552 \egroup
2553 \global\advance\c@equation\m@ne$$% $$
2554 \global\@ignoretrue
2555 \global\let\@eqnnum\Oldeqnnum}
2556 % \end{macrocode}
2557 % \end{macro}
2558 %
2559 % \begin{macrocode}
2560 \fi}% end of option fleqn
2561 % \end{macrocode}
2562 %
2563 % \subsubsection{Extended Referencing Facilities}\label{sec:Referencing}
2564 %
2565 % \begin{macrocode}
2566 \DeclareOption{thref}{%**********************************************
2567 \PackageInfo{\basename}{Option `thref' loaded}%
2568 \@threftrue
2569 % \end{macrocode}
2570 %
2571 % Option |thref| needs a special handling when combined with amsmath.
2572 % This is also a reason why it is handled first.
2573 %
2574 % \begin{macro}{\bbsphack(2)}
2575 % \changes{v1.19}{2001/01/12}{added to thref option (error if thref
2576 % was used without thmmarks; OK/WM)}
2577 % \changes{v1.20}{2001/10/09}{check that not in vmode in bbsphack; (WM)}
2578 % \begin{macrocode}
2579 \newskip\mysavskip
2580 \gdef\@bbsphack{%
2581 \ifvmode\else\mysavskip\lastskip
2582 \unskip\fi}
2583 %
2584 \gdef\@eesphack{%
2585 \ifdim\mysavskip>\z@
2586 \vskip\mysavskip \else\fi}
2587 % \end{macrocode}
2588 % Note that |@bbsphack| and |@eesphack| are also part of the
2589 % thmmarks option. Change both if you change them.
2590 % \end{macro}
2591 %
2592 % \paragraph{Communication of theorem types for references.}
2593 %
2594 % The |thref| functionality needs to know the respective theorem type
2595 % of the referenced
2596 % labels. This is incorporated as additional arguments in |label| and
2597 % |newlabel/@newl@abel|. Note that if the |hyperref| package is used,
2598 % the handling is different (see Option |hyperref|).
2599 %
2600 % \begin{macro}{\label}
2601 % \changes{v1.1}{1998/08/30}{added optional argument to 'label'. (WM)}
2602 % \changes{v1.18}{1999/12/25}{Adapted for complex keywords (WM)}
2603 % The original |\label| macro is extended (cf.\ ltxref.dtx) with an
2604 % optional argument, containing the type of the labeled construct.
2605 % (when option |hyperref| is used, )
2606 % \Codelabel{label}
2607 % \begin{macrocode}
2608 \def\label#1{%
2609 \@ifnextchar[%]
2610 {\label@optarg{#1}}%
2611 {\thm@makelabel{#1}}}
2612 %
2613 \def\thm@makelabel#1{%
2614 \@bbsphack
2615 \edef\thm@tmp{\expandafter\expandafter\expandafter\thm@meaning
2616 \expandafter\meaning\csname\InTheoType Keyword\endcsname\relax}%
2617 \protected@write\@auxout{}%
2618 {\string\newlabel{#1}{{\@currentlabel}{\thepage}}[\thm@tmp]}%
2619 \@eesphack}
2620 %
2621 \def\label@optarg#1[#2]{%
2622 \@bsphack
2623 \protected@write\@auxout{}%
2624 {\string\newlabel{#1}{{\@currentlabel}{\thepage}}[#2]}%
2625 \@esphack}
2626 % \end{macrocode}
2627 %
2628 % \begin{packeddescr}
2629 % \item[|thm@makelabel|:]
2630 % If no optional argument is given, the keyword of the current
2631 % environment type is used instead.
2632 % \item[|label@optarg|:]
2633 % The original definition, extended with the optional argument
2634 % which is appended to the |\newlabel|-command to be written
2635 % to the .aux-file.
2636 % \end{packeddescr}
2637 % \end{macro}
2638 %
2639 % \begin{macro}{\newlabel}
2640 % \changes{v1.1}{1998/08/30}{added modified macro '@newl@bel'. (WM)}
2641 % The original behavior of |\newlabel| (called when evaluating
2642 % the .aux-file) is also adapted. \\
2643 % Original syntax:
2644 % |\newlabel{|\meta{label}|}{{|\meta{section}|}{|\meta{page}|}}|\\
2645 % Modified syntax:
2646 % |\newlabel{|\meta{label}|}|%
2647 % |{{|\meta{section}|}{|\meta{page}|}}[|\meta{type}|]|\\
2648 % Definition of |\newlabel|: |\def\newlabel{\@newl@bel r}|. \\
2649 % Therefore, the modification is encoded into the |\@newl@bel| macro:
2650 %
2651 % \Codelabel{newlabel}
2652 % \changes{v1.18}{1999/12/26}{adapted to babel-3.6 (WM)}
2653 % \begin{macrocode}
2654 \def\@newl@bel#1#2#3{%
2655 \@ifpackageloaded{babel}{\@safe@activestrue}\relax%
2656 \@ifundefined{#1@#2}%
2657 \relax
2658 {\gdef \@multiplelabels {%
2659 \@latex@warning@no@line{There were multiply-defined labels}}%
2660 \@latex@warning@no@line{Label `#2' multiply defined}}%
2661 \global\@namedef{#1@#2}{#3}%
2662 \@ifnextchar[{\set@label@type{#1}{#2}}%]
2663 \relax}%
2664 \def\set@label@type#1#2[#3]{%
2665 \global\@namedef{#1@#2@type}{#3}}
2666 % \end{macrocode}
2667 %
2668 % the macro is called with three arguments (same as originally):\\
2669 % |#1|=|r|, \\
2670 % \meta{labelname} := |#2| is the label name,\\
2671 % |#3| is a pair (section, page-number) consisting of the values
2672 % needed for |\ref| and |\pageref|, respectively.
2673 %
2674 % \begin{packeddescr}
2675 % \item[Line \Coderef{newlabel}{2}:] adaptation to babel
2676 % \item[Lines \Coderef{newlabel}{3}--\Coderef{newlabel}{8}:]
2677 % The original definition (both standard \LaTeX\ and babel).
2678 % \item[Line \Coderef{newlabel}{9}:] if an optional argument
2679 % follows (containing the environment-type), continue with
2680 % |\set@label@type|, otherwise return (the original behavior).
2681 % \item[Lines \Coderef{newlabel}{11}, \Coderef{newlabel}{12}:]
2682 % set |\r@|\meta{labelname}|@type| to the type of the
2683 % respective environment.
2684 % \end{packeddescr}
2685 % \end{macro}
2686
2687
2688 % \begin{macro}{\thref}
2689 % \changes{v1.1}{1998/08/30}{added macro 'thref'. (WM)}
2690 % \changes{v1.13}{1998/12/01}{made 'thref' an option. (WM)}
2691 %
2692 % |\thref| is an adaptation of |\ref|:
2693 % \Codelabel{thref}
2694 % \begin{macrocode}
2695 \def\thref#1{%
2696 \expandafter\ifx\csname r@#1@type\endcsname\None
2697 \PackageWarning{\basename}{thref: Reference Type of `#1' on page
2698 \thepage \space undefined}\G@refundefinedtrue
2699 \else\csname r@#1@type\endcsname~\fi
2700 \expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
2701 % \end{macrocode}
2702 %
2703 % \begin{packeddescr}
2704 % \item[Lines \Coderef{thref}{1}, \Coderef{thref}{6}:]
2705 % similar to |\ref|.
2706 % \item[Line \Coderef{newlabel}{2}:] if a legal theorem type
2707 % is given, then output
2708 % |\r@|\meta{labelname}|@type| and avoid linebreaking
2709 % between the type and the number.
2710 % \end{packeddescr}
2711 % \end{macro}
2712
2713 % \begin{macro}{\testdef}
2714 % \changes{v1.19}{2001/01/12}{added (HO/WM, reported by Hans-Christoph Wirth)}
2715 % \changes{v1.31}{2011/02/08}{changed '@gobbleopt' into 'thm@gobbleopt' after
2716 % nameclash with hyperref (AS/WM)}
2717 % A problem occurred, when about 250 labels to theorem-like
2718 % environments have been defined: after the end of a document,
2719 % the .aux file is read once more (to check if references changed).
2720 % Here, \LaTeX\ redefines |\@newl@bel| into |\@testdef| -- and
2721 % \LaTeX\ does not know that ntheorem's |\label| has an additional
2722 % optional argument. Thus, the argument values are not processed,
2723 % but are output as normal text. Normally, this did not matter
2724 % since output has already been finished by a |\clearpage| in
2725 % |\end{document}|. For so many labels, a page gets filled
2726 % and the output routine is called.
2727 %
2728 % \Codelabel{testdef}
2729 % \begin{macrocode}
2730 \newcommand\org@testdef{}
2731 \let\org@testdef\@testdef
2732 \def\@testdef#1#2#3{%
2733 \org@testdef{#1}{#2}{#3}%
2734 \@ifnextchar[{\thm@gobbleopt}{}%
2735 }
2736 \newcommand\thm@gobbleopt{}
2737 \long\def\thm@gobbleopt[#1]{}
2738 % \end{macrocode}
2739 % \begin{packeddescr}
2740 % \item[Line \Coderef{testdef}{4}:]
2741 % process the optional argument.
2742 % \end{packeddescr}
2743 % \end{macro}
2744 %
2745 % \begin{macrocode}
2746 }% end of option thref ************************************************
2747 % \end{macrocode}
2748 %
2749 % \subsubsection{Option amsmath to Thmmarks}
2750 % Most of the commands are extensions of commands in |amsmath.sty|.
2751 %
2752 % \begin{macrocode}
2753 \DeclareOption{amsmath}{% ***************************************************
2754 \if@thref
2755 \PackageInfo{\basename}{option `amsmath' handling for `thref' loaded}%
2756 % \end{macrocode}
2757 %
2758 % if |thref| is active, the handling of labels in amsmath equations has also
2759 % to be adapted.
2760 %
2761 % \begin{macro}{ams-thref}
2762 % \changes{v1.19}{2001/01/12}{added handling of thref in ams-equations
2763 % (reported by Lars Relund).}
2764 % \begin{macrocode}
2765 \let\ltx@label\label
2766 % \end{macrocode}
2767 % keep the handling of |\label| ... (the one defined above in the thref option).
2768 %
2769 % amsmath implements a special handling of |\label| inside of displaymath
2770 % environments. It is extended to process the optional argument provided
2771 % be the thref option:
2772 %
2773 % \begin{macrocode}
2774 \global\let\thm@df@label@optarg\@empty
2775 \def\label@in@display#1{%
2776 \ifx\df@label\@empty\else
2777 \@amsmath@err{Multiple \string\label's:
2778 label '\df@label' will be lost}\@eha
2779 \fi
2780 \gdef\df@label{#1}%
2781 \@ifnextchar[{\thm@label@in@display@optarg}{\thm@label@in@display@noarg}%]
2782 }
2783 \def\thm@label@in@display@noarg{%
2784 \global\let\thm@df@label@optarg\@empty
2785 }
2786 \def\thm@label@in@display@optarg[#1]{%
2787 \gdef\thm@df@label@optarg{#1}%
2788 }
2789 % \end{macrocode}
2790 % \changes{v1.22}{2003/06/25}{fixed thm@df@label@optarg (WM, reported by
2791 % Marija Kulas)}
2792 %
2793 % The contents of |\df@label| is handled when the equation is finished.
2794 % (Currently) this happens in three macros. The modification consists
2795 % of the check if |\thm@df@label@optarg| is non-empty (i.e., holds the
2796 % optional argument), and to handle it.
2797 %
2798 % \begin{macrocode}
2799 \def\endmathdisplay@a{%
2800 \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi
2801 \if@fleqn \@xp\endmathdisplay@fleqn
2802 \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi
2803 \ifx\df@label\@empty \else
2804 \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
2805 \else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
2806 \fi
2807 \fi
2808 \ifnum\dspbrk@lvl>\m@ne
2809 \postdisplaypenalty -\@getpen\dspbrk@lvl
2810 \global\dspbrk@lvl\m@ne
2811 \fi
2812 }
2813 \def\make@display@tag{%
2814 \if@eqnsw
2815 \refstepcounter{equation}%
2816 \tagform@\theequation
2817 \else
2818 \iftag@
2819 \df@tag
2820 \global\let\df@tag\@empty
2821 \fi
2822 \fi
2823 \ifmeasuring@
2824 \else
2825 \ifx\df@label\@empty\else
2826 \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
2827 \else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
2828 \global\let\df@label\@empty
2829 \fi
2830 \fi
2831 }
2832 \def\endmathdisplay@fleqn{%
2833 $\hfil\hskip\@mathmargin\egroup
2834 \ifnum\badness<\inf@bad \let\too@wide\@ne \else \let\too@wide\z@ \fi
2835 \ifx\@empty\df@tag
2836 \else
2837 \setbox4\hbox{\df@tag
2838 \ifx\thm@df@label@optarg\@empty \@xp\ltx@label\@xp{\df@label}%
2839 \else \@xp\ltx@label\@xp{\df@label}[\thm@df@label@optarg]\fi
2840 }%
2841 \fi
2842 \csname emdf@%
2843 \ifx\df@tag\@empty U\else \iftagsleft@ L\else R\fi\fi
2844 \endcsname
2845 }
2846 % \end{macrocode}
2847 % \changes{v1.29}{2010/06/24}{fixed endmathdisplay@fleqn, make@display@tag,
2848 % endmathdisplay@fleqn (WM, reported by Claas Hemig)}
2849 % \end{macro}
2850 % \begin{macrocode}
2851 \fi
2852 % end of if-thref in option amsmath ******************************************
2853 \if@thmmarks
2854 \PackageInfo{\basename}{option `amsmath' handling for `thmmarks' loaded}%
2855 \newdimen\thm@amstmpdepth
2856 % \end{macrocode}
2857 % A temporarily used register.
2858 %
2859 % \begin{macro}{\TagsPlusEndmarks}
2860 % \changes{v1.03}{1997/07/15}{Fixed 'TagsPlusEndMarks', introduced
2861 % 'SetOnlyEndMark' and 'SetTagPlusEndMark' (WM)}
2862 % Since |amsmath| uses ``tags'' for setting end marks,
2863 % some macros are defined which prepare tags which include endmarks:
2864 % \Codelabel{EndTags}
2865 % \begin{macrocode}
2866 \gdef\TagsPlusEndmarks{%
2867 \global\let\Old@maketag@@@=\maketag@@@
2868 \global\let\Old@df@tag=\df@tag
2869 \if@eqnsw\SetTagPlusEndMark
2870 \else
2871 \iftag@\SetTagPlusEndMark
2872 \else\SetOnlyEndMark
2873 \fi
2874 \fi}
2875 % \end{macrocode}
2876 % \begin{packeddescr}
2877 % \item[Lines \Coderef{EndTags}{2}, \Coderef{EndTags}{3}:]
2878 % store the original macros.
2879 % \item[Line \Coderef{EndTags}{4}:]
2880 % if equation numbers are set as default, call
2881 % |\SetTagPlusEndMark| to set tag and end mark.
2882 % \item[Lines \Coderef{EndTags}{5}, \Coderef{EndTags}{6}:]
2883 % if a tag is set manually, call
2884 % |\SetTagPlusEndMark| to set tag and end mark.
2885 % \item[Line \Coderef{EndTags}{7}:]
2886 % otherwise, call |\SetOnlyEndMark| to set only an end mark.
2887 % \end{packeddescr}
2888 % \end{macro}
2889 %
2890 % \begin{macro}{\SetOnlyEndMark}
2891 % \changes{v1.32}{2011/24/02}{added second argument to call of
2892 % PotEndMark in else case (WM, reported by Rolf Theunissen)}
2893 % \Codelabel{OnlyEnd}
2894 % \begin{macrocode}
2895 \gdef\SetOnlyEndMark{%
2896 \global\tag@true
2897 \iftagsleft@
2898 \gdef\df@tag{\hbox
2899 to \displaywidth{\hss\PotEndMark{\maketag@@@}}}%
2900 \else
2901 \gdef\df@tag{\PotEndMark{\maketag@@@}[\ifhmode\else\hbox to .1pt{}\fi]}%
2902 \fi}
2903 % \end{macrocode}
2904 % Set only an end mark:
2905 %
2906 % \begin{packeddescr}
2907 % \item[Line \Coderef{OnlyEnd}{2}:]
2908 % force setting the end mark as a tag:
2909 % \item[Lines \Coderef{OnlyEnd}{4}, \Coderef{OnlyEnd}{5}:]
2910 % if tags are set to the left, the tag consists of a
2911 % |\hbox| over the whole displaywidth, with the (potential) endmark
2912 % at its right.
2913 % \item[Line \Coderef{OnlyEnd}{7}:]
2914 % if tags are set to the right, the tag consists only of the
2915 % (potential) endmark. If no endmark is set and \TeX\ is not in hmode,
2916 % an empty hbox is output (otherwise |\abovedisplayskip| will be
2917 % ignored in |equation*|; this is executed in |endmathdisplay@a| when
2918 % it comes to |\veqno\alt@tag\df@tag|).
2919 % \end{packeddescr}
2920 % \end{macro}
2921 %
2922 % \begin{macro}{\SetTagPlusEndMark}
2923 % \Codelabel{TagPlus}
2924 % \changes{v1.26}{2007/10/17}{fixed: box to tagwidth (problem with leqno; WM)}
2925 % \begin{macrocode}
2926 \newdimen{\tagwidth}
2927 \gdef\SetTagPlusEndMark{%
2928 \iftagsleft@
2929 \gdef\maketag@@@##1{%
2930 \settowidth{\tagwidth}{$##1$}%% %% WM 17.10.2007
2931 \hbox to \tagwidth{%
2932 \hbox to \displaywidth{\m@th\normalfont##1%
2933 \hss\PotEndMark{\hss}}\hss}}%
2934 \else
2935 \gdef\maketag@@@##1{\hbox{\m@th\normalfont##1%
2936 \llap{\hss\PotEndMark{\raisebox{-1.3em}}}}}%
2937 \fi}
2938 % \end{macrocode}
2939 %
2940 % Set a tag \emph{and} an end mark:
2941 % \begin{packeddescr}
2942 % \item[Lines \Coderef{TagPlus}{2}--\Coderef{TagPlus}{11}:]
2943 % redefine the |\maketag@@@| macro:
2944 % \item[Lines \Coderef{TagPlus}{3}--\Coderef{TagPlus}{7}:]
2945 % if tags are set to the left, build a box of the whole
2946 % displaywidth and put the original tag on the left, and the (potential)
2947 % endmark at the right. Put this box with width 0 and continue.
2948 % \item[Lines \Coderef{TagPlus}{8}, \Coderef{TagPlus}{9}:]
2949 % if the tags are set to the right, the (potential) end
2950 % mark is put below it.
2951 % \end{packeddescr}
2952 % \changes{v1.20}{2001/12/29}{added hss if tags left (GD/WM)}
2953 % \end{macro}
2954 %
2955 % \begin{macro}{\tagform@}
2956 % \begin{packeddescr}
2957 % \item |\maketag@@@| is also used via |\tagform@| in |\eqref| that may be
2958 % called inside an environment. There, the original functionality must
2959 % be used. The (small) commands |\th@ams@tagopen{(}| and
2960 % |\th@ams@tagopen{(}| are provided as a hook for the |empheq| package.
2961 % \end{packeddescr}
2962 % \changes{v1.30}{2010/08/16}{added (WM), bug reported by Martin Schulze}
2963 % \changes{v1.32}{2011/03/10}{revised (WM), bug reported by Lars Madsen}
2964 % \begin{macrocode}
2965 \let\th@ams@@maketag@@@\maketag@@@
2966 \gdef\th@ams@tagopen{(}
2967 \gdef\th@ams@tagclose{)}
2968 \gdef\th@ams@tagform@#1{%
2969 \th@ams@@maketag@@@{\th@ams@tagopen\ignorespaces#1%
2970 \unskip\@@italiccorr\th@ams@tagclose}}
2971 \gdef\eqref#1{\textup{\th@ams@tagform@{\ref{#1}}}}
2972 % \end{macrocode}
2973 % \end{macro}
2974 %
2975 % \begin{macro}{\RestoreTags}
2976 % \Codelabel{RestoreTags}
2977 % \begin{macrocode}
2978 \gdef\RestoreTags{%
2979 \global\let\maketag@@@=\Old@maketag@@@
2980 \global\let\df@tag=\Old@df@tag}
2981 % \end{macrocode}
2982 %
2983 % \begin{packeddescr}
2984 % \item[Lines \Coderef{RestoreTags}{2}, \Coderef{RestoreTags}{3}:]
2985 % restore the original macros.
2986 % \end{packeddescr}\end{macro}
2987 %
2988 % \begin{macro}{\endgather}
2989 % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (GD/WM)}
2990 % In the |gather| environment, just the augmented tag is used:
2991 % \Codelabel{endgather}
2992 % \begin{macrocode}
2993 \gdef\endgather{%
2994 \TagsPlusEndmarks % <<<<<<<<<
2995 \math@cr
2996 \black@\totwidth@
2997 \egroup
2998 $$%
2999 \RestoreTags % <<<<<<<<<
3000 \ignorespacesafterend}
3001 %
3002 \expandafter\let\csname endgather*\endcsname\endgather
3003 % \end{macrocode}
3004 %
3005 % New:
3006 % \begin{packeddescr}
3007 % \item[Line \Coderef{endgather}{2}:]
3008 % the last tag contains the potential endmark.
3009 % \item[Line \Coderef{endgather}{7}:]
3010 % restore the original macros.
3011 % \item[Line \Coderef{endgather}{10}:]
3012 % Since |let| always takes the expansion of a macro when the
3013 % let is executed, all let's have to be adjusted (this is the same
3014 % for all subsequent let-statements).
3015 % \end{packeddescr}\end{macro}
3016 %
3017 % \begin{macro}{\math@cr@@@align}
3018 % \changes{v1.12}{1998/11/15}{dropped redefinition of 'math@cr@@@align' (WM,
3019 % reported by Frank-Christian Otto)}
3020 % \end{macro}
3021 %
3022 % \begin{macro}{\endalign}
3023 % |\endalign| also uses the augmented tags:
3024 % \Codelabel{endalign}
3025 % \begin{macrocode}
3026 \def\endalign{%
3027 \ifingather@\else % <<<<<<<<<
3028 \TagsPlusEndmarks\fi % <<<<<<<<<
3029 \math@cr
3030 \black@\totwidth@
3031 \egroup
3032 \ifingather@
3033 \restorealignstate@
3034 \egroup
3035 \nonumber
3036 \ifnum0=`{\fi\iffalse}\fi
3037 \else
3038 $$%
3039 \RestoreTags % <<<<<<<<<
3040 \fi
3041 \ignorespacesafterend}
3042 % \end{macrocode}
3043 %
3044 % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (GD/WM)}
3045 % New:
3046 % \begin{packeddescr}
3047 % \item[Lines \Coderef{endalign}{2}, \Coderef{endalign}{3}:]
3048 % if the |align| is not inside another environment,
3049 % its tags have to contain the endmarks.
3050 % \item[Line \Coderef{endalign}{14}:]
3051 % this case, the original macros have to be restored.
3052 % \end{packeddescr}\end{macro}
3053 %
3054 % \begin{macrocode}
3055 \expandafter\let\csname endalign*\endcsname\endalign
3056 \let\endxalignat\endalign
3057 \expandafter\let\csname endxalignat*\endcsname\endalign
3058 \let\endxxalignat\endalign
3059 \let\endalignat\endalign
3060 \expandafter\let\csname endalignat*\endcsname\endalign
3061 \let\endflalign\endalign
3062 \expandafter\let\csname endflalign*\endcsname\endalign
3063 % \end{macrocode}
3064 %
3065 % Adjust let-statements.
3066 %
3067 % \begin{macro}{\lendmultline}
3068 % The |multline| environment has two different |\end| commands,
3069 % depending if the equation numbers are set on the left or on the right:
3070 % \Codelabel{lendmultline}
3071 % \begin{macrocode}
3072 \def\lendmultline@{%
3073 \global\@eqnswfalse\tag@false\tagsleft@false
3074 \rendmultline@}
3075 % \end{macrocode}
3076 %
3077 % End of |multline| environment if tags are set to the left:
3078 % in this case, the last line of a |multline| does not contain a tag.
3079 % Thus the situation of setting an endmark tag at the right is faked:
3080 % \begin{packeddescr}
3081 % \item[Lines \Coderef{lendmultline}{2}, \Coderef{lendmultline}{3}:]
3082 % display no equation number, don't set an equation tag
3083 % (but use the tag mechanism for the end mark - see |\TagsPlusEndmarks|
3084 % and |\SetOnlyEndMark|), set it at the right,
3085 % and call |\rendmultline|.
3086 % \end{packeddescr}
3087 % \changes{v1.20}{2001/12/29}{debugged (GD/WM)}
3088 % \end{macro}
3089 %
3090 % \begin{macro}{\rendmultline}
3091 % |\rendmultline| also uses the augmented tags:
3092 % \Codelabel{rendmultline}
3093 % \begin{macrocode}
3094 \def\rendmultline@{%
3095 \TagsPlusEndmarks % <<<<<<<<<
3096 \iftag@
3097 $\let\endmultline@math\relax
3098 \ifshifttag@
3099 \hskip\multlinegap
3100 \llap{\vtop{%
3101 \raise@tag
3102 \normalbaselines
3103 \setbox\@ne\null
3104 \dp\@ne\lineht@
3105 \box\@ne
3106 \hbox{\strut@\make@display@tag}%
3107 }}%
3108 \else
3109 \hskip\multlinetaggap
3110 \make@display@tag
3111 \fi
3112 \else
3113 \hskip\multlinegap
3114 \fi
3115 \hfilneg
3116 \math@cr
3117 \egroup$$%
3118 \RestoreTags} % <<<<<<<<<
3119 % \end{macrocode}
3120 %
3121 % New: \\
3122 % Line \Coderef{rendmultline}{2}:
3123 % last tag contains the potential endmark. \\
3124 % Line \Coderef{rendmultline}{26}:
3125 % restore the original macros
3126 % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (GD/WM)}
3127 % \end{macro}
3128 %
3129 % \begin{macro}{\endmathdisplay}
3130 %
3131 % \Codelabel{ams-e-displ}
3132 % \begin{macrocode}
3133 \def\endmathdisplay#1{%
3134 \ifmmode \else \@badmath \fi
3135 \TagsPlusEndmarks % <<<<<<<<<
3136 \endmathdisplay@a
3137 $$%
3138 \RestoreTags % <<<<<<<<<
3139 \global\let\df@label\@empty \global\let\df@tag\@empty
3140 \global\tag@false \global\let\alt@tag\@empty
3141 \global\@eqnswfalse
3142 }
3143 % \end{macrocode}
3144 % \changes{v0.94}{1997/03/19}{end mark with raisebox (WM)}
3145 % \changes{v1.19}{2001/01/12}{completely new for amsmath-2.0, begin[ deleted (GD/WM)}
3146 % \end{macro}
3147 %
3148 % Added Line \Coderef{ams-e-displ}{4}: set potential end mark at
3149 % bottom niveau of displaymath.
3150 %
3151 % \begin{macro}{equation}
3152 % \changes{v1.19}{2001/01/12}{adapted to amsmath-2.0 (WM)}
3153 % \changes{v1.32}{2011/02/24}{adapted to amsmath-2.13 (WM)}
3154 % \begin{macrocode}
3155 \renewenvironment{equation}{%
3156 \incr@eqnum
3157 \mathdisplay@push
3158 \st@rredfalse \global\@eqnswtrue
3159 \mathdisplay{equation}%
3160 }{%
3161 \endmathdisplay{equation}%
3162 \mathdisplay@pop
3163 \ignorespacesafterend
3164 }
3165 \renewenvironment{equation*}{%
3166 \mathdisplay@push
3167 \st@rredtrue \global\@eqnswfalse
3168 \mathdisplay{equation*}%
3169 }{%
3170 \endmathdisplay{equation*}%
3171 \mathdisplay@pop
3172 \ignorespacesafterend
3173 }
3174 % \end{macrocode}
3175 % unchanged from |amsmath.sty|.
3176 % \end{macro}
3177 %
3178 % \begin{macrocode}
3179 \fi
3180 }% end of option amsmath/thmmarks **************************************
3181 % \end{macrocode}
3182 %
3183 %
3184 % \subsubsection{Theorem-Layout Stuff}
3185 %
3186 % \changes{v1.11}{1998/10/26}{added 'noconfig' option (AS/WM)}
3187 % \begin{macrocode}
3188 \let\thm@usestd\@undefined
3189 \DeclareOption{standard}{\let\thm@usestd\relax}
3190 \let\thm@noconfig\@undefined
3191 \DeclareOption{noconfig}{\let\thm@noconfig\relax}
3192 % \end{macrocode}
3193 %
3194 % Options for selection of a configuration: if no such option is given
3195 % |ntheorem.cfg| will be loaded (which has to be provided by the
3196 % user), |[standard]| will load |ntheorem.std|, a predefined setting,
3197 % and |[noconfig]| does not preload any configuration.
3198 %
3199 % \begin{macrocode}
3200 \gdef\InTheoType{None}
3201 \gdef\NoneKeyword{None}
3202 \gdef\NoneSymbol{None}
3203 \gdef\None{None}
3204 % \end{macrocode}
3205 %
3206 % Set |\InTheoType| to |none| on the upper document level.
3207 %
3208 % \begin{macro}{\newtheoremstyle}
3209 % \changes{v0.93}{1997/03/12}{'newtheoremstyle' only if not yet defined (WM)}
3210 % With |\newtheoremstyle|, new theorem-layout styles are defined.
3211 % \Codelabel{newthmstyle}
3212 % \begin{macrocode}
3213 \gdef\newtheoremstyle#1#2#3{%
3214 \expandafter\@ifundefined{th@#1}%
3215 {\expandafter\gdef\csname th@#1\endcsname{%
3216 \def\@begintheorem####1####2{#2}%
3217 \def\@opargbegintheorem####1####2####3{#3}}}%
3218 {\PackageError{\basename}{Theorem style #1 already defined}\@eha}}
3219 % \end{macrocode}
3220 %
3221 % Arguments: \\
3222 % \meta{style}:=|#1|: the name of the theoremstyle to be defined, \\
3223 % \meta{cmd\_seq1}:=|#2|: command sequence for setting the header
3224 % for environment instances with no optional text, \\
3225 % \meta{cmd\_seq2}:=|#3|: command sequence for setting the header
3226 % for environment instances with optional text. \\
3227 % Line \Coderef{newthmstyle}{2}: if this style is not yet defined, define
3228 % it. \\
3229 % Line \Coderef{newthmstyle}{3}:
3230 % define |\th@|\meta{style} to be a macro which defines \\
3231 % Line \Coderef{newthmstyle}{4}:
3232 % a) the two-argument macro |\@begintheorem#1#2| to be \meta{cmd\_seq1}, \\
3233 % Line \Coderef{newthmstyle}{5}:
3234 % b) |\@opargbegintheorem#1#2#3| to be \meta{cmd\_seq2}.
3235 % \end{macro}
3236 %
3237 % The predefined theorem styles use this command.%
3238 %
3239 % \begin{macro}{\renewtheoremstyle}
3240 % \changes{v0.93}{1997/03/12}{introduced 'renewtheoremstyle' (WM)}
3241 % \Codelabel{renewthmstyle}
3242 % \begin{macrocode}
3243 \gdef\renewtheoremstyle#1#2#3{%
3244 \expandafter\@ifundefined{th@#1}%
3245 {\PackageError{\basename}{Theorem style #1 undefined}\@ehc}%
3246 {}%
3247 \expandafter\let\csname th@#1\endcsname\relax
3248 \newtheoremstyle{#1}{#2}{#3}}
3249 % \end{macrocode}
3250 % \end{macro}
3251 % Arguments: \\
3252 % \meta{style}:=|#1|: the name of the theoremstyle to be defined, \\
3253 % |#2|, |#3| as for |\newtheoremstyle|. \\
3254 % Checks, if theoremstyle \meta{style} is already defined. If so,
3255 % |\th@|\meta{style} is made undefined and |\newtheoremstyle| is called
3256 % with the same arguments.
3257 %
3258 % \paragraph{Predefined Theorem Styles}
3259 % \begin{macro}{theoremstyles}
3260 % |th@plain|, |th@change|, and |th@margin| taken from theorem.sty by
3261 % Frank Mittelbach; the break-styles have been changed.
3262 %
3263 % \changes{v1.03}{1997/07/15}{break styles changed (WM)}
3264 % \changes{v1.15}{1999/02/01}{fixed nonumberbreak (WM)}
3265 % \changes{v1.19}{2001/01/13}{break styles and empty style changed,
3266 % now it is analogous to theorem.sty (OK/WM)}
3267 % \begin{macrocode}
3268 \newtheoremstyle{plain}%
3269 {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
3270 {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)\theorem@separator]}
3271 %
3272 \newtheoremstyle{break}%
3273 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3274 ##1\ ##2\theorem@separator}\hbox{\strut}}}]}%
3275 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3276 ##1\ ##2\ (##3)\theorem@separator}\hbox{\strut}}}]}
3277 %
3278 \newtheoremstyle{change}%
3279 {\item[\hskip\labelsep \theorem@headerfont ##2\ ##1\theorem@separator]}%
3280 {\item[\hskip\labelsep \theorem@headerfont ##2\ ##1\ (##3)\theorem@separator]}
3281 %
3282 \newtheoremstyle{changebreak}%
3283 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3284 ##2\ ##1\theorem@separator}\hbox{\strut}}}]}%
3285 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3286 ##2\ ##1\ (##3)\theorem@separator}\hbox{\strut}}}]}
3287 %
3288 \newtheoremstyle{margin}%
3289 {\item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\theorem@separator]}%
3290 {\item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\ (##3)\theorem@separator]}
3291 %
3292 \newtheoremstyle{marginbreak}%
3293 {\item[\rlap{\vbox{\hbox{\theorem@headerfont
3294 \llap{##2}\hskip\labelsep\relax ##1\theorem@separator}\hbox{\strut}}}]}
3295 {\item[\rlap{\vbox{\hbox{\theorem@headerfont
3296 \llap{##2}\hskip\labelsep\relax ##1\
3297 (##3)\theorem@separator}\hbox{\strut}}}]}
3298 %
3299 \newtheoremstyle{nonumberplain}%
3300 {\item[\theorem@headerfont\hskip\labelsep ##1\theorem@separator]}%
3301 {\item[\theorem@headerfont\hskip \labelsep ##1\ (##3)\theorem@separator]}
3302 %
3303 \newtheoremstyle{nonumberbreak}%
3304 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3305 ##1\theorem@separator}\hbox{\strut}}}]}%
3306 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
3307 ##1\ (##3)\theorem@separator}\hbox{\strut}}}]}
3308 %
3309 \newtheoremstyle{empty}%
3310 {\item[]}%
3311 {\item[\theorem@headerfont \hskip\labelsep\relax ##3]}
3312 \newtheoremstyle{emptybreak}%
3313 {\item[]}%
3314 {\item[\rlap{\vbox{\hbox{\hskip\labelsep\relax \theorem@headerfont
3315 ##3\theorem@separator}\hbox{\strut}}}]}
3316 %
3317 \@namedef{th@nonumbermargin}{\th@nonumberplain}
3318 \@namedef{th@nonumberchange}{\th@nonumberplain}
3319 \@namedef{th@nonumbermarginbreak}{\th@nonumberbreak}
3320 \@namedef{th@nonumberchangebreak}{\th@nonumberbreak}
3321 \@namedef{th@plainNo}{\th@nonumberplain}
3322 \@namedef{th@breakNo}{\th@nonumberplain}
3323 \@namedef{th@marginNo}{\th@nonumberplain}
3324 \@namedef{th@changeNo}{\th@nonumberplain}
3325 \@namedef{th@marginbreakNo}{\th@nonumberbreak}
3326 \@namedef{th@changebreakNo}{\th@nonumberbreak}
3327 % \end{macrocode}
3328 % \changes{v0.81}{1997/02/12}{`theoremnumbering' and styles ...No added
3329 % (WM)}
3330 % \changes{v1.04}{1998/05/26}{theoremstyle empty added (WM)}
3331 %\end{macro}
3332 %
3333 % For instance, |break| is commented:
3334 %
3335 % |\newtheoremstyle{break}| results in
3336 % \begin{quote}
3337 % |\gdef\th@break{%| \\
3338 % | \def\@begintheorem##1##2{%| \\
3339 % | \item[\hskip\labelsep \theorem@headerfont| \\
3340 % | ##1\ ##2\theorem@separator]%| \\
3341 % | \hfill\penalty-8000}%| \\
3342 % | \def\@opargbegintheorem##1##2##3{%| \\
3343 % | \item[\hskip\labelsep \theorem@headerfont| \\
3344 % | ##1\ ##2\ (##3)\theorem@separator]%| \\
3345 % | \hfill\penalty-8000}}|
3346 % \end{quote}
3347 %
3348 % Then, calling |\th@break| sets |\@begintheorem| as follows: \\
3349 % Since each theorem environment is basically a trivlist,
3350 % the header is set as the item contents: |\theorem@headerfont|
3351 % holds the font commands for the header font, |##1| is the
3352 % keyword to be displayed, and |##2| its environment number.
3353 % The linebreak after the header is achieved by offering to fill the
3354 % line with space and the distinct wish to put a linebreak after it.
3355 % Thus, if plain text follows, the line break is executed, but if
3356 % a list or a display follows, it is not executed.
3357 %
3358 % Note: The |\hfill\penalty-8000| causes \TeX\ to leave vertical mode,
3359 % setting the item contents (ie the header) and entering horizontal mode
3360 % to perform the |\hfill|.
3361 %
3362 % \begin{macro}{\theoremstyle}
3363 % The handling of |\theoremstyle|, |\theorembodyfont|, and
3364 % |\theoremskipamounts| is taken from theorem.sty by Frank Mittelbach:
3365 % \changes{v0.80}{1997/02/11}{`theoremseparator' added (WM)}
3366 % \changes{v1.20}{2002/12/30}{`theoremprework' and `theorempostwork'
3367 % added (WM)}
3368 % \begin{macrocode}
3369 \gdef\theoremstyle#1{%
3370 \@ifundefined{th@#1}{\@warning
3371 {Unknown theoremstyle `#1'. Using `plain'}%
3372 \theorem@style{plain}}%
3373 {\theorem@style{#1}}}
3374 \newtoks\theorem@style
3375 \newtoks\theorem@@style
3376 \global\theorem@style{plain}
3377 % \end{macrocode}\end{macro}
3378 %
3379 % If |\theoremstyle| is called, it is checked if the argument
3380 % is a valid |theoremstyle|, and if so, it is stored in the token
3381 % |\theorem@style|. It is initialized to |plain|.
3382 %
3383 % \begin{macro}{\theorembodyfont}
3384 % \begin{macrocode}
3385 \newtoks\theorembodyfont
3386 \global\theorembodyfont{\itshape}
3387 % \end{macrocode}\end{macro}
3388 %
3389 % \begin{macro}{\theoremnumbering}
3390 % \begin{macrocode}
3391 \newtoks\theoremnumbering
3392 \global\theoremnumbering{arabic}
3393 % \end{macrocode}\end{macro}
3394 %
3395 % \begin{macro}{theoremskips}
3396 % \changes{v0.94}{1997/03/20}{'theorem...skip' fixed (WM)}
3397 % \changes{v1.32}{2011/02/28}{implemented new skip scheme (WM)}
3398 % \begin{macrocode}
3399 \newskip\theorempreskipamount
3400 \newskip\theorempostskipamount
3401 \newskip\theoremframepreskipamount
3402 \newskip\theoremframepostskipamount
3403 \newskip\theoreminframepreskipamount
3404 \newskip\theoreminframepostskipamount
3405 \global\theorempreskipamount\topsep
3406 \global\theorempostskipamount\topsep
3407 \global\theoremframepreskipamount\topsep
3408 \global\theoremframepostskipamount\topsep
3409 \global\theoreminframepreskipamount\topsep
3410 \global\theoreminframepostskipamount\topsep
3411 % \end{macrocode}
3412 % \changes{v1.32}{2011/02/28}{implemented new skip scheme (WM)}
3413 % \Codelabel{thmskips}
3414 % \begin{macrocode}
3415 \newif\ifuse@newframeskips\global\use@newframeskipsfalse
3416 \newtoks\theorem@preskip
3417 \global\theorem@preskip{\topsep}
3418 \def\theorempreskip#1{%
3419 \theorem@preskip{#1}\global\use@newframeskipstrue}
3420 \newtoks\theorem@postskip
3421 \global\theorem@postskip{\topsep}
3422 \def\theorempostskip#1{%
3423 \theorem@postskip{#1}\global\use@newframeskipstrue}
3424 \newtoks\theorem@framepreskip
3425 \global\theorem@framepreskip{\topsep}
3426 \def\theoremframepreskip#1{%
3427 \theorem@framepreskip{#1}\global\use@newframeskipstrue}
3428 \newtoks\theorem@framepostskip
3429 \global\theorem@framepostskip{\topsep}
3430 \def\theoremframepostskip#1{%
3431 \theorem@framepostskip{#1}\global\use@newframeskipstrue}
3432 \newtoks\theorem@inframepreskip
3433 \global\theorem@inframepreskip{\topsep}
3434 \def\theoreminframepreskip#1{%
3435 \theorem@inframepreskip{#1}\global\use@newframeskipstrue}
3436 \newtoks\theorem@inframepostskip
3437 \global\theorem@inframepostskip{\topsep}
3438 \def\theoreminframepostskip#1{%
3439 \theorem@inframepostskip{#1}\global\use@newframeskipstrue}
3440 % \end{macrocode}
3441 % \end{macro}
3442 % \begin{packeddescr}
3443 % \item[Line \Coderef{thmskips}{1}:]
3444 % switch whether new skip scheme is used (default for compatibility,
3445 % with old versions: no)
3446 % \item[Line \Coderef{thmskips}{2}, \Coderef{thmskips}{3}:]
3447 % define and initialize internal token (not a skip, just a token),
3448 % \item[Line \Coderef{thmskips}{4}, \Coderef{thmskips}{5}:]
3449 % define command to assign argument to token, and activate use
3450 % of new skip scheme,
3451 % \item[Line \Coderef{thmskips}{6}--\Coderef{thmskips}{25}:]
3452 % analogously for the other skips.
3453 % \end{packeddescr}
3454
3455 % The new theoremskip scheme is automatically activated if one
3456 % of the above commands is invoked (for that, they are not directly
3457 % implemented as |\newtoks|, but as complex commands).
3458 %
3459 % \begin{macro}{\theoremindent}
3460 % \begin{macrocode}
3461 \newdimen\theoremindent
3462 \global\theoremindent0cm
3463 \newdimen\theorem@indent
3464 \newdimen\theoremrightindent
3465 \global\theoremrightindent0cm
3466 \newdimen\theorem@rightindent
3467 % \end{macrocode}\end{macro}
3468 %
3469 % \begin{macro}{\theoremheaderfont}
3470 % \begin{macrocode}
3471 \newtoks\theoremheaderfont
3472 \global\theoremheaderfont{\normalfont\bfseries}
3473 \def\theorem@headerfont{\normalfont\bfseries}
3474 % \end{macrocode}\end{macro}
3475 %
3476 % \begin{macro}{\theoremseparator}
3477 % \begin{macrocode}
3478 \newtoks\theoremseparator
3479 \global\theoremseparator{}
3480 \def\theorem@separator{}
3481 % \end{macrocode}\end{macro}
3482 %
3483 % \begin{macro}{\theoremprework}
3484 % \begin{macro}{\theorempostwork}
3485 % \begin{macrocode}
3486 \newtoks\theoremprework
3487 \global\theoremprework{\relax}
3488 \newtoks\theorempostwork
3489 \global\theorempostwork{\relax}
3490 \def\theorem@prework{}
3491 % \end{macrocode}\end{macro}
3492 % \end{macro}
3493 %
3494 % \begin{macro}{\theoremsymbol}
3495 % \begin{macrocode}
3496 \newtoks\theoremsymbol
3497 \global\theoremsymbol{}
3498 % \end{macrocode}\end{macro}
3499 %
3500 % \begin{macro}{\qedsymbol}
3501 % \begin{macrocode}
3502 \newtoks\qedsymbol
3503 \global\qedsymbol{}
3504 % \end{macrocode}\end{macro}
3505 %
3506 % \begin{macro}{\theoremkeyword}
3507 % \begin{macrocode}
3508 \newtoks\theoremkeyword
3509 \global\theoremkeyword{None}
3510 % \end{macrocode}\end{macro}
3511 %
3512 % \begin{macro}{\theoremclass}
3513 % \changes{v1.16}{1999/08/07}{introduced 'theoremclass' and
3514 % defined 'th@class@LaTeX' (WM)}
3515 % \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)}
3516 % \begin{macrocode}
3517 \gdef\theoremclass#1{%
3518 \csname th@class@#1\endcsname}
3519 \gdef\th@class@LaTeX{%
3520 \theoremstyle{plain}%
3521 \theoremheaderfont{\normalfont\bfseries}%
3522 \theorembodyfont{\itshape}%
3523 \theoremseparator{}%
3524 \theoremprework{\relax}%
3525 \theorempostwork{\relax}%
3526 \ifuse@newframeskips
3527 \theorempreskip{0cm}%
3528 \theorempostskip{0cm}%
3529 \theoremframepreskip{0cm}%
3530 \theoremframepostskip{0cm}%
3531 \theoreminframepreskip{0cm}%
3532 \theoreminframepostskip{0cm}%
3533 \fi
3534 \theoremindent0cm
3535 \theoremrightindent0cm
3536 \theoremnumbering{arabic}%
3537 \theoremsymbol{}}
3538 % \end{macrocode}\end{macro}
3539 % Calling |\theoremclass{|\env|}| calls |\th@class@|\env\ (which is
3540 % defined in |\@newtheorem| in Lines
3541 % \Coderef{atnewthm}{31}--\Coderef{atnewthm}{45}).
3542 % |\th@class@|\env\ restores all style parameters to their values
3543 % given for \env.
3544 % Especially, |\th@class@LaTeX| restores the standard LaTeX parameters.
3545 %
3546 % \begin{macro}{\qedsymbol}
3547 % \begin{macrocode}
3548 \newtoks\qedsymbol
3549 \global\qedsymbol{}
3550 % \end{macrocode}\end{macro}
3551 %
3552 % \paragraph{Compatibility with amsthm.}
3553 %
3554 % \begin{macro}{amsthm}
3555 % \changes{v1.02}{1997/05/31}{proof-environment fixed (WM)}
3556 % \begin{macrocode}
3557 \DeclareOption{amsthm}{% *********************************************
3558 \PackageInfo{\basename}{Option `amsthm' loaded}%
3559 \def\swapnumbers{\PackageError{\basename}{swapnumbers not implemented.
3560 Use theoremstyle change instead.}\@eha}
3561
3562 \gdef\th@plain{%
3563 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
3564 \def\@begintheorem##1##2{%
3565 \item[\hskip\labelsep \theorem@headerfont ##1\ ##2.]}%
3566 \def\@opargbegintheorem##1##2##3{%
3567 \item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3).]}}
3568 \gdef\th@nonumberplain{%
3569 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
3570 \def\@begintheorem##1##2{%
3571 \item[\hskip\labelsep \theorem@headerfont ##1.]}%
3572 \def\@opargbegintheorem##1##2##3{%
3573 \item[\hskip\labelsep \theorem@headerfont ##1\ (##3).]}}
3574 \gdef\th@definition{%
3575 \th@plain\def\theorem@headerfont{\normalfont\bfseries}\normalfont}
3576 \gdef\th@nonumberdefinition{%
3577 \th@nonumberplain\def\theorem@headerfont{\normalfont\bfseries}\normalfont}
3578 \gdef\th@remark{%
3579 \th@plain\def\theorem@headerfont{\itshape}\normalfont}
3580 \gdef\th@nonumberremark{%
3581 \th@nonumberplain\def\theorem@headerfont{\itshape}\normalfont}
3582 %%% TODO skips initialisieren
3583 \newcounter{proof}%
3584 \if@thmmarks
3585 \newcounter{currproofctr}%
3586 \newcounter{endproofctr}%
3587 \fi
3588 \newcommand{\openbox}{\leavevmode
3589 \hbox to.77778em{%
3590 \hfil\vrule
3591 \vbox to.675em{\hrule width.6em\vfil\hrule}%
3592 \vrule\hfil}}
3593 \gdef\proofSymbol{\openbox}
3594 \newcommand{\proofname}{Proof}
3595 \newenvironment{proof}[1][\proofname]{
3596 \th@nonumberplain
3597 \def\theorem@headerfont{\itshape}%
3598 \normalfont
3599 \theoremsymbol{\ensuremath{_\blacksquare}}
3600 \@thm{proof}{proof}{#1}}%
3601 {\@endtheorem}
3602 }% end of option amsthm **********************************************
3603 % \end{macrocode}
3604 % \end{macro}
3605 %
3606 % Defines theorem styles |plain|, |definition|, and
3607 % |remark|, and environment |proof| according to
3608 % |amsthm.sty|.
3609 %
3610 % \subsubsection{Theorem-Environment Handling Stuff}
3611 % Original: ltthm.dtx
3612 %
3613 % \begin{macrocode}
3614 \newskip\thm@topsep
3615 \newskip\thm@topsepadd
3616 % \end{macrocode}
3617 %
3618 % Two auxiliary variables.
3619 %
3620 % \paragraph{Defining New Theorem-Environments.}
3621 %
3622 % \begin{macro}{\newtheorem}
3623 % \changes{v1.18}{1999/12/23}{debugged starred version of 'newtheorem' (WM)}
3624 % \changes{v1.23}{2004/06/13}{moved normal 'newtheorem' into 'newtheorem@i' (WM)}
3625 % \changes{v1.23}{2004/06/13}{normal 'newtheorem': reset theoremprework and
3626 % theorempostwork, then call 'newtheorem@i' (WM, reported by Christoph Kluss)}
3627 % \changes{v1.24}{2004/09/20}{debugged: reset after call, moved downwards (WM)}
3628 % \begin{macrocode}
3629 \gdef\newtheorem{%
3630 \newtheorem@i%
3631 }
3632 % \end{macrocode}
3633 % \end{macro}
3634
3635 % \begin{macro}{\newtheorem@i}
3636 % \changes{v1.23}{2004/06/13}{moved normal 'newtheorem' into 'ntheorem@i' (WM)}
3637 % The syntax of the original |\newtheorem| is retained. The macro is extended
3638 % to deal with the additional requirements:
3639 % \begin{macrocode}
3640 \gdef\newtheorem@i{%
3641 \@ifstar
3642 {\expandafter\@ifundefined{th@nonumber\the\theorem@style}%
3643 {\PackageError{\basename}{Theorem style {nonumber\the\theorem@style}
3644 undefined (you need it here for newtheorem*) }\@ehc}%
3645 {}%
3646 \edef\@tempa{{nonumber\the\theorem@style}}%
3647 \expandafter\theorem@@style\@tempa\@newtheorem}%
3648 {\edef\@tempa{{\the\theorem@style}}%
3649 \expandafter\theorem@@style\@tempa\@newtheorem}}
3650 % \end{macrocode}
3651 % \end{macro}
3652 %
3653 % Defines |\theorem@@style| to be the current |\theoremstyle|
3654 % or -- in case of |\newtheorem*| -- to be its non-numbered
3655 % equivalent (which has to be defined!), and then calls |\@newtheorem|.
3656
3657 % \begin{macro}{\renewtheorem}
3658 % \changes{v0.93}{1997/03/12}{introduced 'renewtheorem' (WM)}
3659 % \changes{v1.18}{1999/12/23}{debugged starred version of 'renewtheorem' (WM)}
3660 % \Codelabel{renewthm}
3661 % \begin{macrocode}
3662 \gdef\renewtheorem{%
3663 \@ifstar
3664 {\expandafter\@ifundefined{th@nonumber\the\theorem@style}%
3665 {\PackageError{\basename}{Theorem style {nonumber\the\theorem@style}
3666 undefined (you need it here for newtheorem*) }\@ehc}%
3667 {}%
3668 \edef\@tempa{{nonumber\the\theorem@style}}%
3669 \expandafter\theorem@@style\@tempa\@renewtheorem}%
3670 {\edef\@tempa{{\the\theorem@style}}%
3671 \expandafter\theorem@@style\@tempa\@renewtheorem}}
3672 % \end{macrocode}
3673 % Analogous to |\newtheorem|.
3674 % \end{macro}
3675 %
3676 % \begin{macro}{\@newtheorem}
3677 % |\@newtheorem| does the main job for initializing a new theorem
3678 % environment type. It is called by |\newtheorem|.
3679 %
3680 % \Codelabel{atnewthm}
3681 % \changes{v0.83}{1997/02/13}{fixed, for bold math in headers (AS)}
3682 % \changes{v0.93}{1997/03/12}{check ifdefinable star-env. added (WM)}
3683 % \changes{v0.93}{1997/03/12}{newcounters only if not yet defined (WM)}
3684 % \changes{v1.02}{1997/05/31}{fixed collision at '@thm', introduced
3685 % 'setparms' and 'mkheader' (WM)}
3686 % \changes{v1.16}{1999/08/07}{introduced 'th@class' (WM)}
3687 % \changes{v1.18}{1999/12/23}{'protected@xdef' for Symbol (WM)}
3688 % \changes{v1.21}{2002/12/30}{added handling of 'theoremprework' and
3689 % 'theorempostwork' (WM)}
3690 % \changes{v1.24}{2004/09/20}{debugged: reset theorempre/postwork (WM)}
3691 % \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)}
3692 % \begin{macrocode}
3693 \gdef\@newtheorem#1{%
3694 \thm@tempiffalse
3695 \expandafter\@ifdefinable\csname #1\endcsname
3696 {\expandafter\@ifdefinable\csname #1*\endcsname
3697 {\thm@tempiftrue
3698 \thm@definelthm{#1}% for lists
3699 \if@thmmarks
3700 \expandafter\@ifundefined{c@curr#1ctr}%
3701 {\newcounter{curr#1ctr}}{}%
3702 \expandafter\@ifundefined{c@end#1ctr}%
3703 {\newcounter{end#1ctr}}{}%
3704 \fi
3705 \expandafter\protected@xdef\csname #1Symbol\endcsname{\the\theoremsymbol}%
3706 \expandafter\protected@xdef\csname #1@postwork\endcsname{%
3707 \the\theorempostwork}%
3708 \expandafter\gdef\csname#1\endcsname{%
3709 \let\thm@starredenv\@undefined
3710 \csname mkheader@#1\endcsname}%
3711 \expandafter\gdef\csname#1*\endcsname{%
3712 \let\thm@starredenv\relax
3713 \csname mkheader@#1\endcsname}%
3714 \def\@tempa{\expandafter\noexpand\csname end#1\endcsname}%
3715 \expandafter\xdef\csname end#1*\endcsname{\@tempa}%
3716 \expandafter\xdef\csname setparms@#1\endcsname
3717 {\noexpand \def \noexpand \theorem@headerfont
3718 {\the\theoremheaderfont\noexpand\theorem@checkbold}%
3719 \noexpand \def \noexpand \theorem@separator
3720 {\the\theoremseparator}%
3721 \noexpand \def \noexpand \theorem@prework
3722 {\the\theoremprework}%
3723 \noexpand\ifuse@newframeskips
3724 \noexpand \theorempreskipamount \the\theorem@preskip
3725 \noexpand \theoremframepreskipamount \the\theorem@framepreskip
3726 \noexpand \theoreminframepreskipamount \the\theorem@inframepreskip
3727 \noexpand \theorempostskipamount \the\theorem@postskip
3728 \noexpand \theoremframepostskipamount \the\theorem@framepostskip
3729 \noexpand \theoreminframepostskipamount \the\theorem@inframepostskip
3730 \noexpand\fi
3731 \noexpand \def \noexpand \theorem@indent
3732 {\the\theoremindent}%
3733 \noexpand \def \noexpand \theorem@rightindent
3734 {\the\theoremrightindent}%
3735 \the \theorembodyfont
3736 \noexpand\csname th@\the \theorem@@style \endcsname}%
3737 \expandafter\xdef\csname th@class@#1\endcsname
3738 {\noexpand\theoremstyle{\the\theorem@style}%
3739 \noexpand\theoremheaderfont{\the\theoremheaderfont}%
3740 \noexpand\theorembodyfont{\the \theorembodyfont}%
3741 \noexpand\theoremseparator{\the\theoremseparator}%
3742 \noexpand\theoremprework{\the\theoremprework}%
3743 \noexpand\theorempostwork{\the\theorempostwork}%
3744 \noexpand\ifuse@newframeskips
3745 \noexpand\theorempreskip {\the\theorem@preskip}%
3746 \noexpand\theoremframepreskip {\the\theorem@framepreskip}%
3747 \noexpand\theoreminframepreskip {\the\theorem@inframepreskip}%
3748 \noexpand\theorempostskip {\the\theorem@postskip}%
3749 \noexpand\theoremframepostskip {\the\theorem@framepostskip}%
3750 \noexpand\theoreminframepostskip {\the\theorem@inframepostskip}%
3751 \noexpand\fi
3752 \noexpand\theoremindent\the\theoremindent%
3753 \noexpand\theoremrightindent\the\theoremrightindent%
3754 \noexpand\theoremnumbering{\the\theoremnumbering}%
3755 \noexpand\theoremsymbol{\the\theoremsymbol}}%
3756 }}%
3757 \theoremprework{\relax}%
3758 \theorempostwork{\relax}%
3759 \@ifnextchar[{\@othm{#1}}{\@nthm{#1}}}% MUST NOT BE IN ANY IF !!!
3760 % \end{macrocode}
3761 %
3762 % Argument: \env:=|#1| is the (internal) environment name to be defined,
3763 % which is read from the \LaTeX\ source.
3764 % \begin{packeddescr}
3765 % \item[Line \Coderef{atnewthm}{3}:]
3766 % check if \env\ is not yet defined (or is redefined).
3767 % \item[Lines \Coderef{atnewthm}{5}--\Coderef{atnewthm}{30}]
3768 % are executed exactly if \env\ and \env * are not yet defined.
3769 % \item[Line \Coderef{atnewthm}{5}:]
3770 % |\thm@tempif=true| iff \env\ and \env * are not yet defined.
3771 % \item[Line \Coderef{atnewthm}{6}:]
3772 % Initialize theorem list handling for \env.
3773 % \item[Lines \Coderef{atnewthm}{7}--\Coderef{atnewthm}{12}:]
3774 % if |thmmarks| is active and the counters are not yet defined,
3775 % for every theorem-like, define \\
3776 % |curr|\env|ctr|: in the $i$th environment of type \env,
3777 % $|curr|\env|ctr|=i$, and \\
3778 % |end|\env|ctr|: when the innermost environment is of
3779 % type \env, in the $j$th potential position for an end
3780 % mark in this environment, $|end|\env|ctr|=j$.
3781 % (if the counters are already defined, \env\ is redefined,
3782 % and these internal counters have to be continued).
3783 % \item[Lines \Coderef{atnewthm}{13}--\Coderef{atnewthm}{61}:]
3784 % define several commands:
3785 % (|\xdef| expands the definition at the time it is called and
3786 % makes it global):
3787 % \item[Line \Coderef{atnewthm}{13}:]
3788 % store the current value of |\theoremsymbol| as |\|\env|Symbol|.
3789 % \item[Line \Coderef{atnewthm}{14}, \Coderef{atnewthm}{15}:]
3790 % store the current value of |\theorempostwork| as |\|\env|postwork|.
3791 % \item[Lines \Coderef{atnewthm}{16}--\Coderef{atnewthm}{18},
3792 % \Coderef{atnewthm}{19}--\Coderef{atnewthm}{21}:]
3793 % Define the commands |\env| and |\env*| to set the header
3794 % of \env\ by calling |\mkheader@|\env.
3795 % (using a switch |\thm@starredenv|: |\relax| iff starred).
3796 % \item[Lines \Coderef{atnewthm}{22}, \Coderef{atnewthm}{23}:]
3797 % Set |\end|\env|*| to |\end|\env.
3798 % \item[Lines \Coderef{atnewthm}{24}--\Coderef{atnewthm}{42}:]
3799 % define |\setparms@|\env\ to set the style parameters of the
3800 % header for every \env\ environment (in the sequel,
3801 % \emph{current} means, at the moment |\@newtheorem| is called):
3802 % \item[Lines \Coderef{atnewthm}{25}, \Coderef{atnewthm}{26}:]
3803 % setting |\theorem@headerfont| to the \emph{current}
3804 % value of |\theoremheaderfont|, followed by a check if
3805 % it is a bold style,
3806 % \item[Lines \Coderef{atnewthm}{27}, \Coderef{atnewthm}{28}:]
3807 % setting |\theorem@separator| to the \emph{current}
3808 % value of |\theoremseparator|,
3809 % \item[Lines \Coderef{atnewthm}{29}, \Coderef{atnewthm}{30}:]
3810 % setting |\theorem@prework| to the \emph{current}
3811 % value of |\theoremprework|,
3812 % \item[Lines \Coderef{atnewthm}{31}--\Coderef{atnewthm}{38}:]
3813 % if new skip schema is used: setting the skips to the
3814 % \emph{current} values hold in the respective tokens,
3815 % \item[Line \Coderef{atnewthm}{39}, \Coderef{atnewthm}{40}:]
3816 % setting |\theorem@indent| to the \emph{current}
3817 % value of |\theoremindent|,
3818 % \item[Line \Coderef{atnewthm}{41}:]
3819 % executing the command sequence currently stored in
3820 % |\theorembodyfont|, and
3821 % \item[Line \Coderef{atnewthm}{42}:]
3822 % calling |th@\the\theorem@@style| (which initializes
3823 % |\@begintheorem| and |\@opargbegintheorem| according to the
3824 % \emph{current} value of |\theoremstyle| by calling
3825 % |th@\the\theorem@@style|).
3826 % \item [Line \Coderef{atnewthm}{43}--\Coderef{atnewthm}{60}:]
3827 % define |\th@class@|\env\ to initialize all style
3828 % parameters as they are set for the \env\ environment.
3829 % (call skip-initializing commands only if new skip scheme
3830 % is activated).
3831 % \item[Note,] that the |\@ifdefinable| from lines
3832 % \Coderef{atnewthm}{3}/\Coderef{atnewthm}{4}
3833 % end in line \Coderef{atnewthm}{59}.
3834 % \item[Line \Coderef{atnewthm}{62}, \Coderef{atnewthm}{63}:]
3835 % reset |\@theoremprework/postwork|.
3836 % \item[Line \Coderef{atnewthm}{64}:]
3837 % According to the next character, call |\@othm{|\env|}|
3838 % (if another counter is used) or |\@nthm{|\env|}|.
3839 % \end{packeddescr}
3840 %
3841 % Thus, when calling |\@newthm| with |#1|=\env,
3842 % for current values |\theoremstyle=plain|,
3843 % |\theorembodyfont=\upshape|, |\theoremheaderfont=\bf|,
3844 % |\theoremseparator=:|, |\theoremindent=1cm|,
3845 % |\theoremnumbering=arabic|, and |\theoremsymbol=\Box|,
3846 %
3847 % the macro |\setparms@|\env\ is defined as
3848 % \begin{quote}
3849 % |\setparms@|\env| == \def\theorem@headerfont{\bf\theorem@checkbold}| \\
3850 % | \def\theorem@separator{:}| \\
3851 % | \def\theorem@indent{1cm}| \\
3852 % | \upshape| \\
3853 % | \th@plain|
3854 % \end{quote}
3855 % and the macro |\th@class@|\env\ is defined as
3856 % \begin{quote}
3857 % |\th@class@|\env| == \def\theoremstyle{plain}|\\
3858 % | \def\theoremheaderfont{\bf}| \\
3859 % | \def\theorembodyfont{\upshape}| \\
3860 % | \def\theoremseparator{:}| \\
3861 % | \def\theoremindent{1cm}| \\
3862 % | \def\theoremnumbering{arabic}| \\
3863 % | \def\theoremsymbol{\Box}|
3864 % \end{quote}
3865 % Note, that line \Coderef{atnewthm}{64} must not be inside
3866 % \emph{any} |\if...\fi| construct.
3867 % \end{macro}
3868 %
3869 % \begin{macro}{\@renewtheorem}
3870 % \changes{v0.93}{1997/03/12}{introduced 'renewtheorem' (WM)}
3871 % \changes{v1.18}{1999/12/23}{calls '@newtheorem' instead of
3872 % 'newtheorem' (WM)}
3873 % \changes{v1.25}{2005/07/07}{error message: 'keyword' (WM)}
3874 % \Codelabel{atrenewthm}
3875 % \begin{macrocode}
3876 \gdef\@renewtheorem#1{%
3877 \expandafter\@ifundefined{#1}%
3878 {\PackageError{\basename}{Theorem keyword #1 undefined}\@ehc}%
3879 {}%
3880 \expandafter\let\csname #1\endcsname\relax
3881 \expandafter\let\csname #1*\endcsname\relax
3882 \@newtheorem{#1}}
3883 % \end{macrocode}
3884 % Argument: \env:=|#1| is the (internal) environment name to be
3885 % redefined, which is read from the \LaTeX\ source. \\
3886 % If \env\ is already defined, make it (and \env*, too) undefined
3887 % and call |\@newtheorem{|\env|}|.
3888 % \end{macro}
3889 %
3890 % \begin{macro}{\@nthm}
3891 % \changes{v1.1}{1998/08/30}{added 'output@' to '@nthm' and '@othm'. (WM)}
3892 % \changes{v1.18}{1999/12/25}{'protected@xdef' instead of 'xdef' (WM)}
3893 % \changes{v1.18}{1999/12/25}{'output' changed and modified into
3894 % 'Keyword' (WM)}
3895 % \Codelabel{nthm}
3896 % |\@nthm| is called by |\@newtheorem| if the environment to be defined
3897 % has a counter of its own.
3898 % \begin{macrocode}
3899 \gdef\@nthm#1#2{%
3900 \expandafter\protected@xdef\csname num@addtheoremline#1\endcsname{%
3901 \noexpand\@num@addtheoremline{#1}{#2}}%
3902 \expandafter\protected@xdef\csname nonum@addtheoremline#1\endcsname{%
3903 \noexpand\@nonum@addtheoremline{#1}{#2}}%
3904 \theoremkeyword{#2}%
3905 \expandafter\protected@xdef\csname #1Keyword\endcsname
3906 {\the\theoremkeyword}%
3907 \@ifnextchar[{\@xnthm{#1}{#2}}{\@ynthm{#1}{#2}}}
3908 % \end{macrocode}
3909 %
3910 % Arguments: \\
3911 % \env:=|#1| is the (internal) environment name to be defined
3912 % (transmitted from |\@newtheorem|). \\
3913 % \meta{output\_name}:=|#2| is its keyword to be used in the
3914 % output (read from the \LaTeX\ source).
3915 % \begin{packeddescr}
3916 % \item[Lines \Coderef{nthm}{2}--\Coderef{nthm}{5}:]
3917 % Define |\|(no)|num@addtheoremline|\env\ to call \\
3918 % |\@|(no)|num@addtheoremline{|\env|}{|\meta{output\_name}|}|. \\
3919 % For comments on |\@num@addtheoremline| and
3920 % |\@nonum@addtheoremline| see Section \ref{sec:CodeLists}.
3921 % \item[Lines \Coderef{nthm}{6}--\Coderef{nthm}{8}:]
3922 % Define |\|\env|Keyword|\env\ to typeset/output \meta{output\_name}.
3923 % (note the similarity with the handling of |\theoremsymbol|
3924 % for handling complex keywords)
3925 % \item[Line \Coderef{nthm}{9}:]
3926 % According to the next character, call
3927 % |\@xnthm{|\env|}{|\meta{output\_name}|}| (if \env-environments
3928 % should be numbered relative to some structuring level) or
3929 % |\@ynthm{|\env|}{|\meta{output\_name}|}|.
3930 % \end{packeddescr}
3931 % \end{macro}
3932 %
3933 % \begin{macro}{\@othm}
3934 % \changes{v1.02}{1997/05/31}{fixed collision at '@thm', introduced
3935 % 'setparms' and 'mkheader' (WM)}
3936 % \changes{v1.1}{1998/08/30}{added 'output@' to '@nthm' and '@othm'. (WM)}
3937 % \changes{v1.12}{1998/11/15}{fixed a bug in '@output' (WM, reported by
3938 % David Epstein)}
3939 % \changes{v1.18}{1999/12/25}{'protected@xdef' instead of 'xdef' (WM)}
3940 % \changes{v1.18}{1999/12/25}{'output' changed and modified into
3941 % 'Keyword' (WM)}
3942 % |\@othm| is called by |\@newtheorem| if the environment to be defined
3943 % uses another counter.
3944 % \Codelabel{othm}
3945 % \begin{macrocode}
3946 \gdef\@othm#1[#2]#3{%
3947 \@ifundefined{c@#2}{\@nocounterr{#2}}%
3948 {\ifthm@tempif
3949 \global\@namedef{the#1}{\@nameuse{the#2}}%
3950 \expandafter\protected@xdef\csname num@addtheoremline#1\endcsname{%
3951 \noexpand\@num@addtheoremline{#1}{#3}}%
3952 \expandafter\protected@xdef\csname nonum@addtheoremline#1\endcsname{%
3953 \noexpand\@nonum@addtheoremline{#1}{#3}}%
3954 \theoremkeyword{#3}%
3955 \expandafter\protected@xdef\csname #1Keyword\endcsname
3956 {\the\theoremkeyword}%
3957 \expandafter\gdef\csname mkheader@#1\endcsname
3958 {\csname setparms@#1\endcsname
3959 \@thm{#1}{#2}{#3}}%
3960 \global\@namedef{end#1}{\@endtheorem}\fi}}
3961 % \end{macrocode}
3962 %
3963 % Arguments: \\
3964 % \env:=|#1| is the (internal) environment name to be defined
3965 % (transmitted from |\@newtheorem|). \\
3966 % \meta{use\_ctr}:=|#2| is the internal name of the theorem which counter
3967 % is used, and \\
3968 % \meta{output\_name}:=|#3| is its ``name'' to be used in the
3969 % output (both read from the \LaTeX\ source).
3970 %
3971 % \begin{packeddescr}
3972 % \item[Line \Coderef{othm}{2}:]
3973 % if the counter to be used is undefined, goto error, else
3974 % set |\the|\env\ to use |\the|\meta{use\_ctr} and do the following:
3975 % \item[Lines \Coderef{othm}{4}--\Coderef{othm}{12}]
3976 % happen only if \env\ is not yet defined or gets redefined:
3977 % \item[Line \Coderef{othm}{4}:] (from latex.ltx)
3978 % make \env\ use the counter \meta{use\_ctr}.
3979 % \item[Lines \Coderef{othm}{5}--\Coderef{othm}{11}]
3980 % similar to lines \Coderef{nthm}{2}--\Coderef{nthm}{8}
3981 % of |\@nthm|.
3982 % \item[Lines \Coderef{othm}{12}--\Coderef{othm}{14}]
3983 % define |\mkheader@|\env\ to set the style parameters of the header
3984 % and set the header (by |\@thm|):
3985 % \begin{quote}
3986 % |\mkheader@|\env\ ==
3987 % |\setparms@|\env|\@thm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|.
3988 % \end{quote}
3989 % (|\setparms@|\env\ is defined when |\@newtheorem{|\env|}| is
3990 % carried out).
3991 % \item[Line \Coderef{othm}{15}:]
3992 % (from latex.ltx): |\end|\env\ calls |\@endtheorem|.
3993 % \end{packeddescr}
3994 % \end{macro}
3995 %
3996 % \begin{macro}{\@xnthm}
3997 % \changes{v0.93}{1997/03/12}{@definecounter only if not yet defined (WM)}
3998 % \changes{v1.02}{1997/05/31}{fixed collision at '@thm', introduced
3999 % 'setparms' and 'mkheader' (WM)}
4000 % |\@xnthm| is called by |\@nthm| if the numbering is relative to some
4001 % structuring level.
4002 % \Codelabel{xnthm}
4003 % \begin{macrocode}
4004 \gdef\@xnthm#1#2[#3]{%
4005 \ifthm@tempif
4006 \expandafter\@ifundefined{c@#1}%
4007 {\@definecounter{#1}}{}%
4008 \@newctr{#1}[#3]%
4009 \expandafter\xdef\csname the#1\endcsname{%
4010 \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
4011 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}}%
4012 \expandafter\gdef\csname mkheader@#1\endcsname
4013 {\csname setparms@#1\endcsname
4014 \@thm{#1}{#1}{#2}}%
4015 \global\@namedef{end#1}{\@endtheorem}\fi}
4016 % \end{macrocode}
4017 %
4018 % Arguments: \\
4019 % \env:=|#1| is the (internal) environment name to be defined
4020 % (transmitted from |\@newtheorem|). \\
4021 % \meta{output\_name}:=|#2| is its keyword to be used in the
4022 % output, \\
4023 % \meta{level}:=|#3| is the structuring level relative to which \env\
4024 % has to be numbered (both read from the \LaTeX\ source).
4025 %
4026 % \begin{packeddescr}
4027 % \item[Lines \Coderef{xnthm}{3}--\Coderef{xnthm}{12}]
4028 % happen only if \env\ is not yet defined or gets redefined:
4029 % \item[Lines \Coderef{xnthm}{3}, \Coderef{xnthm}{4}:]
4030 % in not yet defined, define \env- counter (otherwise, \env\
4031 % is redefined).
4032 % \item[Line \Coderef{xnthm}{6}:]
4033 % (from latex.ltx): define the counter for \env\ and add
4034 % \meta{level} to its reset-triggers.
4035 % \item[Lines \Coderef{xnthm}{7}, \Coderef{xnthm}{8}:]
4036 % define |\the|\env\ to be the command sequence
4037 % \begin{quote}
4038 % |\the|\meta{level}|\@thmcountersep|\meta{numbering}|{|\env|}|~,
4039 % \end{quote}
4040 % where \meta{numbering} is the value of |\theoremnumbering| when
4041 % |\@xnthm| (and thus, |\newtheorem{|\env|}|) is called.
4042 % \item[Lines \Coderef{xnthm}{9}--\Coderef{xnthm}{11}:]
4043 % define |\mkheader@|\env\ to set the style parameters of the header
4044 % and set the header (by |\@thm|):
4045 % \begin{quote}
4046 % |\mkheader@|\env\ ==
4047 % |\setparms@|\env|\@thm{|\env|}{|\env|}{|\meta{output\_name}|}|.
4048 % \end{quote}
4049 % (|\setparms@|\env\ is defined when |\@newtheorem{|\env|}| is
4050 % carried out).
4051 % \item[Line \Coderef{xnthm}{12}:]
4052 % (from latex.ltx): |\end|\env\ calls |\@endtheorem|.
4053 % \end{packeddescr}
4054 % \end{macro}
4055 %
4056 % \begin{macro}{\@ynthm}
4057 % \changes{v0.93}{1997/03/12}{'@definecounter' only if not yet defined (WM)}
4058 % \changes{v1.02}{1997/05/31}{fixed collision at '@thm', introduced
4059 % 'setparms' and 'mkheader' (WM)}
4060 % |\@ynthm| is called by |\@nthm| if the counter is not relative to any
4061 % structuring level.\\
4062 % \Codelabel{ynthm}
4063 % \begin{macrocode}
4064 \gdef\@ynthm#1#2{%
4065 \ifthm@tempif
4066 \expandafter\@ifundefined{c@#1}%
4067 {\@definecounter{#1}}{}%
4068 \expandafter\xdef\csname the#1\endcsname
4069 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}%
4070 \expandafter\gdef\csname mkheader@#1\endcsname
4071 {\csname setparms@#1\endcsname
4072 \@thm{#1}{#1}{#2}}%
4073 \global\@namedef{end#1}{\@endtheorem}\fi}
4074 % \end{macrocode}
4075 %
4076 % Arguments: \\
4077 % \env:=|#1| is the (internal) environment name to be defined
4078 % (transmitted from |\@newtheorem|). \\
4079 % \meta{output\_name}:=|#2| is its keyword to be used in the
4080 % output. \\
4081 % |\@ynthm| works analogous to |\@xnthm|.
4082 % \end{macro}
4083 %
4084 % \paragraph{Notes on vertical spacing}
4085 %
4086 % In \LaTeX\ and in |ntheorem|, theorems are organized as
4087 % |\trivlist|s, using the following skips:
4088 %
4089 % \begin{packeddescr}
4090 % \item[$\bullet$] |\@topsep|: above,
4091 % \item[$\bullet$] |\@topsepadd|: below (the name is misleading).
4092 % \end{packeddescr}
4093 %
4094 % In \LaTeX (cf.\ |latex.ltx| and its sources), the handling is as follows:
4095 %
4096 % \begin{packeddescr}
4097 % \item[$\bullet$] |\@begintheorem|: calls |\trivlist| and afterwards |\item|.
4098 % \item[$\bullet$] |\trivlist|: calls |\@trivlist|.
4099 % \item[$\bullet$] |\@trivlist|: sets
4100 % |\@topsepadd := \topsep + ifvmode: \partopsep|, \\
4101 % |\@topsep := \@topsepadd|, and
4102 % |\@topsep += \parskip| -- this latter will be undone later in |\@item|!
4103 % \item[$\bullet$] |\item|: calls |\@item|.
4104 % \item[$\bullet$] |\@item|: does |\addvspace\@topsep| and |\addvspace{-\parskip}|.
4105 % \item[$\Rightarrow$] only |\@topsep| must be set to \meta{value}+|\parskip|
4106 % before the actual text is output by |\@item|
4107 % \item[$\bullet$] |\@endtheorem|: calls |\endtrivlist|.
4108 % \item[$\bullet$] |\endtrivlist|: note |\@noparlist| is only true if list is
4109 % itself at the beginning of a list item -- this is (usually) not the case
4110 % for theorems. \\
4111 % The |\ifdim\lastskip ...| part actually leaves skips unchanged in
4112 % default cases (|\@outerparskip := \parskip| in |\@trivlist|). \\
4113 % Afterwards, it calls |\@endparenv|
4114 % \item[$\bullet$] |\@endparenv|: does |\addvspace\@topsepadd|.
4115 % \end{packeddescr}
4116 %
4117 % In |ntheorem|, |\|\env is used instead of a common |\@begintheorem|
4118 % (defined by |\newtheorem| in Lines
4119 % \Coderef{atnewthm}{16}--\Coderef{atnewthm}{18},
4120 % \Coderef{atnewthm}{19}--\Coderef{atnewthm}{21}) that
4121 % call |\mkheader@|\env.
4122 % The actual definition of |\mkheader@|\env\ is done in |\@othm|,
4123 % |\@xnthm|, or |\@ynthm| as |\mkheader@|\env\ ==
4124 % |\setparms@|\env|\@thm{...}{...}{...}|. \\
4125 % Amongst this, |\@thm{...}{...}{...}|, whose code is given next,
4126 % \begin{packeddescr}
4127 % \item[$\bullet$] generates the actual output of the theorem header
4128 % (via |\@xthm|/|\@begintheorem| or |\@ythm|/|\@opargbegintheorem|)
4129 % where |\@begintheorem| and |\@opargbegintheorem| are redefined
4130 % by |ntheorem|:
4131 % \item[$\bullet$] |\@begintheorem| and |\@opargbegintheorem|
4132 % do \emph{not} contain the |\trivlist| command, but only set the
4133 % |\item| (internally |\@item| that adds space |\@topsep-\parskip|).
4134 % \item[$\bullet$] the |\trivlist| command itself is contained in
4135 % |\@thm|, recall that as described above, it is not concerned
4136 % with skips at all.
4137 % \item[$\Rightarrow$] |\@thm| has to set
4138 % |\@topsep := |\meta{value}|+\parskip| for the space \emph{above}
4139 % the theorem.
4140 % \item[$\bullet$] |\end|\env is defined in |\@othm|, |\@xnthm|, or |\@ynthm|
4141 % as |\@endtheorem| which is defined in Lines
4142 % \Coderef{atendtheorem}{0} (thmmarks active) and
4143 % \Coderef{atendtheorem-without}{0} (thmmarks off).
4144 % \item[$\bullet$] |\@endtheorem| with thmmarks on calls
4145 % ntheorem's |\@endtrivlist| (Line \Coderef{atendtrivlist}{0})
4146 % which calls |\@endparenv|.
4147 % \item[$\bullet$] |\@endtheorem| with thmmarks off calls
4148 % the original |\endtrivlist| which calls the original
4149 % |\@endtrivlist| which calls |\@endparenv|.
4150 % \item[$\Rightarrow$] |\@topsepadd| is used for the vertical space
4151 % after the theorem as usual.
4152 % \end{packeddescr}
4153 %
4154 % \paragraph{Handling Instances of Theorem-Environments.}
4155 %
4156 %
4157 % \begin{macro}{\@thm}
4158 % |\@thm| is called by |\@|\env\ (which is defined by
4159 % |\@othm|/|\@xnthm|/|\@ynthm|).
4160 % \changes{v1.21}{2002/12/30}{added handling of 'theoremprework' (WM)}
4161 % \changes{v1.32}{2011/02/28}{adapted to new skip scheme (WM)}
4162 % \Codelabel{atthm}
4163 % \begin{macrocode}
4164 \gdef\@thm#1#2#3{%
4165 \if@thmmarks
4166 \stepcounter{end\InTheoType ctr}%
4167 \fi
4168 \renewcommand{\InTheoType}{#1}%
4169 \if@thmmarks
4170 \stepcounter{curr#1ctr}%
4171 \setcounter{end#1ctr}{0}%
4172 \fi
4173 \refstepcounter{#2}%
4174 \theorem@prework
4175 \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
4176 \ifuse@newframeskips % cf. latex.ltx for topsepadd: \@trivlist
4177 \ifthm@inframe
4178 \thm@topsep\theoreminframepreskipamount
4179 \thm@topsepadd\theoreminframepostskipamount
4180 \else
4181 \thm@topsep\theorempreskipamount
4182 \thm@topsepadd\theorempostskipamount
4183 \fi
4184 \else% oldframeskips
4185 \thm@topsep\theorempreskipamount
4186 \thm@topsepadd \theorempostskipamount
4187 \ifvmode\advance\thm@topsepadd\partopsep\fi
4188 \fi
4189 \@topsep\thm@topsep
4190 \@topsepadd\thm@topsepadd
4191 \advance\linewidth -\theorem@indent
4192 \advance\linewidth -\theorem@rightindent
4193 \advance\@totalleftmargin \theorem@indent
4194 \parshape \@ne \@totalleftmargin \linewidth
4195 \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}}
4196 % \end{macrocode}
4197 % \changes{v0.91}{1997/02/27}{'theorem...skip' fixed (WM)}
4198 %
4199 % Changed to three instead of two parameters (the first one is new): \\
4200 % \env:=|#1|: (added) internal name of the theorem environment, \\
4201 % \meta{use\_ctr}:=|#2|: internal name of the theorem which counter
4202 % is used, \\
4203 % \meta{output\_name}:=|#3|: keyword to be displayed in the output;
4204 % all arguments are transmitted from |\@othm|/|\@xnthm|/|\@ynthm|.
4205 % \begin{packeddescr}
4206 % \item[Lines \Coderef{atthm}{2}--\Coderef{atthm}{4}:]
4207 % if |thmmarks| is active, the counter for the current
4208 % environment \envx\ is incremented, since the last endmark in
4209 % environment \envx\ is definitely not the position for its endmark
4210 % (necessary for nested environments ending at the same time).
4211 % \item[Line \Coderef{atthm}{5}:]
4212 % set |\InTheoType| to \env.
4213 % \item[Lines \Coderef{atthm}{6}--\Coderef{atthm}{9}:]
4214 % if |thmmarks| is active, increment |curr|\env|ctr| and
4215 % set |end|\env|ctr| to 0.
4216 % \item[Line \Coderef{atthm}{10}:]
4217 % adapted from latex.ltx: increment the corresponding counter.
4218 % \item[Line \Coderef{atthm}{11}:]
4219 % perform |prework| (before theorem structure is generated).
4220 % \item[Line \Coderef{atthm}{12}:]
4221 % call \LaTeX's original |\trivlist|. It does just organizational
4222 % things, no actual skips! The skip is added later when the first
4223 % |\item| is typeset.
4224 % \item[Lines \Coderef{atthm}{13}--\Coderef{atthm}{25}:]
4225 % handle |\theorempreskipamount|, |\theorempostskipamount|, \\
4226 % |\theoreminframepreskipamount|, and
4227 % |\theoreminframepostskipamount|
4228 % (old skip schema: if in |vmode|, there is additional space,
4229 % cf.\ |\trivlist| and |\@trivlist| in latex.ltx).
4230 % \item[Lines \Coderef{atthm}{26}--\Coderef{atthm}{27}:]
4231 % initialize |\@topsep| (the space before the first item) and
4232 % |\@topsepadd| (the space after the first item). (see explanation
4233 % of spacing in the note preceding this macro.)
4234 % \item[Lines \Coderef{atthm}{28}--\Coderef{atthm}{30}:]
4235 % handle |\theoremindent|.
4236 % \item[Line \Coderef{atthm}{31}:]
4237 % if there is an optional argument, call \\
4238 % |\@ythm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|,
4239 % otherwise call \\
4240 % |\@xthm{|\env|}{|\meta{use\_ctr}|}{|\meta{output\_name}|}|.
4241 % \end{packeddescr}\end{macro}
4242 %
4243 % \begin{macro}{\@xthm}
4244 % |\@xthm| is called by |\@thm| if there is no optional text in
4245 % the theorem header.
4246 % \Codelabel{xthm}
4247 % \begin{macrocode}
4248 \def\@xthm#1#2#3{%
4249 \@begintheorem{#3}{\csname the#2\endcsname}%
4250 \ifx\thm@starredenv\@undefined
4251 \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{}}\fi
4252 \ignorespaces}
4253 % \end{macrocode}
4254 %
4255 % Changed to three instead of two parameters (the first one is new): \\
4256 % \env:=|#1|: (added) internal name of the theorem environment, \\
4257 % \meta{use\_ctr}:=|#2|: internal name of the theorem which counter
4258 % is used, \\
4259 % \meta{output\_name}:=|#3|: keyword to be displayed in the output. \\
4260 % All arguments are transmitted from |\@thm|. \\
4261 % For comments, see |\@ythm|.
4262 % \end{macro}
4263 %
4264 % \begin{macro}{\@ythm}
4265 % \changes{v1.1}{1998/03/31}{added definition of 'env\-name' (WM)}
4266 % |\@ythm| is called by |\@thm| if there is an optional text in
4267 % the theorem header.
4268 % \Codelabel{ythm}
4269 % \begin{macrocode}
4270 \def\@ythm#1#2#3[#4]{%
4271 \expandafter\global\expandafter\def\csname#1name\endcsname{#4}%
4272 \@opargbegintheorem{#3}{\csname the#2\endcsname}{#4}%
4273 \ifx\thm@starredenv\@undefined
4274 \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{#4}}\fi
4275 \ignorespaces}
4276 % \end{macrocode}
4277 %
4278 % Changed to four instead of three parameters (the first one is new): \\
4279 % \env:=|#1|: (added) internal name of the theorem environment, \\
4280 % \meta{use\_ctr}:=|#2|: internal name of the theorem which counter
4281 % is used, \\
4282 % \meta{output\_name}:=|#3|: keyword to be displayed in the output. \\
4283 % \meta{opt\_text}:=|#4|: optional text to appear in the header. \\
4284 % |#1|--|#3| are transmitted from |\@thm|, |#4| is read from the \LaTeX\
4285 % source.
4286 % \begin{packeddescr}
4287 % \item[Line \Coderef{ythm}{2}:]
4288 % define |\|\meta{env}|name| to be the optional argument.
4289 % \item[Line \Coderef{ythm}{3}:] call
4290 % \begin{quote}
4291 % |\@opargbegintheorem{|\meta{output\_name}|}{\the|\meta{use\_ctr}|}{|\meta{opt\_text}|}|
4292 % \end{quote}
4293 % which outputs the header.
4294 % \item[Line \Coderef{ythm}{4}, \Coderef{ythm}{5}:]
4295 % if \env\ is not the starred version, call
4296 % \begin{quote}
4297 % |\thm@thmcaption{|\meta{env}|}{{|\meta{output\_name}|}|\ignorespaces
4298 % |{\the|\meta{use\_ctr}|}{|\meta{opt\_text}|}}|
4299 % \end{quote}
4300 % which makes an entry into the theorem list.
4301 % \end{packeddescr} \end{macro}
4302 %
4303 % \begin{macro}{\@endtheorem}
4304 % \changes{v1.21}{2002/12/30}{added changes to '@endtheorem' in case that
4305 % [thmmarks] is not active (WM)}
4306 %
4307 % |\@endtheorem| is called for every |\end{|\env|}|, where \env\ is a
4308 % theorem-like environment.
4309 % (note that |\@endtheorem| it is also changed by option [thmmarks]
4310 % to organize the placement of the corresponding end mark).
4311 % |\InTheoType| gives the innermost theorem-like environment,
4312 % i.e.\ the one to be ended:
4313 %
4314 % \Codelabel{atendtheorem-without}
4315 % \begin{macrocode}
4316 \gdef\@endtheorem{%
4317 \endtrivlist
4318 \csname\InTheoType @postwork\endcsname
4319 }
4320 % \end{macrocode}
4321 % \end{macro}
4322 %
4323 % \subsubsection{Framed and Boxed Theorems}
4324 %
4325 % The option `framed' activates framed and boxed layouts.
4326 % It requires to load the |framed| package and the |pstricks| package.
4327 %
4328 % \changes{v1.21}{2002/12/30}{included option `framed' (WM)}
4329 % \begin{macro}{framed}
4330 %
4331 % \begin{macrocode}
4332 \DeclareOption{framed}{%*********************************
4333 \newtoks\shadecolor
4334 \shadecolor{gray}
4335 \let\theoremframecommand\relax
4336 % \end{macrocode}
4337 % \end{macro}
4338 %
4339 % \begin{macro}{\newshadedtheorem}
4340 % \changes{v1.30}{2010/08/15}{added `theoremframepre/postskipamount' (WM)}
4341 % \changes{v1.32}{2011/02/23}{consider lastskip in `theoremprework' (WM)}
4342 % \changes{v1.32}{2011/02/23}{consider lastskip in `theorempostwork' (WM)}
4343 % \changes{v1.32}{2011/02/28}{added thm@inframe (WM)}
4344 % \changes{v1.32}{2011/03/15}{separated `thm@framedprework' and `thm@framedpostwork' (WM)}
4345 % \begin{macrocode}
4346 \def\thm@framedprework{%
4347 \ifdim\lastskip <\theoremframepreskipamount
4348 \vskip -\lastskip
4349 \vskip\theoremframepreskipamount
4350 \fi
4351 \ifuse@newframeskips\vspace{-\topsep}\fi
4352 \thm@inframetrue
4353 \framed}%
4354 \def\thm@framedpostwork{%
4355 \endframed
4356 \ifuse@newframeskips\unskip\fi
4357 \vskip\theoremframepostskipamount}%
4358 % \end{macrocode}
4359 % \end{macro}
4360 %
4361 % Note: since |framed.sty| adds |\topsep| before and after a frame,
4362 % |\vspace{-\topsep}| and |\unskip| are used to remove it. For compatibility
4363 % with previous versions, this is only done if the new skip schema is used.
4364 %
4365 % \begin{macro}{\newshadedtheorem}
4366 % \changes{v1.21}{2002/12/30}{added (WM)}
4367 % \changes{v1.32}{2011/03/15}{use `thm@framedprework' and `thm@framedpostwork' (WM)}
4368 % \changes{v1.33}{2011/08/15}{have user-defines `thm@pre/postwork' and shading/framing
4369 % together (cf.\ `newshadedtheorem') (WM)}
4370 % \begin{macrocode}
4371 \def\newshadedtheorem#1{%
4372 \expandafter\xdef\csname#1@shadecolor\endcsname{%
4373 \the\shadecolor}%
4374 \ifx\theoremframecommand\relax
4375 \expandafter\global\expandafter\xdef\csname#1@framecommand\endcsname{%
4376 \noexpand\psframebox[fillstyle=solid,
4377 fillcolor=\csname#1@shadecolor\endcsname,
4378 linecolor=\csname#1@shadecolor\endcsname]}%
4379 \else
4380 \expandafter\global\expandafter\let\csname#1@framecommand\endcsname%
4381 \theoremframecommand%
4382 \fi
4383 \expandafter\xdef\csname#1@@prework\endcsname{%
4384 \the\theoremprework}%
4385 \theoremprework{%
4386 \csname#1@@prework\endcsname
4387 \def\FrameCommand{\csname#1@framecommand\endcsname}%
4388 \thm@framedprework}%
4389 \expandafter\xdef\csname#1@@postwork\endcsname{%
4390 \the\theorempostwork}%
4391 \theorempostwork{%
4392 \thm@framedpostwork
4393 \csname#1@@postwork\endcsname}%
4394 \newtheorem@i{#1}%
4395 }
4396 % \end{macrocode}
4397 % \end{macro}
4398 %
4399 % \begin{macro}{\newframedtheorem}
4400 % \changes{v1.32}{2011/03/15}{use `thm@framedprework' and `thm@framedpostwork',
4401 % cf.\ `newshadedtheorem' (WM)}
4402 % \changes{v1.33}{2011/08/15}{have user-defined `thm@pre/postwork' and shading/framing
4403 % together (cf.\ `newshadedtheorem') (WM)}
4404 % \begin{macrocode}
4405 \def\newframedtheorem#1{%
4406 \expandafter\xdef\csname#1@@prework\endcsname{%
4407 \the\theoremprework}%
4408 \theoremprework{\csname#1@@prework\endcsname\thm@framedprework}%
4409 \expandafter\xdef\csname#1@@postwork\endcsname{%
4410 \the\theorempostwork}%
4411 \theorempostwork{\thm@framedpostwork\csname#1@@postwork\endcsname}%
4412 \newtheorem@i{#1}%
4413 }
4414 }% end of option framed **********************************************
4415 % \end{macrocode}
4416 % \end{macro}
4417 %
4418 % \subsubsection{Generation of Theorem Lists}\label{sec:CodeLists}
4419 %
4420 % The generation of lists of theorems, definitions, etc.\ is based
4421 % on the |.thm| file.
4422 %
4423 % The following macros are are needed for the generation of theorem-lists.
4424 % We will document it for the theorem
4425 % |\begin{definition}[optional]|, which we assume to be the first
4426 % definition at all and which is placed on page 5.
4427 %
4428 % \begin{macro}{\thm@thmcaption}
4429 % This macro, used internally, strips of the outer brackets
4430 % from the second argument and calls |\thm@@thmcaption|.
4431 % It's typically called like this
4432 % \begin{quote}
4433 % |\thm@thmcaption{definition}{{Definition}{1}{optional}}|
4434 % \end{quote}
4435 % (internal name of the environment, output keyword, running number,
4436 % optional text)
4437 % \begin{macrocode}
4438 \def\thm@thmcaption#1#2{\thm@@thmcaption{#1}#2}
4439 % \end{macrocode}
4440 % \end{macro}
4441 %
4442 % \begin{macro}{\thm@@thmcaption}
4443 % \changes{v1.18}{1999/12/25}{'thm@parseforwriting' also for \#2 (WM)}
4444 % |\thm@caption| is called from |\thm@caption|; it writes an
4445 % appropriate entry to the |.thm|-file.
4446 % \Codelabel{thmcaption}
4447 % \begin{macrocode}
4448 \def\thm@@thmcaption#1#2#3#4{%
4449 \thm@parseforwriting{#2}%
4450 \let\thm@tmpii\thm@tmp
4451 \thm@parseforwriting{#4}%
4452 \edef\thm@t{{\thm@tmpii}{#3}{\thm@tmp}}%
4453 \addcontentsline{thm}{#1}{\thm@t}}
4454 % \end{macrocode}
4455 %
4456 % Arguments:
4457 % \env:=|#1| is the internal environment name,
4458 % \meta{output\_name}:=|#2| is its keyword to be used in the
4459 % output, |#3| is the running number, and |#4| is the optional
4460 % text argument in the header.
4461 %
4462 % \begin{packeddescr}
4463 % \item[Lines \Coderef{thmcaption}{1}, \Coderef{thmcaption}{2}:]
4464 % the command sequence for the output keyword is prepared by
4465 % |\thm@parseforwriting| (which returns |\thm@tmpii|) and then
4466 % stored in |\thm@tmpii|.
4467 % \item[Line \Coderef{thmcaption}{3}:]
4468 % the optional text is also prepared by |\thm@parseforwriting|
4469 % \item[Lines \Coderef{thmcaption}{4}, \Coderef{thmcaption}{5}:]
4470 % The output is collected and written into the |.aux| file,
4471 % which will forward it to the theorem-file.
4472 % \end{packeddescr}
4473 % \end{macro}
4474 %
4475 % The following two macros are just shortcuts, often needed
4476 % for the output of one single line in the theorem-lists. The
4477 % first one is used in unnamed lists, the second one in named.
4478 % Warning: Don't remove the leading |\let|, since you will get
4479 % wrong |\if|-|\fi|-nesting without it, if you don't use
4480 % |hyperref|.
4481 % \begin{macro}{\thm@@thmline@noname}
4482 % \changes{v1.17}{1999/09/06}{intruduced shortcuts for single lines in lists (AS)}
4483 % \changes{v1.17}{1999/09/07}{hyperref adjustment (AS)}
4484 % \begin{macrocode}
4485 \def\thm@@thmline@noname#1#2#3#4{%
4486 \@dottedtocline{-2}{0em}{2.3em}%
4487 {\protect\numberline{#2}#3}%
4488 {#4}}
4489 % \end{macrocode}
4490 % \end{macro}
4491 % \begin{macro}{\thm@@thmline@name}
4492 % \begin{macrocode}
4493 \def\thm@@thmline@name#1#2#3#4{%
4494 \@dottedtocline{-2}{0em}{2.3em}%
4495 {#1 \protect\numberline{#2}#3}%
4496 {#4}}
4497 % \end{macrocode}
4498 % \end{macro}
4499 %
4500 % \begin{macro}{\thm@thmline}
4501 % This is another short one, which only discards the outer brackets
4502 % from the first argument and calls |\thm@@thmline|. It's normally
4503 % called like this:
4504 % \begin{quote}
4505 % |\thm@@thmline{{Definition}{1}{optional}}{5}|
4506 % \end{quote}
4507 % \begin{macrocode}
4508 \def\thm@thmline#1#2{\thm@@thmline#1{#2}}
4509 % \end{macrocode}
4510 % \end{macro}
4511 %
4512 % \begin{macro}{\thm@lgobble}
4513 % \changes{v1.31}{2011/02/14}{split 'thm@lgobble' into 'thm@lgobble@entry'
4514 % and 'thm@lgobble@freetext' (WM)}
4515 % The following macros are used to ignore entries for theorem sets, that
4516 % should not occur in a given list:
4517 % \begin{macrocode}
4518 \long\def\thm@lgobble@entry#1#2{\ignorespaces}
4519 \long\def\thm@lgobble@freetext#1#2{\ignorespaces}
4520 % \end{macrocode}
4521 % \end{macro}
4522 %
4523 % The following four macros set up the predefined list-types. To do so,
4524 % they define the internal macros |\thm@@thmlstart| (containing the code
4525 % to be executed at the beginning of the list), |\thm@@thmlend| (code
4526 % to be executed at the end of the list) and |\thm@@thmline| (code to
4527 % be executed for every line). In order to gain compatibility with
4528 % |newthm.sty|, we decided not to make this commands inaccessible
4529 % to the user. But we recommend not using these commands, because they may
4530 % disappear in later distributions.
4531 %
4532 % \begin{macro}{\theoremlistall}
4533 % This one implements the type |all|.
4534 % \begin{macrocode}
4535 \def\theoremlistall{%
4536 \let\thm@@thmlstart=\relax
4537 \let\thm@@thmlend=\relax
4538 \let\thm@@thmline=\thm@@thmline@noname}
4539 % \end{macrocode}
4540 % \end{macro}
4541 % \begin{macro}{\theoremlistallname}
4542 % And here's the type |allname|.
4543 % \begin{macrocode}
4544 \def\theoremlistallname{%
4545 \let\thm@@thmlstart=\relax
4546 \let\thm@@thmlend=\relax
4547 \let\thm@@thmline=\thm@@thmline@name}
4548 % \end{macrocode}
4549 % \end{macro}
4550 % \begin{macro}{\theoremlistoptional}
4551 % This one is the list-type |opt|. In case of |[hyperref]|, the fifth
4552 % argument, which is provided by |hyperref.sty| is automatically
4553 % given to |\thm@@thmline@noname|.
4554 % \begin{macrocode}
4555 \def\theoremlistoptional{%
4556 \let\thm@@thmlstart=\relax
4557 \let\thm@@thmlend=\relax
4558 \def\thm@@thmline##1##2##3##4{%
4559 \ifx\empty ##3%
4560 \else
4561 \thm@@thmline@noname{##1}{##2}{##3}{##4}%
4562 \fi}}
4563 % \end{macrocode}
4564 % \end{macro}
4565 % \begin{macro}{\theoremlistoptname}
4566 % And the last type, |optname|. In case of |[hyperref]|, the fifth
4567 % argument, which is provided by |hyperref.sty| is automatically
4568 % given to |\thm@@thmline@name|.
4569 % \begin{macrocode}
4570 \def\theoremlistoptname{%
4571 \let\thm@@thmlstart=\relax
4572 \let\thm@@thmlend=\relax
4573 \def\thm@@thmline##1##2##3##4{%
4574 \ifx\empty ##3%
4575 \else%
4576 \thm@@thmline@name{##1}{##2}{##3}{##4}%
4577 \fi}}
4578 % \end{macrocode}
4579 % \end{macro}
4580 %
4581 % \begin{macro}{\theoremlisttype}
4582 % \changes{v0.92}{1997/03/03}{added error-handling (AS)}
4583 % The next one is the user-interface for selecting the list-type. It simply
4584 % calls |\thm@thml@|\meta{type}, if the given \meta{type} is defined.
4585 % \begin{macrocode}
4586 \def\theoremlisttype#1{%
4587 \@ifundefined{thm@thml@#1}%
4588 {\PackageError{\basename}{Listtype #1 not defined}\@eha}%
4589 {\csname thm@thml@#1\endcsname}}
4590 % \end{macrocode}
4591 % \end{macro}
4592 % Now, here is the code, which maps the types -- selected by
4593 % |\theoremlisttype| -- to the defined macros.
4594 % \begin{macrocode}
4595 \def\thm@thml@all{\theoremlistall}
4596 \def\thm@thml@opt{\theoremlistoptional}
4597 \def\thm@thml@optname{\theoremlistoptname}
4598 \def\thm@thml@allname{\theoremlistallname}
4599 % \end{macrocode}
4600 %
4601 % \begin{macro}{\newtheoremlisttype}
4602 % \changes{v0.86}{1997/02/15}{added (AS)}
4603 % \changes{v0.92}{1997/03/03}{added error-handling (AS)}
4604 % According to the given documentation, this one can be used to define
4605 % new list-types. It's done by defininig the macro
4606 % |\thm@thml@|\meta{type}, which \emph{locally} redefines
4607 % the commands |\thm@thmlstart|, |\thm@@thmline| and |\thm@@thmlend|.
4608 % \begin{macrocode}
4609 \def\newtheoremlisttype#1#2#3#4{%
4610 \@ifundefined{thm@thml@#1}%
4611 {\expandafter\gdef\csname thm@thml@#1\endcsname{%
4612 \def\thm@@thmlstart{#2}%
4613 \def\thm@@thmline####1####2####3####4{#3}%
4614 \def\thm@@thmlend{#4}}%
4615 }{\PackageError{\basename}{list type #1 already defined}\@eha}}
4616 % \end{macrocode}
4617 % \end{macro}
4618 %
4619 % \begin{macro}{\renewtheoremlisttype}
4620 % \changes{v0.93}{1997/03/12}{introduced newtheoremlisttype (WM)}
4621 % \begin{macrocode}
4622 \def\renewtheoremlisttype#1#2#3#4{%
4623 \@ifundefined{thm@thml@#1}%
4624 {\PackageError{\basename}{List type #1 not defined}\@ehc}{}%
4625 \expandafter\let\csname thm@thml@#1\endcsname\relax
4626 \newtheoremlisttype{#1}{#2}{#3}{#4}}
4627 % \end{macrocode}
4628 % if the list type to be redefined is already defined, make it undefined
4629 % and define it.
4630 % \end{macro}
4631 %
4632 %
4633 % \begin{macro}{\thm@definelthm}
4634 % For each theorem-set, we need to initialize two commands:
4635 % \begin{itemize}
4636 % \item how to typeset entries in the list, |\l@|\meta{theorem-set}.
4637 % it is called for each theorem when the list is generated.
4638 % \item how to typeset additional text in the list,
4639 % |\thm@listdo|\meta{theorem-set}. It is called, when something is
4640 % to a list with |\addtotheoremfile|.
4641 % \end{itemize}
4642 % These macros are initially defined by |\newtheorem| to
4643 % discard the input by calling |\thm@lgobble@entry| (for actual
4644 % entries) and |\thm@lgobble@freetext| (for free text added by the user).
4645 % These macros must be adapted if a package uses another format for
4646 % |\contentsline| entries in the |.aux| file (e.g., |hyperref|).
4647 % \begin{macrocode}
4648 \def\thm@definelthm#1{%
4649 \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble@entry}%
4650 \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble@freetext}}
4651 % \end{macrocode}
4652 % \end{macro}
4653 % \begin{macro}{\thm@inlistdo}
4654 % When additional text is added to a theorem list via |\addtotheoremfile|,
4655 % this is typeset by the following is macro. It simply discards
4656 % the first argument and strips of the outer brackets from the second one.
4657 % \begin{macrocode}
4658 \long\def\thm@inlistdo#1#2{#2}%
4659 % \end{macrocode}
4660 % \end{macro}
4661 %
4662 % \begin{macro}{\listtheorems}
4663 % \changes{v0.89}{1997/02/18}{fixed a bug for lists (AS)}
4664 % \changes{v0.92}{1997/03/02}{made commands global in order to handle
4665 % tabular-lists (AS)}
4666 % The following macro provides the user interface:
4667 % \Codelabel{listtheorems}
4668 % \begin{macrocode}
4669 \def\listtheorems#1{\begingroup
4670 \c@tocdepth=-2%
4671 \def\thm@list{#1}\thm@processlist
4672 \endgroup}
4673 % \end{macrocode}
4674 %
4675 % \begin{packeddescr}
4676 % \item[Line \Coderef{listtheorems}{1}:]
4677 % |#1| is a list of theorem sets, i.e., of the form |Theorem| or
4678 % |Theorem, Definition, ...|.
4679 % \item[Line \Coderef{listtheorems}{2}:] set |tocdepth| to $-2$ to assure
4680 % that the predefined list-types work.
4681 % \item[Line \Coderef{listtheorems}{3}:] store the list of names in |thm@list|
4682 % and call |\thm@processlist|, which actually generates the list.
4683 % \end{packeddescr}
4684 % \end{macro}
4685 % \begin{macro}{\thm@processlist}
4686 %
4687 % \changes{v1.17}{1999/09/06}{Switch to normal contentsline-behaviour for
4688 % lists (hyperref) (AS)}
4689 % \changes{v1.19}{2001/01/13}{check for yet undefined theoremsets (WM)}
4690 % The file \meta{jobname}|.thm| contains commands of the form \\
4691 % \hspace*{0.5cm}
4692 % |\contentsline{|\meta{list-of-theoremsets}|}{{|\meta{header}|}{|\meta{number}|}}{|\meta{page}|}|.\\
4693 % Thus, dependent on which theoremsets should be listed,
4694 % |\contentsline| must be defined to evaluate the first argument and then
4695 % to output all arguments, or to discard the second and third one.
4696 %
4697 % This is done as follows:
4698 % The commands |\l@|\meta{theorem-set} and |\thm@listdo|\meta{theorem-set}
4699 % (which initially were set to ignore everything by |\newtheorem|)
4700 % are redefined for the theorem sets which should be listed to
4701 % generate output.
4702 % |\contentsline| is defined to call |\l@|\meta{theorem-set}, adding a
4703 % line to the list or ignoring the entry.
4704 % Since for theorem sets which are not yet known (i.e., if the list
4705 % is created at the beginning of the document, and the theoremset is
4706 % only defined later), |\l@|\meta{theorem-set} is not yet defined,
4707 % |\contentsline| has to check if the command is defined, otherwise
4708 % ignore the arguments.
4709 %
4710 % Then, the |.thm| file is processed, evaluating the |\contentsline|
4711 % commands.
4712 % After processing the |.thm| file, the mentioned commands are
4713 % again redefined to discard everything. We need to define the macros
4714 % globally for dealing with complex, user-defined, list-types.
4715 %
4716 % \changes{v1.31}{2011/02/14}{split 'thm@lgobble' into 'thm@lgobble@entry'
4717 % and 'thm@lgobble@freetext' (WM, reported by Barbara Santa)}
4718 % \begin{macrocode}
4719 \def\thm@processlist{%
4720 \begingroup
4721 \typeout{** Generating table of \thm@list}%
4722 \def\contentsline##1{%
4723 \expandafter\@ifundefined{l@##1}%
4724 {\thm@lgobble@entry}{\csname l@##1\endcsname}}%
4725 \thm@@thmlstart
4726 \@for\thm@currentlist:=\thm@list
4727 \do{%
4728 \ifx\thm@currentlist\@empty\else
4729 \expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@thmline}%
4730 \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@inlistdo}%
4731 \fi
4732 }%
4733 \@input{\jobname .thm}%
4734 \thm@@thmlend
4735 \@for\thm@currentlist:=\thm@list
4736 \do{%
4737 \ifx\thm@currentlist\@empty\else
4738 \expandafter\gdef\csname l@\thm@currentlist\endcsname
4739 {\thm@lgobble@entry}%
4740 \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname
4741 {\thm@lgobble@freetext}%
4742 \fi
4743 }%
4744 \endgroup}
4745 % \end{macrocode}
4746 % \end{macro}
4747 % \begin{macro}{\thm@enablelistoftheorems}
4748 % \changes{v0.92}{1997/03/02}{renamed (AS)}
4749 % Up to now, we've set up various macros for writing and reading the
4750 % theorem-file.
4751 % Thus, it's time to set up the file itself. This is done by the next macro.
4752 % We simply took the lines for |\@starttoc| from the \LaTeX-base and
4753 % changed some things. The main intention to copy |\@starttoc| is that
4754 % we don't want the file to be input when it is set up -- like it's done
4755 % by |\@starttoc|.
4756 % \begin{macrocode}
4757 \def\thm@enablelistoftheorems{%
4758 \begingroup
4759 \makeatletter
4760 \if@filesw
4761 \expandafter\newwrite\csname tf@thm\endcsname%
4762 \immediate\openout \csname tf@thm\endcsname \jobname.thm\relax%
4763 \fi
4764 \@nobreakfalse
4765 \endgroup}
4766 % \end{macrocode}
4767 % \end{macro}
4768 %
4769 % \begin{macro}{\addtheoremline}
4770 % \changes{v0.89}{1997/02/18}{added (AS)}
4771 % By |\addtheoremline{|\meta{theorem-set}|}{|\meta{entry}|}|,
4772 % the user can insert an extra entry into the theorem-file.
4773 % |\addtheoremline*| calls the internal macro
4774 % |\nonum@addtheoremline|, otherwise |\num@addtheoremline| is called.
4775 % |\num/nonum@addtheoremline{|\meta{theorem-set}|}{|\meta{entry}|}|
4776 % calls
4777 % |\num/nonum@addtheoremline|\meta{theorem-set}|{|\meta{entry}|}|
4778 % which are
4779 % defined when \meta{theorem-set} is declared (cf.\ |\@nthm|).
4780 % These in turn call |\@num/nonum@addtheoremline{|\meta{theorem-set}%
4781 % |}{|\meta{keyword}|}{|\meta{entry}|}|
4782 % which write information to the theorem file.
4783 %
4784 % \begin{macrocode}
4785 \def\addtheoremline{\@ifstar{\nonum@addtheoremline}{\num@addtheoremline}}
4786 \def\nonum@addtheoremline#1{\csname nonum@addtheoremline#1\endcsname}%
4787 \def\num@addtheoremline#1{\csname num@addtheoremline#1\endcsname}%
4788 % \end{macrocode}
4789 % \end{macro}
4790 %
4791 % \begin{macro}{\@nonum@addtheoremline}
4792 % |\@num@addtheoremline| and |\@nonum@addtheoremline| write the
4793 % actual entries to the |.thm| file. \\
4794 % Syntax: |\@num/nonum@addtheoremline{|%
4795 % \meta{theorem-set}|}{|\meta{keyword}|}{|\meta{entry}|}|
4796 % \begin{macrocode}
4797 \def\@nonum@addtheoremline#1#2#3{%
4798 \thm@parseforwriting{#3}%
4799 \edef\thm@t{{#2}{}{\thm@tmp}}%
4800 \addcontentsline{thm}{#1}{\thm@t}}
4801 % \end{macrocode}
4802 % \end{macro}
4803 % \begin{macro}{\@num@addtheoremline}
4804 % \begin{macrocode}
4805 \def\@num@addtheoremline#1#2#3{%
4806 \thm@parseforwriting{#3}%
4807 \edef\thm@t{{#2}{\csname the#1\endcsname}{\thm@tmp}}%
4808 \addcontentsline{thm}{#1}{\thm@t}}%
4809 % \end{macrocode}
4810 % \end{macro}
4811 %
4812 % \begin{macro}{\addtotheoremfile}
4813 % \changes{v0.89}{1997/02/18}{added (AS)}
4814 % To write any additional stuff into the theorem-file, the next macro
4815 % is used. It first checks, if the optional name of a theorem-set is given.
4816 % In that case, the macro |\@@addtotheoremfile|, otherwise
4817 % |\@addtotheoremfile| is used to write the stuff into the file.
4818 % \begin{macrocode}
4819 \long\def\addtotheoremfile{%
4820 \@ifnextchar[{\@@addtotheoremfile}{\@addtotheoremfile}}
4821 % \end{macrocode}
4822 % \end{macro}
4823 % \begin{macro}{\@addtotheoremfile}
4824 % Write additional stuff for all theorems.
4825 % \begin{macrocode}
4826 \long\def\@addtotheoremfile#1{%
4827 \thm@parseforwriting{#1}%
4828 \protected@write\@auxout%
4829 {}{\string\@writefile{thm}{\thm@tmp}}}
4830 % \end{macrocode}
4831 % \end{macro}
4832 % \begin{macro}{\@@addtotheoremfile}
4833 % Write additional stuff for a given theorem-set.
4834 % \begin{macrocode}
4835 \long\def\@@addtotheoremfile[#1]#2{%
4836 \thm@parseforwriting{#2}%
4837 \protected@write\@auxout%
4838 {}{\string\@writefile{thm}{\string\theoremlistdo{#1}{\thm@tmp}}}}
4839 % \end{macrocode}
4840 % \end{macro}
4841 % \begin{macro}{\theoremlistdo}
4842 % \changes{v1.19}{2001/01/13}{check for yet undefined theoremsets (WM)}
4843 % This one is called from the theorem-file to insert the additional
4844 % stuff for a theorem-set.
4845 % \begin{macrocode}
4846 \long\def\theoremlistdo#1#2{\expandafter\@ifundefined{thm@listdo#1}%
4847 \relax{\csname thm@listdo#1\endcsname{#1}{#2}}}
4848 % \end{macrocode}
4849 % \end{macro}
4850 %
4851 % Now we assure, that the theorem-file is activated. This is done by
4852 % inserting a hook at the end of the document.
4853 % \changes{v0.83}{1997/02/13}{added `AtEndDocument'-Hook for lists (AS)}
4854 % \begin{macrocode}
4855 \AtEndDocument{\thm@enablelistoftheorems}
4856 % \end{macrocode}
4857 %
4858 % \paragraph{Theoremlists and Hyperref}
4859 %
4860 % Since the |hyperref|-package redefines |\contentsline|, some
4861 % commands are redefined:
4862 % \begin{enumerate}
4863 % \item Let the different versions of |\thm@@thmline@..| take a 5th
4864 % argument, the one provided by |hyperref|.
4865 % \item handle contentsline: restore the normal
4866 % definition at the beginning of |\thm@processlist| (see there),
4867 % that calls |l@|\meta{theorem-set} that in turn calls the
4868 % adapted commands for typestting the entries (see below). .
4869 % \item Let |\thm@lgobble@entry| take one more argument,
4870 % the one provided by hyperref.
4871 % \item Do the hyperlinks manually in the different versions of
4872 % |\thm@@thmline| as defined by the theoremtypes.
4873 % \end{enumerate}
4874 %
4875 % \begin{macro}{hyperref}
4876 % \changes{v1.17}{1999/09/07}{added 'hyperref' option
4877 % (AS, based on a proposal by Didier Verna)}
4878 % \begin{macrocode}
4879 \DeclareOption{hyperref}{% **********************************************
4880 \def\thm@@thmline@noname#1#2#3#4#5{%
4881 \ifx\\#5\\%
4882 \@dottedtocline{-2}{0em}{2.3em}%
4883 {\protect\numberline{#2}#3}%
4884 {#4}%
4885 \else
4886 \ifHy@linktocpage\relax\relax
4887 \@dottedtocline{-2}{0em}{2.3em}%
4888 {\protect\numberline{#2}#3}%
4889 {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}
4890 \else
4891 \@dottedtocline{-2}{0em}{2.3em}%
4892 {\hyper@linkstart{link}{#5}{\protect\numberline{#2}#3}%
4893 \hyper@linkend}%
4894 {#4}%
4895 \fi
4896 \fi}%
4897 \def\thm@@thmline@name#1#2#3#4#5{%
4898 \ifx\\#5\\%
4899 \@dottedtocline{-2}{0em}{2.3em}%
4900 {#1 \protect\numberline{#2}#3}%
4901 {#4}
4902 \else
4903 \ifHy@linktocpage\relax\relax
4904 \@dottedtocline{-2}{0em}{2.3em}%
4905 {#1 \protect\numberline{#2}#3}%
4906 {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
4907 \else
4908 \@dottedtocline{-2}{0em}{2.3em}%
4909 {\hyper@linkstart{link}{#5}%
4910 {#1 \protect\numberline{#2}#3}\hyper@linkend}%
4911 {#4}%
4912 \fi
4913 \fi}
4914 \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
4915 \long\def\thm@lgobble@entry#1#2#3{\ignorespaces}
4916 \def\theoremlistoptional{%
4917 \let\thm@@thmlstart=\relax
4918 \let\thm@@thmlend=\relax
4919 \def\thm@@thmline##1##2##3##4##5{%
4920 \ifx\empty ##3%
4921 \else%
4922 \thm@@thmline@noname{##1}{##2}{##3}{##4}{##5}%
4923 \fi}}
4924 \def\theoremlistoptname{%
4925 \let\thm@@thmlstart=\relax
4926 \let\thm@@thmlend=\relax
4927 \def\thm@@thmline##1##2##3##4##5{%
4928 \ifx\empty ##3%
4929 \else%
4930 \thm@@thmline@name{##1}{##2}{##3}{##4}{##5}%
4931 \fi}}
4932 % \end{macrocode}
4933 % \changes{v1.20}{2002/01/07}{replaced ifhy by ifHy (AS, reported by J.J.Bataille)}
4934 % \end{macro}
4935 %
4936 % \paragraph{Theorem References and Hyperref}
4937 %
4938 % \begin{macro}{hyperref-thref}
4939 % When |hyperref| is active, the handling of |thref| described above via
4940 % the |.aux| file redefinition of |\@newl@bel| is not possible (|hyperref|
4941 % forces its definitions at |\AtBeginDocument|). Instead, an internal
4942 % identifier of the form |Theorem.1.1| is used in the |.aux| file for
4943 % the hypertarget (using the type of the counter; thus when a theorem type
4944 % uses another counter, this does not give the theorem type itself).
4945 % The same id is stored in the |.thm| file for
4946 % the respective theorem. by this, given the id from the |\newlabel| in
4947 % the |.aux| file, the |.thm| file can be searched for the actual type
4948 % information.
4949 %
4950 % \changes{v1.31}{2011/02/15}{added for fixing problems (WM, reported by
4951 % Gunner Gewiss)}
4952 % \Codelabel{hyperthref}
4953 % \begin{macrocode}
4954 \if@thref
4955 \def\@firstofthree#1#2#3{#1}%
4956 \def\getKeywordOf#1{%
4957 \let\thm@oldcontentsline\contentsline
4958 \def\contentsline##1##2##3##4{%
4959 \ifthenelse{\equal{#1}{##4}}{\@firstofthree##2}{}%
4960 \ignorespaces}%
4961 \@input{\jobname .thm}%
4962 \let\contentsline\thm@oldcontentsline
4963 }
4964 \def\thm@fmt@hyplabel@i#1#2#3#4#5{%
4965 \getKeywordOf{#4}~\thm@fmt@hyplabel@ii#4}
4966 \def\thm@fmt@hyplabel@ii#1.#2{#2}%
4967 \def\thref#1{%
4968 \expandafter\@setref\csname r@#1\endcsname\thm@fmt@hyplabel@i{#1}}%
4969 \fi % end of \if@thref
4970 }% end of option hyperref *********************************************
4971 % \end{macrocode}
4972 % \begin{packeddescr}
4973 % \item[Lines \Coderef{hyperthref}{2}-\Coderef{hyperthref}{10}:]
4974 % given an id |#1| of the form |Theorem.1.1|, scan the |.thm| file
4975 % for a |\contentsline| whose 4th argument equals the id. If found,
4976 % the third component of its second argument gives its theorem type.
4977 % \item[Lines \Coderef{hyperthref}{11}-\Coderef{hyperthref}{13}:]
4978 % this command must have 5 arguments because it is applied to
4979 % the information stored with |\newlabel| in the |.aux| file. The
4980 % 4th argument is the id |#4| of the form |Theorem.1.1|. \\
4981 % Get the correct keyword by |\getKeywordOf{#4}| and its number
4982 % (which is the part following the first ``.'').
4983 % \item[Lines \Coderef{hyperthref}{14}-\Coderef{hyperthref}{15}:]
4984 % create a hyperlink via |\@setref| (see |hyperref.sty|): |\@setref|
4985 % takes three arguments: |r@|\meta{label} := $arg_1$ is the information
4986 % from |\newlabel| in the |.aux| file (consisting of 5 components).
4987 % The 2nd argument $arg_2$ must be a command that uses 5 arguments,
4988 % here |\thm@fmt@hyplabel@i{#1}| as defined in Lines
4989 % \Coderef{hyperthref}{11}-\Coderef{hyperthref}{13}. The
4990 % 3rd one is the label, and is only used for error messages.
4991 % |\@setref| then --roughly-- applies $arg_2$ on $arg_1$.
4992 % \end{packeddescr}
4993 % \end{macro}
4994 %
4995 % \subsubsection{Auxiliary macros}
4996 %
4997 % For generating theorem-lists, we need to write information into
4998 % a separate file. Beause we don't want to expand this information,
4999 % we parse it specially for writing.
5000 % \begin{macrocode}
5001 \def\thm@meaning#1->#2\relax{#2}% remove "macro: ->"
5002 \long\def\thm@parseforwriting#1{%
5003 \def\thm@tmp{#1}%
5004 \edef\thm@tmp{\expandafter\thm@meaning\meaning\thm@tmp\relax}}
5005 % \end{macrocode}
5006 %
5007 % In some countries it's usual to number theorems with greek letters:
5008 %
5009 % \begin{macro}{\theorem@checkbold}
5010 % \changes{v0.83}{1997/02/13}{fixed greek numbering for bold headers (AS)}
5011 % For correctness, we need to check if a bold font is active. This
5012 % is done by the following macro:
5013 % \begin{macrocode}
5014 \def\theorem@checkbold{\if b\expandafter\@car\f@series\@nil\boldmath\fi}
5015 % \end{macrocode}
5016 % \end{macro}
5017 % \begin{macro}{\@greek}
5018 % Accoding to \LaTeX-base, this is the internal command for generating
5019 % lowercase greek numberings.
5020 % \begin{macrocode}
5021 \def\@greek#1{\theorem@checkbold%
5022 \ifcase#1\or$\alpha$\or$\beta$\or$\gamma$\or$\delta$\or$\varepsilon$%
5023 \or$\zeta$\or$\eta$\or$\vartheta$\or$\iota$\or$\kappa$\or$\lambda$\or$%
5024 \mu$\or$\nu$\or$\xi$\or$ o$\or$\varpi$\or$\varrho$\or$\varsigma$\or$\tau$%
5025 \or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or$\omega$\else\@ctrerr\fi}
5026 % \end{macrocode}
5027 % \end{macro}
5028 % \begin{macro}{\@Greek}
5029 % According to \LaTeX-base, this is the internal command for generating
5030 % uppercase greek numberings.
5031 % \begin{macrocode}
5032 \def\@Greek#1{\theorem@checkbold%
5033 \ifcase#1\or A\or B\or$\Gamma$\or$\Delta$\or E%
5034 \or Z\or H\or$\Theta$\or I\or K\or$\Lambda$\or M%
5035 \or N\or$\Xi$\or O\or$\Pi$\or P\or$\Sigma$\or T%
5036 \or$\Upsilon$\or$\Phi$\or X\or$\Psi$\or$\Omega$\else\@ctrerr\fi}
5037 % \end{macrocode}
5038 % \end{macro}
5039 % \begin{macro}{\greek}
5040 % According to \LaTeX-base, this is the user interface for lowercase
5041 % greek numberings.
5042 % \begin{macrocode}
5043 \def\greek#1{\@greek{\csname c@#1\endcsname}}
5044 % \end{macrocode}
5045 % \end{macro}
5046 % \begin{macro}{\Greek}
5047 % According to \LaTeX-base, this is the user interface for uppercase
5048 % greek numberings.
5049 % \begin{macrocode}
5050 \def\Greek#1{\@Greek{\csname c@#1\endcsname}}
5051 % \end{macrocode}
5052 % \end{macro}
5053 %
5054 % \subsubsection{Other Things}
5055 %
5056 % After declaring several package-options, we need to process the
5057 % specified ones. The additional |\relax| was mentioned by Rainer Sch\"opf
5058 % at DANTE'97.
5059 % \begin{macrocode}
5060 \ProcessOptions\relax
5061 % \end{macrocode}
5062 % Now we set up the default theorem listtype. Make sure this is called after
5063 % processing the options. Otherwise, |ntheorem| will break with |hyperref|.
5064 % \begin{macrocode}
5065 \theoremlistall
5066 % \end{macrocode}
5067 %
5068 % If automatical configuration is not disabled by |[noconfig]|, it is
5069 % checked if the file |ntheorem.cfg| exists and in this case
5070 % the definitions in this file are read. If it does not exist and the
5071 % option |standard| was specified, the file |ntheorem.std| is used.
5072 %
5073 % \changes{v0.84}{1997/02/13}{added 'ntheorem.cfg' feature (AS)}
5074 % \changes{v1.11}{1998/10/26}{added 'noconfig' option (AS/WM)}
5075 % \begin{macrocode}
5076 \ifx\thm@noconfig\@undefined
5077 \InputIfFileExists{ntheorem.cfg}%
5078 {\PackageInfo{\basename}{Local config file ntheorem.cfg used}}%
5079 {\ifx\thm@usestd\@undefined%
5080 \else%
5081 \InputIfFileExists{ntheorem.std}%
5082 {\PackageInfo{\basename}{Standard config file ntheorem.std used}}{}
5083 \fi}
5084 \fi
5085 % \end{macrocode}
5086 %\iffalse
5087 %</package>\fi
5088 %
5089 % \subsection{The Standard Configuration}
5090 %
5091 % \changes{v0.84}{1997/02/13}{moved standard-theorems to extra file (AS)}
5092 % \setcounter{CodelineNo}{0}
5093 %\iffalse
5094 %<*standard>\fi
5095 % \begin{macrocode}
5096 \theoremnumbering{arabic}
5097 \theoremstyle{plain}
5098 \RequirePackage{latexsym}
5099 \theoremsymbol{\ensuremath{_\Box}}
5100 \theorembodyfont{\itshape}
5101 \theoremheaderfont{\normalfont\bfseries}
5102 \theoremseparator{}
5103 \newtheorem{Theorem}{Theorem}
5104 \newtheorem{theorem}{Theorem}
5105 \newtheorem{Satz}{Satz}
5106 \newtheorem{satz}{Satz}
5107 \newtheorem{Proposition}{Proposition}
5108 \newtheorem{proposition}{Proposition}
5109 \newtheorem{Lemma}{Lemma}
5110 \newtheorem{lemma}{Lemma}
5111 \newtheorem{Korollar}{Korollar}
5112 \newtheorem{korollar}{Korollar}
5113 \newtheorem{Corollary}{Corollary}
5114 \newtheorem{corollary}{Corollary}
5115
5116 \theorembodyfont{\upshape}
5117 \newtheorem{Example}{Example}
5118 \newtheorem{example}{Example}
5119 \newtheorem{Beispiel}{Beispiel}
5120 \newtheorem{beispiel}{Beispiel}
5121 \newtheorem{Bemerkung}{Bemerkung}
5122 \newtheorem{bemerkung}{Bemerkung}
5123 \newtheorem{Anmerkung}{Anmerkung}
5124 \newtheorem{anmerkung}{Anmerkung}
5125 \newtheorem{Remark}{Remark}
5126 \newtheorem{remark}{Remark}
5127 \newtheorem{Definition}{Definition}
5128 \newtheorem{definition}{Definition}
5129
5130 \theoremstyle{nonumberplain}
5131 \theoremheaderfont{\scshape}
5132 \theorembodyfont{\normalfont}
5133 \theoremsymbol{\ensuremath{_\blacksquare}}
5134 \RequirePackage{amssymb}
5135 \newtheorem{Proof}{Proof}
5136 \newtheorem{proof}{Proof}
5137 \newtheorem{Beweis}{Beweis}
5138 \newtheorem{beweis}{Beweis}
5139 \qedsymbol{\ensuremath{_\blacksquare}}
5140 \theoremclass{LaTeX}
5141 % \end{macrocode}
5142 %\iffalse
5143 %</standard>\fi
5144 %
5145 % \section{History and Acknowledgements}
5146 %
5147 % \subsection{The endmark-Story (Wolfgang May)}
5148 %
5149 % In 1995, I started a hack for setting endmarks semiautomatically
5150 % at the end of displayed formulas.
5151 % The work on |thmmarks.sty| begun in October 1996
5152 % by a thread asking for a routine for setting endmarks in
5153 % \emph{de.comp.tex}
5154 % initiated by Boris Piwinger.
5155 % Version 0.1 incorporated the main features for setting endmarks
5156 % automagically by using the |.aux| file. Version 0.2 included
5157 % some bugfixes and was the first one accessible on the internet.
5158 % Boris suggested to include |fleqn| and |leqno| which has been
5159 % done in version 0.3 (which was never made public).
5160 % Since at this point, |thmmarks.sty| was incompatible to the widely
5161 % used |theorem.sty| written by Frank Mittelbach, in Version 0.4,
5162 % the features of theorem.sty have been integrated.
5163 %
5164 % With version 0.5, the case of ``empty'' end symbols has been handled,
5165 % |\qed| has been added (also suggested by Boris), and
5166 % the handling of theoremstyles by |\newtheoremstyle| has been
5167 % included.
5168 %
5169 % For version 0.6, the handling of endmarks in displaymaths has been
5170 % changed in order to adjust them with the bottom of the displayed
5171 % math.
5172 %
5173 % Version 0.6 was the first one announced in \emph{comp.text.tex}.
5174 % For version 0.7, I added the handling of |amsmath| features,
5175 % suggested by my colleague Peter Neuhaus.
5176 %
5177 % Versions 0.71 and 0.72 incorporated minor bugfixes.
5178 %
5179 % \subsection{Lists, Lists, Lists (Andreas Schedler)}
5180 %
5181 % I often saw questions on theoremlists in the
5182 % german newsgroup \emph{de.comp.text.tex}, but I never
5183 % spent any attention on those postings. This changed in
5184 % summer 1996, when I needed those lists for myself. Thus, I
5185 % asked the holy question. But none of the given answers
5186 % satisfied my wish for a simple, easy to use and short
5187 % solution.
5188 %
5189 % I decided to take a look at Frank Mittelbachs
5190 % |theorem.sty|. First I didn't understand much of the code,
5191 % but Bernd Raichle helped me a lot by answering my
5192 % boring questions and I finally understood it.
5193 %
5194 % I started the coding and within a few days, a first
5195 % experimental version was born. Not only that I had implemented
5196 % the lists, I also inserted a separator and a flexible numbering
5197 % of the theorems.
5198 %
5199 % After a long period of
5200 % testing, I wanted to share the new features with other
5201 % \TeX-Freaks and wrote an article for the ``Die \TeX nische Kom\"odie''
5202 % (Journal of german tug, DANTE e.V.). As soon as I had sent
5203 % the article to DANTE, I got first reactions on the style.
5204 % Gerd Neugebauer gave me many hints. I hided several
5205 % cryptical notations in easy definitions and improved the
5206 % user interface.
5207 %
5208 % In January 1997, I released ``newthm'' to the world and it
5209 % was uploaded to the CTAN-Archives. Few days later I sent
5210 % my files to Frank Mittelbach in order to show him my extensions.
5211 % He told me, that already other extensions were made, and that
5212 % it would be good to combine alltogether.
5213 %
5214 % \subsection{Let's come together}
5215 %
5216 % With version 0.8, in February 1997, the combination of
5217 % |thmmarks.sty| with |newthm.sty| to |ntheorem.sty| has been started.
5218 % On April 21, 1997, version 0.94 beta has been made public as
5219 % version 1.0.
5220 %
5221 % In course of the development, the following changes were made:
5222 %
5223 % \GlossaryPrologue{}
5224 %
5225 % \IfFileExists{ntheorem.gls}{\PrintChanges}
5226 % {\begin{quote}You should create the list of changes by
5227 %
5228 % ~~~ \texttt{makeindex -s gglo.ist -o ntheorem.gls ntheorem.glo}
5229 %
5230 % and running \texttt{latex ntheorem.drv} again.\end{quote}}
5231 %
5232 %
5233 % \subsection{Acknowledgements}
5234 %
5235 % This place is dedicated to all those, who helped us developing
5236 % our separate styles and this combined package. Thanks to
5237 % (listed in alphabetical order):
5238 % \begin{quote}
5239 % Donald Arseneau,
5240 % Giovanni Dore,
5241 % Oliver Karch,
5242 % Frank Mittelbach,
5243 % Gerd Neugebauer,
5244 % Heiko Oberdiek,
5245 % Boris Piwinger,
5246 % Bernd Raichle,
5247 % Rainer Sch\"opf,
5248 % Didier Verna.
5249 % \end{quote}
5250 %
5251 % \Finale
5252 \endinput
5253
5254 % Local Variables:
5255 % TeX-command-default: "LaTeX"
5256 % TeX-master: t
5257 % End:
5258 % mode: latex