Debian Codegraph @

texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty

raw
1 %%
2 %% This is file `lwarp-ntheorem.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% lwarp.dtx (with options: `ntheorem')
8 %% This is a generated file.
9 %% Copyright 2016-2026 Brian Dunn
10 %%
11 %% This work may be distributed and/or modified under the
12 %% conditions of the LaTeX Project Public License, either version 1.3
13 %% of this license or (at your option) any later version.
14 %% The latest version of this license is in
15 %% http://www.latex-project.org/lppl.txt
16 %% and version 1.3 or later is part of all distributions of LaTeX
17 %% version 2005/12/01 or later.
18
19 \DeclareOption{thref}{
20 \AtEndDocument{
21 \PackageWarningNoLine{lwarp}{%
22 Lwarp uses cleveref, which takes over ntheorem's\MessageBreak
23 referencing, including
24 \protect\label \space and \protect\thref.\MessageBreak
25 Cleveref does not accept ntheorem's optional\MessageBreak
26 argument for \protect\label, so it will appear\MessageBreak
27 in the text. It is recommended to remove the\MessageBreak
28 thref option, \protect\usepackage{cleveref} instead,\MessageBreak
29 and remove any trailing optional arguments for \protect\label%
30 }%
31 }
32 }
33
34 \newbool{LWR@ntheoremmarks}
35 \boolfalse{LWR@ntheoremmarks}
36
37 \DeclareOption{thmmarks}{
38 \booltrue{LWR@ntheoremmarks}
39 \newif\ifsetendmark\setendmarktrue
40 }
41
42 \newbool{LWR@ntheoremamsthm}
43 \boolfalse{LWR@ntheoremamsthm}
44
45 \DeclareOption{amsthm}{\booltrue{LWR@ntheoremamsthm}}
46
47 \DeclareOption{amsmath}{}
48 \DeclareOption{hyperref}{}
49
50 \LWR@ProvidesPackagePass{ntheorem}[2011/08/15]
51 \newcommand{\LWR@newtheoremstyle}{plain}
52 \AtBeginDocument{
53 \IfPackageLoadedTF{cleveref}{
54 \VerifyCommand[lwarp][ntheorem-cleveref]{\@thm}
55 {24EBE14DBADF0B9992C3EDE1D70BA897}
56 \gdef\@thm#1#2#3{%
57 \if@thmmarks
58 \stepcounter{end\InTheoType ctr}%
59 \fi
60 \renewcommand{\InTheoType}{#1}%
61 \if@thmmarks
62 \stepcounter{curr#1ctr}%
63 \setcounter{end#1ctr}{0}%
64 \fi
65 \refstepcounter[#1]{#2}% <<< cleveref modification
66 \theorem@prework
67 \LWR@forcenewpage% lwarp
68 \LWR@printpendingfootnotes% lwarp
69 \BlockClass{theorembody#1}%\LWR@thisthmstyle% lwarp
70 \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
71 \ifuse@newframeskips % cf. latex.ltx for topsepadd: \@trivlist
72 \ifthm@inframe
73 \thm@topsep\theoreminframepreskipamount
74 \thm@topsepadd\theoreminframepostskipamount
75 \else
76 \thm@topsep\theorempreskipamount
77 \thm@topsepadd\theorempostskipamount
78 \fi
79 \else% oldframeskips
80 \thm@topsep\theorempreskipamount
81 \thm@topsepadd \theorempostskipamount
82 \ifvmode\advance\thm@topsepadd\partopsep\fi
83 \fi
84 \@topsep\thm@topsep
85 \@topsepadd\thm@topsepadd
86 \advance\linewidth -\theorem@indent
87 \advance\linewidth -\theorem@rightindent
88 \advance\@totalleftmargin \theorem@indent
89 \parshape \@ne \@totalleftmargin \linewidth
90 \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
91 }
92 }{% not @ifpackageloaded{cleveref}
93 \gdef\@thm#1#2#3{%
94 \if@thmmarks
95 \stepcounter{end\InTheoType ctr}%
96 \fi
97 \renewcommand{\InTheoType}{#1}%
98 \if@thmmarks
99 \stepcounter{curr#1ctr}%
100 \setcounter{end#1ctr}{0}%
101 \fi
102 \refstepcounter{#2}%
103 \theorem@prework
104 \LWR@forcenewpage% lwarp
105 \LWR@printpendingfootnotes% lwarp
106 \BlockClass{theorembody#1}%\LWR@thisthmstyle% lwarp
107 \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
108 \ifuse@newframeskips % cf. latex.ltx for topsepadd: \@trivlist
109 \ifthm@inframe
110 \thm@topsep\theoreminframepreskipamount
111 \thm@topsepadd\theoreminframepostskipamount
112 \else
113 \thm@topsep\theorempreskipamount
114 \thm@topsepadd\theorempostskipamount
115 \fi
116 \else% oldframeskips
117 \thm@topsep\theorempreskipamount
118 \thm@topsepadd \theorempostskipamount
119 \ifvmode\advance\thm@topsepadd\partopsep\fi
120 \fi
121 \@topsep\thm@topsep
122 \@topsepadd\thm@topsepadd
123 \advance\linewidth -\theorem@indent
124 \advance\linewidth -\theorem@rightindent
125 \advance\@totalleftmargin \theorem@indent
126 \parshape \@ne \@totalleftmargin \linewidth
127 \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
128 }
129 }
130 }% AtBeginDocument
131 \VerifyCommand[lwarp][ntheorem]{\theoremstyle}
132 {A735E431A49EB3A7B4BABD9AEAEE7E10}
133 \gdef\theoremstyle#1{%
134 \@ifundefined{th@#1}{\@warning
135 {Unknown theoremstyle `#1'. Using `plain'}%
136 \theorem@style{plain}
137 \renewcommand{\LWR@newtheoremstyle}{plain}% lwarp
138 }%
139 {
140 \theorem@style{#1}
141 \renewcommand{\LWR@newtheoremstyle}{#1}% lwarp
142 }
143 }
144 \VerifyCommand[lwarp][ntheorem]{\@xnthm}{699CB37D7349C4F062B16B9B890FFE90}
145
146 \gdef\@xnthm#1#2[#3]{%
147 \ifthm@tempif
148 \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% lwarp
149 \expandafter\@ifundefined{c@#1}%
150 {\@definecounter{#1}}{}%
151 \@newctr{#1}[#3]%
152 \expandafter\xdef\csname the#1\endcsname{%
153 \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
154 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}}%
155 \expandafter\gdef\csname mkheader@#1\endcsname
156 {\csname setparms@#1\endcsname
157 \@thm{#1}{#1}{#2}
158 }%
159 \global\@namedef{end#1}{\@endtheorem}
160 \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\@nameuse{LWR@thmstyle#1}}}% lwarp
161 \fi
162 }
163
164 \VerifyCommand[lwarp][ntheorem]{\@ynthm}{E0E49F4C2FF76BA3024F2413E2E3DA0D}
165
166 \gdef\@ynthm#1#2{%
167 \ifthm@tempif
168 \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% lwarp
169 \expandafter\@ifundefined{c@#1}%
170 {\@definecounter{#1}}{}%
171 \expandafter\xdef\csname the#1\endcsname
172 {\noexpand\csname\the\theoremnumbering\endcsname{#1}}%
173 \expandafter\gdef\csname mkheader@#1\endcsname
174 {\csname setparms@#1\endcsname
175 \@thm{#1}{#1}{#2}
176 }%
177 \global\@namedef{end#1}{\@endtheorem}
178 \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\@nameuse{LWR@thmstyle#1}}}% lwarp
179 \fi
180 }
181
182 \VerifyCommand[lwarp][ntheorem]{\@othm}{A6D2FCC33AB3F7C7F998399F013FB6A8}
183
184 \gdef\@othm#1[#2]#3{%
185 \@ifundefined{c@#2}{\@nocounterr{#2}}%
186 {\ifthm@tempif
187 \csedef{LWR@thmstyle#1}{\LWR@newtheoremstyle}% lwarp
188 \global\@namedef{the#1}{\@nameuse{the#2}}%
189 \expandafter\protected@xdef\csname num@addtheoremline#1\endcsname{%
190 \noexpand\@num@addtheoremline{#1}{#3}}%
191 \expandafter\protected@xdef\csname nonum@addtheoremline#1\endcsname{%
192 \noexpand\@nonum@addtheoremline{#1}{#3}}%
193 \theoremkeyword{#3}%
194 \expandafter\protected@xdef\csname #1Keyword\endcsname
195 {\the\theoremkeyword}%
196 \expandafter\gdef\csname mkheader@#1\endcsname
197 {\csname setparms@#1\endcsname
198 \@thm{#1}{#2}{#3}
199 }%
200 \global\@namedef{end#1}{\@endtheorem}
201 \AtBeginEnvironment{#1}{\edef\LWR@thisthmstyle{\@nameuse{LWR@thmstyle#1}}}% lwarp
202 \fi}
203 }
204 \newcommand{\LWR@inctheorem}{%
205 \addtocounter{LWR@thisautoid}{1}%
206 \LWR@stoppars%
207 \LWR@htmltag{%
208 a id=\textquotedbl\LWR@print@mbox{autoid-\arabic{LWR@thisautoid}}\textquotedbl%
209 }%
210 \LWR@htmltag{/a}\LWR@orignewline%
211 \LWR@startpars%
212 }
213 \VerifyCommand[lwarp][ntheorem]{\newtheoremstyle}{8173F61CEBA45226CD3015E5E258C93D}
214
215 \gdef\newtheoremstyle#1#2#3{%
216 \expandafter\@ifundefined{th@#1}%
217 {\expandafter\gdef\csname th@#1\endcsname{%
218 \def\@begintheorem####1####2{%
219 \LWR@inctheorem% lwarp
220 #2}%
221 \def\@opargbegintheorem####1####2####3{%
222 \LWR@inctheorem% lwarp
223 #3}%
224 }%
225 }%
226 {\PackageError{\basename}{Theorem style #1 already defined}\@eha}
227 }
228 \renewtheoremstyle{plain}%
229 {\item[
230 \InlineClass{theoremheaderplain}{##1\ ##2\theorem@separator}]}%
231 {\item[
232 \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem@separator}]}
233
234 \renewtheoremstyle{break}%
235 {\item[
236 \InlineClass{theoremheaderbreak}{##1\ ##2\theorem@separator}\newline
237 ]}%
238 {\item[
239 \InlineClass{theoremheaderbreak}%
240 {##1\ ##2\ (##3)\theorem@separator}\newline
241 ]}
242
243 \renewtheoremstyle{change}%
244 {\item[
245 \InlineClass{theoremheaderchange}{##2\ ##1\theorem@separator}]}%
246 {\item[
247 \InlineClass{theoremheaderchange}{##2\ ##1\ (##3)\theorem@separator}]}
248
249 \renewtheoremstyle{changebreak}%
250 {\item[
251 \InlineClass{theoremheaderchangebreak}%
252 {##2\ ##1\theorem@separator}\newline
253 ]}%
254 {\item[
255 \InlineClass{theoremheaderchangebreak}%
256 {##2\ ##1\ (##3)\theorem@separator}\newline
257 ]}
258
259 \renewtheoremstyle{margin}%
260 {\item[
261 \InlineClass{theoremheadermargin}{##2 \qquad ##1\theorem@separator}
262 ]}%
263 {\item[
264 \InlineClass{theoremheadermargin}{##2 \qquad ##1\ (##3)\theorem@separator}
265 ]}
266
267 \renewtheoremstyle{marginbreak}%
268 {\item[
269 \InlineClass{theoremheadermarginbreak}%
270 {##2 \qquad ##1\theorem@separator}\newline
271 ]}%
272 {\item[
273 \InlineClass{theoremheadermarginbreak}%
274 {##2 \qquad ##1\ (##3)\theorem@separator}\newline
275 ]}
276
277 \renewtheoremstyle{nonumberplain}%
278 {\item[
279 \InlineClass{theoremheaderplain}{##1\theorem@separator}]}%
280 {\item[
281 \InlineClass{theoremheaderplain}{##1\ (##3)\theorem@separator}]}
282
283 \renewtheoremstyle{nonumberbreak}%
284 {\item[
285 \InlineClass{theoremheaderbreak}{##1\theorem@separator}\newline
286 ]}%
287 {\item[
288 \InlineClass{theoremheaderbreak}{##1\ (##3)\theorem@separator}\newline
289 ]}
290
291 \renewtheoremstyle{empty}%
292 {\item[]}%
293 {\item[
294 \InlineClass{theoremheaderplain}{##3}]}
295
296 \renewtheoremstyle{emptybreak}%
297 {\item[]}%
298 {\item[
299 \InlineClass{theoremheaderplain}{##3}] \ \newline}
300 \ifbool{LWR@ntheoremamsthm}{}{%
301 \newtheoremstyle{plainupright}%
302 {\item[
303 \InlineClass{theoremheaderplain}{##1\ ##2\theorem@separator}]}%
304 {\item[
305 \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem@separator}]}
306 \newtheoremstyle{nonumberplainuprightsc}%
307 {\item[
308 \InlineClass{theoremheadersc}{##1\theorem@separator}]}%
309 {\item[
310 \InlineClass{theoremheadersc}{##1\ (##3)\theorem@separator}]}
311 }% not amsthm
312 \ifbool{LWR@ntheoremamsthm}{}{%
313 \ifx\thm@usestd\@undefined
314 \else
315 \theoremnumbering{arabic}
316 \theoremstyle{plain}
317 \RequirePackage{latexsym}
318 \theoremsymbol{\Box}
319 \theorembodyfont{\itshape}
320 \theoremheaderfont{\normalfont\bfseries}
321 \theoremseparator{}
322 \renewtheorem{Theorem}{Theorem}
323 \renewtheorem{theorem}{Theorem}
324 \renewtheorem{Satz}{Satz}
325 \renewtheorem{satz}{Satz}
326 \renewtheorem{Proposition}{Proposition}
327 \renewtheorem{proposition}{Proposition}
328 \renewtheorem{Lemma}{Lemma}
329 \renewtheorem{lemma}{Lemma}
330 \renewtheorem{Korollar}{Korollar}
331 \renewtheorem{korollar}{Korollar}
332 \renewtheorem{Corollary}{Corollary}
333 \renewtheorem{corollary}{Corollary}
334
335 \theoremstyle{plainupright}
336 \theorembodyfont{\upshape}
337 \theoremsymbol{\HTMLunicode{25A1}}% UTF-8 white box
338 \renewtheorem{Example}{Example}
339 \renewtheorem{example}{Example}
340 \renewtheorem{Beispiel}{Beispiel}
341 \renewtheorem{beispiel}{Beispiel}
342 \renewtheorem{Bemerkung}{Bemerkung}
343 \renewtheorem{bemerkung}{Bemerkung}
344 \renewtheorem{Anmerkung}{Anmerkung}
345 \renewtheorem{anmerkung}{Anmerkung}
346 \renewtheorem{Remark}{Remark}
347 \renewtheorem{remark}{Remark}
348 \renewtheorem{Definition}{Definition}
349 \renewtheorem{definition}{Definition}
350
351 \theoremstyle{nonumberplainuprightsc}
352 \theoremsymbol{\HTMLunicode{220E}}% UTF-8 end-of-proof
353 \renewtheorem{Proof}{Proof}
354 \renewtheorem{proof}{Proof}
355 \renewtheorem{Beweis}{Beweis}
356 \renewtheorem{beweis}{Beweis}
357 \qedsymbol{\HTMLunicode{220E}}% UTF-8 end-of-proof
358
359 \theoremsymbol{}
360 \fi
361 }% not amsthm
362 \ifbool{LWR@ntheoremamsthm}{
363
364 \VerifyCommand[lwarp][ntheorem-amsthm]{\th@plain}
365 {1FB8AE22BD4090F90D9031CFFC57DAFB}
366 \gdef\th@plain{%
367 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
368 \def\@begintheorem##1##2{%
369 \LWR@inctheorem% lwarp
370 \item[
371 \InlineClass{theoremheaderplain}{##1\ ##2.}
372 ]}%
373 \def\@opargbegintheorem##1##2##3{%
374 \LWR@inctheorem% lwarp
375 \item[
376 \InlineClass{theoremheaderplain}{##1\ ##2\ (##3).}
377 ]}}
378
379 \VerifyCommand[lwarp][ntheorem-amsthm]{\th@nonumberplain}
380 {3E82A39A222021777BF8221C490E86EC}
381 \gdef\th@nonumberplain{%
382 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
383 \def\@begintheorem##1##2{%
384 \LWR@inctheorem% lwarp
385 \item[
386 \InlineClass{theoremheaderplain}{##1.}
387 ]}%
388 \def\@opargbegintheorem##1##2##3{%
389 \LWR@inctheorem% lwarp
390 \item[
391 \InlineClass{theoremheaderplain}{##1\ (##3).}
392 ]}}
393
394 \gdef\th@definition{%
395 \def\theorem@headerfont{\normalfont\bfseries}\normalfont%
396 \def\@begintheorem##1##2{%
397 \LWR@inctheorem% lwarp
398 \item[
399 \InlineClass{theoremheaderdefinition}{##1\ ##2.}
400 ]}%
401 \def\@opargbegintheorem##1##2##3{%
402 \LWR@inctheorem% lwarp
403 \item[
404 \InlineClass{theoremheaderdefinition}{##1\ ##2\ (##3).}
405 ]}}
406
407 \gdef\th@nonumberdefinition{%
408 \def\theorem@headerfont{\normalfont\bfseries}\normalfont%
409 \def\@begintheorem##1##2{%
410 \LWR@inctheorem% lwarp
411 \item[
412 \InlineClass{theoremheaderdefinition}{##1.}
413 ]}%
414 \def\@opargbegintheorem##1##2##3{%
415 \LWR@inctheorem% lwarp
416 \item[
417 \InlineClass{theoremheaderdefinition}{##1\ (##3).}
418 ]}}
419
420 \gdef\th@remark{%
421 \def\theorem@headerfont{\itshape}\normalfont%
422 \def\@begintheorem##1##2{%
423 \LWR@inctheorem% lwarp
424 \item[
425 \InlineClass{theoremheaderremark}{##1\ ##2.}
426 ]}%
427 \def\@opargbegintheorem##1##2##3{%
428 \LWR@inctheorem% lwarp
429 \item[
430 \InlineClass{theoremheaderremark}{##1\ ##2\ (##3).}
431 ]}}
432
433 \gdef\th@nonumberremark{%
434 \def\theorem@headerfont{\itshape}\normalfont%
435 \def\@begintheorem##1##2{%
436 \LWR@inctheorem% lwarp
437 \item[
438 \InlineClass{theoremheaderremark}{##1.}
439 ]}%
440 \def\@opargbegintheorem##1##2##3{%
441 \LWR@inctheorem% lwarp
442 \item[
443 \InlineClass{theoremheaderremark}{##1\ (##3).}
444 ]}}
445
446 \gdef\th@proof{%
447 \def\theorem@headerfont{\normalfont\bfseries}\itshape%
448 \def\@begintheorem##1##2{%
449 \LWR@inctheorem% lwarp
450 \item[
451 \InlineClass{theoremheaderproof}{##1.}
452 ]}%
453 \def\@opargbegintheorem##1##2##3{%
454 \LWR@inctheorem% lwarp
455 \item[
456 \InlineClass{theoremheaderproof}{##1\ (##3).}
457 ]}}
458
459 \newcounter{proof}%
460 \if@thmmarks
461 \newcounter{currproofctr}%
462 \newcounter{endproofctr}%
463 \fi
464
465 \gdef\proofSymbol{\openbox}
466
467 \newcommand{\proofname}{Proof}
468
469 \newenvironment{proof}[1][\proofname]{
470 \th@proof
471 \def\theorem@headerfont{\itshape}%
472 \normalfont
473 \theoremsymbol{\HTMLunicode{220E}}% UTF-8 end-of-proof
474 \@thm{proof}{proof}{#1}
475 }%
476 {\@endtheorem}
477
478 }{}% amsthm option
479 \let\LWR@origendtheorem\@endtheorem
480 \renewcommand{\@endtheorem}{%
481 \ifbool{LWR@ntheoremmarks}{%
482 \ifsetendmark%
483 \InlineClass{theoremendmark}{\csname\InTheoType Symbol\endcsname}%
484 \setendmarkfalse%
485 \fi%
486 }{}%
487 \LWR@origendtheorem% also does \@endtrivlist
488 \ifbool{LWR@ntheoremmarks}{\global\setendmarktrue}{}%
489 \LWR@printpendingfootnotes% lwarp
490 \endBlockClass%
491 }
492 \gdef\NoEndMark{\global\setendmarkfalse}
493 \renewcommand{\thm@@thmline@noname}[4]{%
494 \hypertocfloat{1}{theorem}{thm}{#2 #3}{}%
495 }
496
497 \renewcommand{\thm@@thmline@name}[4]{%
498 \hypertocfloat{1}{theorem}{thm}{#1 #2 #3}{}%
499 }
500 \def\thm@@thmline{\thm@@thmline@name}
501 \xpretocmd{\listtheorems}
502 {\LWR@htmlelementclass{nav}{lothm}}
503 {}
504 {\LWR@patcherror{ntheorem}{listtheorems}}
505
506 \xapptocmd{\listtheorems}
507 {\LWR@htmlelementclassend{nav}{lothm}}
508 {}
509 {\LWR@patcherror{ntheorem}{listtheorems}}
510 \newcommand{\qed}{\qquad\the\qedsymbol}
511
512 \AtBeginDocument{
513 \@ifundefined{LWR@orig@openbox}{
514 \LetLtxMacro\LWR@orig@openbox\openbox
515 \LetLtxMacro\LWR@orig@blacksquare\blacksquare
516 \LetLtxMacro\LWR@orig@Box\Box
517
518 \def\openbox{\text{\HTMLunicode{25A1}}}% UTF-8 white box
519 \def\blacksquare{\text{\HTMLunicode{220E}}}% UTF-8 end-of-proof
520 \def\Box{\text{\HTMLunicode{25A1}}}% UTF-8 white box
521
522 \appto\LWR@restoreorigformatting{%
523 \LetLtxMacro\openbox\LWR@orig@openbox%
524 \LetLtxMacro\blacksquare\LWR@orig@blacksquare%
525 \LetLtxMacro\Box\LWR@orig@Box%
526 }% appto
527 }{}% @ifundefined
528 }% AtBeginDocument
529 \newcommand*{\thref}[1]{\cref{#1}}%
530
531 \endinput
532 %%
533 %% End of file `lwarp-ntheorem.sty'.