2 %% This is file `ntheorem.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% ntheorem.dtx (with options: `package')
10 %% ### WARNING: =============================================================
12 %% This file is a patched version that works (it seems) with hyperref.
13 %% Hyperref's \contentsline version breaks with ntheorem because it puts 3
14 %% arguments in the text field (e.g.: \contentsline{def}{{def}{1}{foo}}{21})
16 %% To work around the problem, the following steps are implemented:
17 %% 1/ Don't use hyperref's contentsline: restore the normal definition at the
18 %% beginning of \thm@processlist.
19 %% 2/ Let the different versions of \thm@@thmline take a 5th argument, the one
20 %% provided by hyperref.
21 %% 3/ Let \thm@lgobble take a 3rd argument, the one provided by hyperref.
22 %% 4/ Do the hyperlinks manually in the different versions of \thm@@thmline
24 %% You'll find comments starting with `%%DV' around my changes in the code.
27 %% Didier Verna <verna@inf.enst.fr>
29 %% ==========================================================================
33 %% For the copyright see the source file.
35 %% Any modified versions of this file must be renamed
36 %% with new filenames distinct from ntheorem.sty.
38 %% For distribution of the original source see the terms
39 %% for copying and modification in the file ntheorem.dtx.
41 %% This generated file may be distributed as long as the
42 %% original source files, as listed above, are part of the
43 %% same distribution. (The sources need not necessarily be
44 %% in the same archive or directory.)
45 \def\filedate{1998/12/03}
46 \def\docdate{1998/12/03}
47 \def\fileversion{1.14}
48 \def\basename{ntheorem-hyper}
50 %% {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
51 %% 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
52 %% Digits \0\1\2\3\4\5\6\7\8\9
53 %% Exclamation \! Double quote \" Hash (number) \#
54 %% Dollar \$ Percent \% Ampersand \&
55 %% Acute accent \' Left paren \( Right paren \)
56 %% Asterisk \* Plus \+ Comma \,
57 %% Minus \- Point \. Solidus \/
58 %% Colon \: Semicolon \; Less than \<
59 %% Equals \= Greater than \> Question mark \?
60 %% Commercial at \@ Left bracket \[ Backslash \\
61 %% Right bracket \] Circumflex \^ Underscore \_
62 %% Grave accent \` Left brace \{ Vertical bar \|
63 %% Right brace \} Tilde \~}
64 \typeout{Style `\basename', Version \fileversion\space <\filedate>}
65 \ProvidesPackage{ntheorem-hyper}[\filedate \space\fileversion]
66 \newif\if@thmmarks\@thmmarksfalse
68 \DeclareOption{thmmarks}{%*********************************
69 \PackageInfo{\basename}{Option `thmmarks' loaded}%
71 \newcounter{endNonectr}
72 \newcounter{currNonectr}
73 \newif\ifsetendmark\setendmarktrue
75 \@endtrivlist{\PotEndMark{\hbox{}\nobreak\hfill\nobreak}}}
76 \gdef\@endtrivlist#1{% % from \endtrivlist
77 \if@inlabel \indent\fi
78 \if@newlist \@noitemerr\fi
80 \ifdim\lastskip >\z@ #1\unskip \par %<<<<<<<<<<<<<<<<<<<<<<
81 \else \unskip \par \fi
85 \@tempskipa\lastskip \vskip -\lastskip
86 \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
91 \gdef\SetMark@endeqn{\quad}% as default, cf. option leqno
92 \gdef\endequation{\eqno \hbox{\@eqnnum \PotEndMark{\SetMark@endeqn}}%
93 $$\global\@ignoretrue}
100 \makebox[.6\linewidth]%
102 $$\stepcounter{end\InTheoType ctr}%
103 \@ifundefined{mark\roman{curr\InTheoType ctr}%
104 \InTheoType\roman{end\InTheoType ctr}}{\relax}%
105 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
106 \boxmaxdepth=.5ex\begin{array}[b]{l}%
107 \boxmaxdepth=\maxdimen\displaystyle\fi}%
108 \addtocounter{end\InTheoType ctr}{-1}%
109 %%$$ BRACE MATCH HACK
112 \stepcounter{end\InTheoType ctr}%
113 \@ifundefined{mark\roman{curr\InTheoType ctr}%
114 \InTheoType\roman{end\InTheoType ctr}}{\relax}%
115 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
117 \addtocounter{end\InTheoType ctr}{-1}%
122 \PotEndMark{\eqno}\global\@ignoretrue$$%%$$ BRACE MATCH HACK
128 \gdef\SetMark@endeqnarray#1{\llap{\raisebox{-1.3em}{#1}}}
130 \global\let\Oldeqnnum=\@eqnnum
131 \gdef\@eqnnum{\Oldeqnnum\PotEndMark{\SetMark@endeqnarray}}%
134 \global\advance\c@equation\m@ne
135 $$\global\@ignoretrue
136 \global\let\@eqnnum\Oldeqnnum}
137 \@namedef{endeqnarray*}{%
139 \let\reserved@a\relax
140 \ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
141 \or \def\reserved@a{&}\else
142 \let\reserved@a\@empty
143 \@latex@error{Too many columns in eqnarray environment}\@ehc\fi
144 \reserved@a {\normalfont \normalcolor \PotEndMark{}}%
145 \global\@eqnswtrue\global\@eqcnt\z@\cr
148 \global\advance\c@equation\m@ne
149 $$\global\@ignoretrue}
151 \PotEndMark{\`}\@stopline\ifnum\@tabpush >\z@ \@badpoptabs
155 {\PotEndMark{\rightskip0pt%
156 \settowidth{\leftskip}%
157 { \csname mark\roman{curr\InTheoType ctr}\InTheoType
158 \roman{end\InTheoType ctr}\endcsname}%
159 \advance\leftskip\@flushglue\hskip\@flushglue}}}
163 \ifx\csname\InTheoType Symbol\endcsname\@empty\setendmarkfalse\fi
166 \hbox{}\nobreak\hfill\nobreak\csname\InTheoType Symbol\endcsname
167 \setendmarkfalse \fi}%
168 \ifsetendmark\OrganizeTheoremSymbol\else\global\setendmarktrue\fi}
169 \gdef\NoEndMark{\global\setendmarkfalse}
170 \gdef\qed{\expandafter\def\csname \InTheoType Symbol\endcsname
172 \gdef\PotEndMark#1{\SetEndMark{\InTheoType}{#1}}%
173 \gdef\SetEndMark#1#2{%
174 \stepcounter{end#1ctr}%
175 \@ifundefined{mark\roman{curr#1ctr}#1\roman{end#1ctr}}%
177 {#2{\csname mark\roman{curr#1ctr}#1\roman{end#1ctr}\endcsname}}}%
184 \vskip\mysavskip \else\fi}
186 \gdef\OrganizeTheoremSymbol{%
188 \edef\thm@tmp{\expandafter\expandafter\expandafter\thm@meaning
189 \expandafter\meaning\csname\InTheoType Symbol\endcsname\relax}%
190 \protected@write\@auxout{}%
191 {\string\global\string\def\string\mark%
192 \roman{curr\InTheoType ctr}\InTheoType \roman{end\InTheoType ctr}%
195 } % end of option [thmmarks]
196 \DeclareOption{leqno}{%
198 \PackageInfo{\basename}{Option `leqno' loaded}%
199 \gdef\SetMark@endeqn#1{\hss\llap{#1}}
200 \gdef\SetMark@endeqnarray#1{\hss\llap{#1}}
202 \DeclareOption{fleqn}{%
204 \PackageInfo{\basename}{Option `fleqn' loaded}%
205 \renewcommand\[{\relax
209 \@beginparpenalty\predisplaypenalty
210 \@endparpenalty\postdisplaypenalty
212 \hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
213 \hskip\mathindent\bgroup
214 \stepcounter{end\InTheoType ctr}%
215 \@ifundefined{mark\roman{curr\InTheoType ctr}%
216 \InTheoType\roman{end\InTheoType ctr}}{\relax}%
217 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
218 \boxmaxdepth=.5ex\begin{array}[b]{l}%
219 \boxmaxdepth=\maxdimen\displaystyle\fi}%
220 \addtocounter{end\InTheoType ctr}{-1}%
223 \stepcounter{end\InTheoType ctr}%
224 \@ifundefined{mark\roman{curr\InTheoType ctr}%
225 \InTheoType\roman{end\InTheoType ctr}}{\relax}%
226 {\ifx\csname\InTheoType Symbol\endcsname\@empty\else
228 \addtocounter{end\InTheoType ctr}{-1}%
230 \egroup $\hfil\PotEndMark{}% $
237 \displaywidth\linewidth\hbox{\@eqnnum \PotEndMark{\SetMark@endeqn}}%
241 \global\let\Oldeqnnum=\@eqnnum
242 \gdef\@eqnnum{\Oldeqnnum\PotEndMark{\SetMark@endeqnarray}}%
245 \global\advance\c@equation\m@ne$$% $$
247 \global\let\@eqnnum\Oldeqnnum}
248 \fi}% end of option fleqn
249 \DeclareOption{amsmath}{%
251 \PackageInfo{\basename}{Option `amsmath' loaded}%
252 \newdimen\thm@amstmpdepth
253 \gdef\TagsPlusEndmarks{%
254 \global\let\Old@maketag@@@=\maketag@@@
255 \global\let\Old@df@tag=\df@tag
256 \if@eqnsw\SetTagPlusEndMark\else
257 \iftag@\SetTagPlusEndMark
260 \gdef\SetOnlyEndMark{%
264 to \displaywidth{\hss\PotEndMark{\maketag@@@}}}%
266 \gdef\df@tag{\PotEndMark{\maketag@@@}}%
268 \gdef\SetTagPlusEndMark{%
270 \gdef\maketag@@@##1{%
271 \hbox to \displaywidth{\m@th\normalfont##1%
274 \gdef\maketag@@@##1{\hbox{\m@th\normalfont##1%
275 \llap{\hss\PotEndMark{\raisebox{-1.3em}}}}}%
278 \global\let\maketag@@@=\Old@maketag@@@
279 \global\let\df@tag=\Old@df@tag}
281 \TagsPlusEndmarks % <<<<<<<<<
286 \RestoreTags % <<<<<<<<<
288 \expandafter\let\csname endgather*\endcsname\endgather
290 \ifingather@\else % <<<<<<<<<
291 \TagsPlusEndmarks\fi % <<<<<<<<<
302 \RestoreTags % <<<<<<<<<
305 \expandafter\let\csname endalign*\endcsname\endalign
306 \let\endxalignat\endalign
307 \expandafter\let\csname endxalignat*\endcsname\endalign
308 \let\endxxalignat\endalign
309 \let\endalignat\endalign
310 \expandafter\let\csname endalignat*\endcsname\endalign
311 \let\endflalign\endalign
312 \expandafter\let\csname endflalign*\endcsname\endalign
314 \@eqnswfalse\tag@true\tagsleft@false
317 \TagsPlusEndmarks % <<<<<<<<<
328 \hbox{\strut@\make@display@tag}%
331 \hskip\multlinetaggap
341 \RestoreTags} % <<<<<<<<<
343 \relax\ifmmode% \RIfM@ <<<<<<<<<<<<<<<<<<<<<<<<<<<<
350 \def\\{\@amsmath@err{\Invalid@@\\}\@eha}%
352 \halign to \displaywidth\bgroup
353 \if@fleqn\else\hfil\fi
354 \setboxz@h{$\m@th\displaystyle{####}$}%
355 \global\totwidth@\wdz@
356 \global\thm@amstmpdepth\dp0% <<<<<<<<<<<<
358 \tabskip 0pt plus 1000pt%<<<<<<<<<<<<<<
359 & ####% <<<<<<<<<<<<<<<<<<<<<<<<
366 \relax\ifmmode% \RIfM@ <<<<<<<<<<
368 \PotEndMark{&\raisebox{-\thm@amstmpdepth}}% <<<<<<<<<
378 \def\equation{\gather\def\\{\@amsmath@err{\Invalid@@\\}\@eha}}
379 \def\endequation{\endgather}
380 \renewenvironment{equation*}{\equation}{\nonumber\endequation}
381 \else\PackageError{\basename}{Option amsmath cannot be used without
382 option thmmarks.}\@eha
384 }% end of option amsmath
385 \let\thm@usestd\@undefined
386 \DeclareOption{standard}{\let\thm@usestd\relax}
387 \let\thm@noconfig\@undefined
388 \DeclareOption{noconfig}{\let\thm@noconfig\relax}
389 \gdef\InTheoType{None}
390 \def\output@None{None}
392 \gdef\newtheoremstyle#1#2#3{%
393 \expandafter\@ifundefined{th@#1}%
394 {\expandafter\gdef\csname th@#1\endcsname{%
395 \def\@begintheorem####1####2{#2}%
396 \def\@opargbegintheorem####1####2####3{#3}}}%
397 {\PackageError{\basename}{Theorem style #1 already defined}\@eha}}
398 \gdef\renewtheoremstyle#1#2#3{%
399 \expandafter\@ifundefined{th@#1}%
400 {\PackageError{\basename}{Theorem style #1 undefined}\@ehc}%
402 \expandafter\let\csname th@#1\endcsname\relax
403 \newtheoremstyle{#1}{#2}{#3}}
404 \newtheoremstyle{plain}%
405 {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
406 {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)\theorem@separator]}
407 \newtheoremstyle{break}%
408 {\item\hbox to \textwidth{\theorem@headerfont ##1\
409 ##2\theorem@separator\hfill}}%
410 {\item\hbox to \textwidth{\theorem@headerfont ##1\ ##2\
411 (##3)\theorem@separator\hfill}}
412 \newtheoremstyle{change}%
413 {\item[\hskip\labelsep \theorem@headerfont ##2\ ##1\theorem@separator]}%
414 {\item[\hskip\labelsep \theorem@headerfont ##2\ ##1\ (##3)\theorem@separator]}
415 \newtheoremstyle{changebreak}%
416 {\item\hbox to \textwidth{\theorem@headerfont ##2\
417 ##1\theorem@separator\hfill}}%
418 {\item\hbox to \textwidth{\theorem@headerfont ##2\ ##1\
419 (##3)\theorem@separator\hfill}}
420 \newtheoremstyle{margin}%
421 {\item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\theorem@separator]}%
422 {\item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\ (##3)\theorem@separator]}
423 \newtheoremstyle{marginbreak}%
424 {\item\hbox to \textwidth{\theorem@headerfont \llap{##2}\hskip\labelsep
425 ##1\theorem@separator\hfill}}%
426 {\item\hbox to \textwidth{\theorem@headerfont
427 \llap{##2}\hskip\labelsep
428 ##1\ (##3)\theorem@separator\hfill}}
429 \newtheoremstyle{nonumberplain}%
430 {\item[\theorem@headerfont\hskip\labelsep ##1\theorem@separator]}%
431 {\item[\theorem@headerfont\hskip \labelsep ##1\ (##3)\theorem@separator]}
432 \newtheoremstyle{nonumberbreak}%
433 {\item\hbox to \textwidth{\theorem@headerfont\hskip\labelsep
434 ##1\theorem@separator\hfill}}%
435 {\item\hbox to \textwidth{\theorem@headerfont\hskip\labelsep
436 ##1\ (##3)\theorem@separator\hfill}}
437 \newtheoremstyle{empty}%
439 {\item\hbox to \textwidth{\theorem@headerfont##3\hfill}}
440 \@namedef{th@nonumbermargin}{\th@nonumberplain}
441 \@namedef{th@nonumberchange}{\th@nonumberplain}
442 \@namedef{th@nonumbermarginbreak}{\th@nonumberbreak}
443 \@namedef{th@nonumberchangebreak}{\th@nonumberbreak}
444 \@namedef{th@plainNo}{\th@nonumberplain}
445 \@namedef{th@breakNo}{\th@nonumberplain}
446 \@namedef{th@marginNo}{\th@nonumberplain}
447 \@namedef{th@changeNo}{\th@nonumberplain}
448 \@namedef{th@marginbreakNo}{\th@nonumberbreak}
449 \@namedef{th@changebreakNo}{\th@nonumberbreak}
450 \gdef\theoremstyle#1{%
451 \@ifundefined{th@#1}{\@warning
452 {Unknown theoremstyle `#1'. Using `plain'}%
453 \theorem@style{plain}}%
454 {\theorem@style{#1}}}
455 \newtoks\theorem@style
456 \newtoks\theorem@@style
457 \global\theoremstyle{plain}
458 \newtoks\theorembodyfont
459 \global\theorembodyfont{\itshape}
460 \newtoks\theoremnumbering
461 \global\theoremnumbering{arabic}
462 \newskip\theorempreskipamount
463 \newskip\theorempostskipamount
464 \global\theorempreskipamount\topsep
465 \global\theorempostskipamount\topsep
466 \newdimen\theoremindent
467 \global\theoremindent0cm
468 \newdimen\theorem@indent
469 \newtoks\theoremheaderfont
470 \global\theoremheaderfont{\normalfont\bfseries}
471 \def\theorem@headerfont{\normalfont\bfseries}
472 \newtoks\theoremseparator
473 \global\theoremseparator{}
474 \def\theorem@separator{}
475 \newtoks\theoremsymbol
476 \global\theoremsymbol{}
479 \DeclareOption{amsthm}{%
480 \PackageInfo{\basename}{Option `amsthm' loaded}%
481 \def\swapnumbers{\PackageError{\basename}{swapnumbers not implemented.
482 Use theoremstyle change instead.}\@eha}
485 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
486 \def\@begintheorem##1##2{%
487 \item[\hskip\labelsep \theorem@headerfont ##1\ ##2.]}%
488 \def\@opargbegintheorem##1##2##3{%
489 \item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3).]}}
490 \gdef\th@nonumberplain{%
491 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
492 \def\@begintheorem##1##2{%
493 \item[\hskip\labelsep \theorem@headerfont ##1.]}%
494 \def\@opargbegintheorem##1##2##3{%
495 \item[\hskip\labelsep \theorem@headerfont ##1\ (##3).]}}
496 \gdef\th@definition{%
497 \th@plain\def\theorem@headerfont{\normalfont\bfseries}\itshape}
498 \gdef\th@nonumberdefinition{%
499 \th@nonumberplain\def\theorem@headerfont{\normalfont\bfseries}\itshape}
501 \th@plain\def\theorem@headerfont{\itshape}\normalfont}
502 \gdef\th@nonumberremark{%
503 \th@nonumberplain\def\theorem@headerfont{\itshape}\normalfont}
506 \newcounter{currproofctr}%
507 \newcounter{endproofctr}%
509 \newcommand{\openbox}{\leavevmode
512 \vbox to.675em{\hrule width.6em\vfil\hrule}%
514 \gdef\proofSymbol{\openbox}
515 \newcommand{\proofname}{Proof}
516 \newenvironment{proof}[1][\proofname]{
518 \def\theorem@headerfont{\itshape}%
520 \theoremsymbol{\ensuremath{_\blacksquare}}
521 \@thm{proof}{proof}{#1}}%
523 }% end of option amsthm
524 \newskip\thm@topsepadd
527 {\edef\@tempa{{nonumber\the\theorem@style}}%
528 \expandafter\theorem@@style\@tempa}%
529 {\edef\@tempa{{\the\theorem@style}}%
530 \expandafter\theorem@@style\@tempa}%
535 {\edef\@tempa{{nonumber\the\theorem@style}}%
536 \expandafter\theorem@@style\@tempa}%
537 {\edef\@tempa{{\the\theorem@style}}%
538 \expandafter\theorem@@style\@tempa}%
540 \gdef\@newtheorem#1{%
542 \expandafter\@ifdefinable\csname #1\endcsname
543 {\expandafter\@ifdefinable\csname #1*\endcsname
545 \thm@definelthm{#1}% for lists
547 \expandafter\@ifundefined{c@curr#1ctr}%
548 {\newcounter{curr#1ctr}}{}%
549 \expandafter\@ifundefined{c@end#1ctr}%
550 {\newcounter{end#1ctr}}{}%
552 \expandafter\xdef\csname #1Symbol\endcsname{\the\theoremsymbol}%
553 \expandafter\gdef\csname#1\endcsname{%
554 \let\thm@starredenv\@undefined
555 \csname mkheader@#1\endcsname}%
556 \expandafter\gdef\csname#1*\endcsname{%
557 \let\thm@starredenv\relax
558 \csname mkheader@#1\endcsname}%
559 \def\@tempa{\expandafter\noexpand\csname end#1\endcsname}%
560 \expandafter\xdef\csname end#1*\endcsname{\@tempa}%
561 \expandafter\xdef\csname setparms@#1\endcsname
562 {\noexpand \def \noexpand \theorem@headerfont
563 {\the\theoremheaderfont\noexpand\theorem@checkbold}%
564 \noexpand \def \noexpand \theorem@separator
565 {\the\theoremseparator}%
566 \noexpand \def \noexpand \theorem@indent
567 {\the\theoremindent}%
568 \the \theorembodyfont
569 \noexpand\csname th@\the \theorem@@style \endcsname}}}%
570 \@ifnextchar[{\@othm{#1}}{\@nthm{#1}}}% MUST NOT BE IN ANY IF !!!
571 \gdef\@renewtheorem#1{%
572 \expandafter\@ifundefined{#1}%
573 {\PackageError{\basename}{Theorem style #1 undefined}\@ehc}%
575 \expandafter\let\csname #1\endcsname\relax
576 \expandafter\let\csname #1*\endcsname\relax
579 \expandafter\xdef\csname num@addtheoremline#1\endcsname{%
580 \noexpand\@num@addtheoremline{#1}{#2}}%
581 \expandafter\xdef\csname nonum@addtheoremline#1\endcsname{%
582 \noexpand\@nonum@addtheoremline{#1}{#2}}%
583 \expandafter\xdef\csname output@#1\endcsname{#2}%
584 \@ifnextchar[{\@xnthm{#1}{#2}}{\@ynthm{#1}{#2}}}
585 \gdef\@othm#1[#2]#3{%
586 \@ifundefined{c@#2}{\@nocounterr{#2}}%
588 \global\@namedef{the#1}{\@nameuse{the#2}}%
589 \expandafter\xdef\csname num@addtheoremline#1\endcsname{%
590 \noexpand\@num@addtheoremline{#1}{#3}}%
591 \expandafter\xdef\csname nonum@addtheoremline#1\endcsname{%
592 \noexpand\@nonum@addtheoremline{#1}{#3}}%
593 \expandafter\xdef\csname output@#1\endcsname{#3}%
594 \expandafter\gdef\csname mkheader@#1\endcsname
595 {\csname setparms@#1\endcsname
597 \global\@namedef{end#1}{\@endtheorem}\fi}}
598 \gdef\@xnthm#1#2[#3]{%
600 \expandafter\@ifundefined{c@#1}%
601 {\@definecounter{#1}}{}%
603 \expandafter\xdef\csname the#1\endcsname{%
604 \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
605 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}}%
606 \expandafter\gdef\csname mkheader@#1\endcsname
607 {\csname setparms@#1\endcsname
609 \global\@namedef{end#1}{\@endtheorem}\fi}
612 \expandafter\@ifundefined{c@#1}%
613 {\@definecounter{#1}}{}%
614 \expandafter\xdef\csname the#1\endcsname
615 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}%
616 \expandafter\gdef\csname mkheader@#1\endcsname
617 {\csname setparms@#1\endcsname
619 \global\@namedef{end#1}{\@endtheorem}\fi}
622 \stepcounter{end\InTheoType ctr}%
624 \renewcommand{\InTheoType}{#1}%
626 \stepcounter{curr#1ctr}%
627 \setcounter{end#1ctr}{0}%
630 \thm@topsepadd \theorempostskipamount % cf. latex.ltx: \@trivlist
631 \ifvmode \advance\thm@topsepadd\partopsep\fi
633 \@topsep \theorempreskipamount
634 \@topsepadd \thm@topsepadd % used by \@endparenv
635 \advance\linewidth -\theorem@indent
636 \advance\@totalleftmargin \theorem@indent
637 \parshape \@ne \@totalleftmargin \linewidth
638 \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}}
640 \@begintheorem{#3}{\csname the#2\endcsname}%
641 \ifx\thm@starredenv\@undefined
642 \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{}}\fi
644 \def\@ythm#1#2#3[#4]{%
645 \expandafter\global\expandafter\def\csname#1name\endcsname{#4}%
646 \@opargbegintheorem{#3}{\csname the#2\endcsname}{#4}%
647 \ifx\thm@starredenv\@undefined
648 \thm@thmcaption{#1}{{#3}{\csname the#2\endcsname}{#4}}\fi%
650 \DeclareOption{thref}{%*********************************
651 \PackageInfo{\basename}{Option `thref' loaded}%
656 [\csname output@\InTheoType\endcsname]}}
657 \def\label@optarg#1[#2]{\@bsphack
658 \protected@write\@auxout{}%
659 {\string\newlabel{#1}{{\@currentlabel}{\thepage}}[#2]}%
661 \def\@newl@bel#1#2#3{%
662 \@ifundefined{#1@#2}%
664 {\gdef \@multiplelabels {%
665 \@latex@warning@no@line{There were multiply-defined labels}}%
666 \@latex@warning@no@line{Label `#2' multiply defined}}%
667 \global\@namedef{#1@#2}{#3}%
668 \@ifnextchar[{\set@labeltype#1#2}{\relax}%]
670 \def\set@labeltype#1#2[#3]{\global\@namedef{#1@#2@type}{#3}}
671 \@ifpackageloaded{babel}%
672 {\message{ntheorem-babel adapation loaded}%
674 \@ifnextchar[{\nth@bbl@newlabel{#1}{#2}}%]
675 {\nth@bbl@newlabel{#1}{#2}[None]}}%
676 \def\nth@bbl@newlabel#1#2[#3]{%
677 \@safe@activestrue\bbl@newlabel{#1}{#2}[#3]\@safe@activesfalse}}%
680 \expandafter\ifx\csname r@#1@type\endcsname\None
681 \PackageWarning{\basename}{thref: Reference Type of `#1' on page
682 \thepage \space undefined}\G@refundefinedtrue
683 \else\csname r@#1@type\endcsname~\fi%
684 \expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
685 }% end of option thref
686 \def\thm@thmcaption#1#2{\thm@@thmcaption{#1}#2}
687 \def\thm@@thmcaption#1#2#3#4{%
688 \thm@parseforwriting{#4}%
689 \edef\thm@t{{#2}{#3}{\thm@tmp}}%
690 \addcontentsline{thm}{#1}{\thm@t}}
691 \def\theoremlistall{%
692 \let\thm@@thmlstart=\relax
693 \let\thm@@thmlend=\relax
694 %%DV Use a fith argument (supplied by hyperref) and do the links manually
695 \def\thm@@thmline##1##2##3##4##5{%
697 \@dottedtocline{-2}{0em}{2.3em}%
698 {\protect\numberline{##2}##3}%
702 \@dottedtocline{-2}{0em}{2.3em}%
703 {\protect\numberline{##2}##3}%
704 {\hyper@linkstart{link}{##5}{##4}\hyper@linkend}
706 \@dottedtocline{-2}{0em}{2.3em}%
707 {\hyper@linkstart{link}{##5}{\protect\numberline{##2}##3}%
712 %%DV \def\thm@@thmline##1##2##3##4{%
713 %%DV \@dottedtocline{-2}{0em}{2.3em}%
714 %%DV {\protect\numberline{##2}##3}%
716 \def\theoremlistallname{%
717 \let\thm@@thmlstart=\relax
718 \let\thm@@thmlend=\relax
719 %%DV Use a fith argument (supplied by hyperref) and do the links manually
720 \def\thm@@thmline##1##2##3##4##5{%
722 \@dottedtocline{-2}{0em}{2.3em}%
723 {##1 \protect\numberline{##2}##3}%
727 \@dottedtocline{-2}{0em}{2.3em}%
728 {##1 \protect\numberline{##2}##3}%
729 {\hyper@linkstart{link}{##5}{##4}\hyper@linkend}
731 \@dottedtocline{-2}{0em}{2.3em}%
732 {\hyper@linkstart{link}{##5}%
733 {##1 \protect\numberline{##2}##3}\hyper@linkend}%
737 %%DV \def\thm@@thmline##1##2##3##4{%
738 %%DV \@dottedtocline{-2}{0em}{2.3em}%
739 %%DV {##1 \protect\numberline{##2}##3}%
741 \def\theoremlistoptional{%
742 \let\thm@@thmlstart=\relax
743 \let\thm@@thmlend=\relax
744 %%DV Use a fith argument (supplied by hyperref) and do the links manually
745 \def\thm@@thmline##1##2##3##4##5{%
749 \@dottedtocline{-2}{0em}{2.3em}%
750 {\protect\numberline{##2}##3}%
754 \@dottedtocline{-2}{0em}{2.3em}%
755 {\protect\numberline{##2}##3}%
756 {\hyper@linkstart{link}{##5}{##4}\hyper@linkend}
758 \@dottedtocline{-2}{0em}{2.3em}%
759 {\hyper@linkstart{link}{##5}{\protect\numberline{##2}##3}%
765 %%DV \def\thm@@thmline##1##2##3##4{%
768 %%DV \@dottedtocline{-2}{0em}{2.3em}%
769 %%DV {\protect\numberline{##2}##3}%
772 \def\theoremlistoptname{%
773 \let\thm@@thmlstart=\relax
774 \let\thm@@thmlend=\relax
775 %%DV Use a fith argument (supplied by hyperref) and do the links manually
776 \def\thm@@thmline##1##2##3##4##5{%
780 \@dottedtocline{-2}{0em}{2.3em}%
781 {##1 \protect\numberline{##2}##3}%
785 \@dottedtocline{-2}{0em}{2.3em}%
786 {##1 \protect\numberline{##2}##3}%
787 {\hyper@linkstart{link}{##5}{##4}\hyper@linkend}
789 \@dottedtocline{-2}{0em}{2.3em}%
790 {\hyper@linkstart{link}{##5}%
791 {##1 \protect\numberline{##2}##3}\hyper@linkend}%
796 %%DV \def\thm@@thmline##1##2##3##4{%
799 %%DV \@dottedtocline{-2}{0em}{2.3em}%
800 %%DV {##1 \protect\numberline{##2}##3}%
804 \def\theoremlisttype#1{%
805 \@ifundefined{thm@thml@#1}%
806 {\PackageError{\basename}{Listtype #1 not defined}\@eha}
807 {\csname thm@thml@#1\endcsname}}
808 \def\thm@thml@all{\theoremlistall}
809 \def\thm@thml@opt{\theoremlistoptional}
810 \def\thm@thml@optname{\theoremlistoptname}
811 \def\thm@thml@allname{\theoremlistallname}
812 \def\newtheoremlisttype#1#2#3#4{%
813 \@ifundefined{thm@thml@#1}%
814 {\expandafter\gdef\csname thm@thml@#1\endcsname{%
815 \def\thm@@thmlstart{#2}%
816 \def\thm@@thmline####1####2####3####4{#3}%
817 \def\thm@@thmlend{#4}}%
818 }{\PackageError{\basename}{list type #1 already defined}\@eha}}
819 \def\renewtheoremlisttype#1#2#3#4{%
820 \@ifundefined{thm@thml@#1}%
821 {\PackageError{\basename}{List type #1 not defined}\@ehc}{}%
822 \expandafter\let\csname thm@thml@#1\endcsname\relax
823 \newtheoremlisttype{#1}{#2}{#3}{#4}}
824 %%DV Use a third argument (supplied by hyperref)
825 \def\thm@thmline#1#2#3{\thm@@thmline#1{#2}{#3}}
826 %%DV\def\thm@thmline#1#2{\thm@@thmline#1{#2}}
827 %%DV Use a third argument (supplied by hyperref)
828 \long\def\thm@lgobble#1#2#3{\ignorespaces}
829 %%DV\long\def\thm@lgobble#1#2{\ignorespaces}
830 \def\thm@definelthm#1{%
831 \expandafter\gdef\csname l@#1\endcsname{\thm@lgobble}%
832 \expandafter\gdef\csname thm@listdo#1\endcsname{\thm@lgobble}}
833 \long\def\thm@inlistdo#1#2{#2}%
834 \def\listtheorems#1{\begingroup%
836 \def\thm@list{#1}\thm@processlist%
838 \def\thm@processlist{%
840 \typeout{** Generating table of \thm@list}%
841 %%DV: don't use hyperref's \contentsline !! Use the normal definition.
842 \def\contentsline##1{\csname l@##1\endcsname}
844 \@for\thm@currentlist:=\thm@list\do{%
845 \ifx\thm@currentlist\@empty\else%
846 \expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@thmline}%
847 \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@inlistdo}%
850 \@input{\jobname .thm}%
852 \@for\thm@currentlist:=\thm@list\do{%
853 \ifx\thm@currentlist\@empty\else%
854 \expandafter\gdef\csname l@\thm@currentlist\endcsname{\thm@lgobble}%
855 \expandafter\gdef\csname thm@listdo\thm@currentlist\endcsname{\thm@lgobble}%
859 \def\thm@enablelistoftheorems{%
863 \expandafter\newwrite\csname tf@thm\endcsname%
864 \immediate\openout \csname tf@thm\endcsname \jobname.thm\relax%
868 \def\addtheoremline{\@ifstar{\nonum@addtheoremline}{\num@addtheoremline}}
869 \def\nonum@addtheoremline#1{\csname nonum@addtheoremline#1\endcsname}%
870 \def\num@addtheoremline#1{\csname num@addtheoremline#1\endcsname}%
871 \def\@nonum@addtheoremline#1#2#3{%
872 \thm@parseforwriting{#3}%
873 \edef\thm@t{{#2}{}{\thm@tmp}}%
874 \addcontentsline{thm}{#1}{\thm@t}}
875 \def\@num@addtheoremline#1#2#3{%
876 \thm@parseforwriting{#3}%
877 \edef\thm@t{{#2}{\csname the#1\endcsname}{\thm@tmp}}%
878 \addcontentsline{thm}{#1}{\thm@t}}
879 \long\def\addtotheoremfile{%
880 \@ifnextchar[{\@@addtotheoremfile}{\@addtotheoremfile}}
881 \long\def\@addtotheoremfile#1{%
882 \thm@parseforwriting{#1}%
883 \protected@write\@auxout%
884 {}{\string\@writefile{thm}{\thm@tmp}}}
885 \long\def\@@addtotheoremfile[#1]#2{%
886 \thm@parseforwriting{#2}%
887 \protected@write\@auxout%
888 {}{\string\@writefile{thm}{\string\theoremlistdo{#1}{\thm@tmp}}}}
889 \long\def\theoremlistdo#1#2{\csname thm@listdo#1\endcsname{#1}{#2}}
890 \AtEndDocument{\thm@enablelistoftheorems}
891 \def\thm@meaning#1->#2\relax{#2}% remove "macro:->"
892 \long\def\thm@parseforwriting#1{%
894 \edef\thm@tmp{\expandafter\thm@meaning\meaning\thm@tmp\relax}}
895 \def\theorem@checkbold{\if b\expandafter\@car\f@series\@nil\boldmath\fi}
896 \def\@greek#1{\theorem@checkbold%
897 \ifcase#1\or$\alpha$\or$\beta$\or$\gamma$\or$\delta$\or$\varepsilon$%
898 \or$\zeta$\or$\eta$\or$\vartheta$\or$\iota$\or$\kappa$\or$\lambda$\or$%
899 \mu$\or$\nu$\or$\xi$\or$ o$\or$\varpi$\or$\varrho$\or$\varsigma$\or$\tau$%
900 \or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or$\omega$\else\@ctrerr\fi}
901 \def\@Greek#1{\theorem@checkbold%
902 \ifcase#1\or A\or B\or$\Gamma$\or$\Delta$\or E%
903 \or Z\or H\or$\Theta$\or I\or K\or$\Lambda$\or M%
904 \or N\or$\Xi$\or O\or$\Pi$\or P\or$\Sigma$\or T%
905 \or$\Upsilon$\or$\Phi$\or X\or$\Psi$\or$\Omega$\else\@ctrerr\fi}
906 \def\greek#1{\@greek{\csname c@#1\endcsname}}
907 \def\Greek#1{\@Greek{\csname c@#1\endcsname}}
908 \ProcessOptions\relax
909 \ifx\thm@noconfig\@undefined
910 \InputIfFileExists{ntheorem.cfg}%
911 {\PackageInfo{\basename}{Local config file ntheorem.cfg used}}%
912 {\ifx\thm@usestd\@undefined%
914 \InputIfFileExists{ntheorem.std}%
915 {\PackageInfo{\basename}{Standard config file ntheorem.std used}}{}
920 %% End of file `ntheorem.sty'.