Debian Codegraph @

texmf-dist/source/latex/nchairx/chairxEnv.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2018 - 2021 by ChairX
4 %
5 % This file may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either
7 % version 1.3 of this license or (at your option) any later
8 % version. The latest version of this license is in:
9 %
10 % http://www.latex-project.org/lppl.txt
11 %
12 % and version 1.3 or later is part of all distributions of
13 % LaTeX version 2005/12/01 or later.
14 %
15 % This file contains the implementation of the environment handling.
16 %
17 % Macros have to be described by (delete the first %)
18 % %\begin{macro}{\macro}
19 % % Description of the implementation.
20 % % \begin{macrocode}
21 %\newcommand{\macro}[] {}
22 % % \end{macrocode}
23 % %\end{macro}
24 %
25 % The implementation and description will appear in the implementation
26 % part of the documentation. Use \subsubsection{} etc. for
27 % structuring.
28 %
29 % The documentation of the macros defined here has to be written in
30 % chairxEnvDoc.dtx
31 % \fi
32 %
33 %
34 % \begin{macro}{\claimch@irxname}
35 % \begin{macro}{\conjecturech@irxname}
36 % \begin{macro}{\conventionch@irxname}
37 % \begin{macro}{\corollarych@irxname}
38 % \begin{macro}{\definitionch@irxname}
39 % \begin{macro}{\examplech@irxname}
40 % \begin{macro}{\exercisech@irxname}
41 % \begin{macro}{\hintch@irxname}
42 % \begin{macro}{\lemmach@irxname}
43 % \begin{macro}{\maintheoremch@irxname}
44 % \begin{macro}{\notationch@irxname}
45 % \begin{macro}{\proofch@irxname}
46 % \begin{macro}{\propositionch@irxname}
47 % \begin{macro}{\questionch@irxname}
48 % \begin{macro}{\remarkch@irxname}
49 % \begin{macro}{\subproofch@irxname}
50 % \begin{macro}{\theoremch@irxname}
51 %
52 % First we define the names of the environments in English.
53 % Currently we support German and English if the |babel| package
54 % is loaded, insert more as you like.
55 %
56 % \begin{macrocode}
57 \newcommand{\claimch@irxname}{Claim}
58 \newcommand{\conjecturech@irxname}{Conjecture}
59 \newcommand{\conventionch@irxname}{Convention}
60 \newcommand{\corollarych@irxname}{Corollary}
61 \newcommand{\definitionch@irxname}{Definition}
62 \newcommand{\examplech@irxname}{Example}
63 \newcommand{\exercisech@irxname}{Exercise}
64 \newcommand{\hintch@irxname}{Hint}
65 \newcommand{\lemmach@irxname}{Lemma}
66 \newcommand{\maintheoremch@irxname}{Main Theorem}
67 \newcommand{\notationch@irxname}{Notation}
68 \newcommand{\proofch@irxname}{Proof}
69 \newcommand{\propositionch@irxname}{Proposition}
70 \newcommand{\questionch@irxname}{Question}
71 \newcommand{\remarkch@irxname}{Remark}
72 \newcommand{\subproofch@irxname}{Proof}
73 \newcommand{\theoremch@irxname}{Theorem}
74 % \end{macrocode}
75 %
76 % \end{macro}
77 % \end{macro}
78 % \end{macro}
79 % \end{macro}
80 % \end{macro}
81 % \end{macro}
82 % \end{macro}
83 % \end{macro}
84 % \end{macro}
85 % \end{macro}
86 % \end{macro}
87 % \end{macro}
88 % \end{macro}
89 % \end{macro}
90 % \end{macro}
91 % \end{macro}
92 % \end{macro}
93 %
94 % If the |babel| package is loaded with the option for English we fill
95 % them with the correct English words. Note that we also need the
96 % |strings| option to make this work. Otherwise we do nothing.
97 % Careful: no spaces allowed in the list!
98 %
99 % \begin{macrocode}
100 \@ifpackagewith{babel}{english,strings}{%
101 \StartBabelCommands{english}{extras}
102 \SetString{\chapterch@irxname}{Chapter}
103 \SetString{\sectionch@irxname}{Section}
104 \SetString{\subsectionch@irxname}{Section}
105 \SetString{\subsubsectionch@irxname}{Section}
106 \SetString{\lemmach@irxname}{Lemma}
107 \SetString{\propositionch@irxname}{Proposition}
108 \SetString{\theoremch@irxname}{Theorem}
109 \SetString{\corollarych@irxname}{Corollary}
110 \SetString{\definitionch@irxname}{Definition}
111 \SetString{\claimch@irxname}{Claim}
112 \SetString{\examplech@irxname}{Example}
113 \SetString{\remarkch@irxname}{Remark}
114 \SetString{\questionch@irxname}{Question}
115 \SetString{\conjecturech@irxname}{Conjecture}
116 \SetString{\conventionch@irxname}{Convention}
117 \SetString{\exercisech@irxname}{Exercise}
118 \SetString{\maintheoremch@irxname}{Main Theorem}
119 \SetString{\notationch@irxname}{Notation}
120 \SetString{\proofch@irxname}{Proof}
121 \SetString{\subproofch@irxname}{Proof}
122 \SetString{\hintch@irxname}{Hint}
123 \EndBabelCommands
124 }{}
125 % \end{macrocode}
126 %
127 % Same thing in German.
128 %
129 % \begin{macrocode}
130 \@ifpackagewith{babel}{german,strings}{%
131 \StartBabelCommands{german}{extras}
132 \SetString{\chapterch@irxname}{Kapitel}
133 \SetString{\sectionch@irxname}{Abschnitt}
134 \SetString{\subsectionch@irxname}{Abschnitt}
135 \SetString{\subsubsectionch@irxname}{Abschnitt}
136 \SetString{\lemmach@irxname}{Lemma}
137 \SetString{\propositionch@irxname}{Proposition}
138 \SetString{\theoremch@irxname}{Satz}
139 \SetString{\corollarych@irxname}{Korollar}
140 \SetString{\definitionch@irxname}{Definition}
141 \SetString{\claimch@irxname}{Behauptung}
142 \SetString{\examplech@irxname}{Beispiel}
143 \SetString{\remarkch@irxname}{Bemerkung}
144 \SetString{\questionch@irxname}{Frage}
145 \SetString{\conjecturech@irxname}{Vermutung}
146 \SetString{\conventionch@irxname}{Konvention}
147 \SetString{\exercisech@irxname}{\"Ubung}
148 \SetString{\maintheoremch@irxname}{Theorem}
149 \SetString{\notationch@irxname}{Notation}
150 \SetString{\proofch@irxname}{Beweis}
151 \SetString{\subproofch@irxname}{Beweis}
152 \SetString{\hintch@irxname}{Hinweis}
153 \EndBabelCommands
154 }{}
155 % \end{macrocode}
156 %
157 % Now we define the actual environments. We start with header in bold
158 % and body in italic.
159 %
160 % \begin{macrocode}
161 \theoremheaderfont{\normalfont\bfseries}
162 \theorembodyfont{\itshape}
163 % \end{macrocode}
164 %
165 % \begin{environment}{claim}
166 % \begin{environment}{conjecture}
167 % \begin{environment}{corollary}
168 % \begin{environment}{definition}
169 % \begin{environment}{lemma}
170 % \begin{environment}{proposition}
171 % \begin{environment}{theorem}
172 %
173 % Now those environments with this styling, all share the common
174 % numbering scheme. In order to make |\autoref| work properly we
175 % need to define alias counter. For each environment we also
176 % define |\*autorefname|.
177 %
178 % \begin{macrocode}
179 \newtheorem{claim}{\claimch@irxname}[section]
180 \newtheorem*{nnclaim}{\claimch@irxname}
181 \newaliascnt{conjecture}{claim}
182 \newtheorem{conjecture}[conjecture]{\conjecturech@irxname}
183 \newtheorem*{nnconjecture}{\conjecturech@irxname}
184 \aliascntresetthe{conjecture}
185 \newaliascnt{corollary}{claim}
186 \newtheorem{corollary}[corollary]{\corollarych@irxname}
187 \newtheorem*{nncorollary}{\corollarych@irxname}
188 \aliascntresetthe{corollary}
189 \newaliascnt{definition}{claim}
190 \newtheorem{definition}[definition]{\definitionch@irxname}
191 \newtheorem*{nndefinition}{\definitionch@irxname}
192 \aliascntresetthe{definition}
193 \newaliascnt{lemma}{claim}
194 \newtheorem{lemma}[lemma]{\lemmach@irxname}
195 \newtheorem*{nnlemma}{\lemmach@irxname}
196 \aliascntresetthe{lemma}
197 \newaliascnt{proposition}{claim}
198 \newtheorem{proposition}[proposition]{\propositionch@irxname}
199 \newtheorem*{nnproposition}{\propositionch@irxname}
200 \aliascntresetthe{proposition}
201 \newaliascnt{theorem}{claim}
202 \newtheorem{theorem}[theorem]{\theoremch@irxname}
203 \newtheorem*{nntheorem}{\theoremch@irxname}
204 \aliascntresetthe{theorem}
205 % \end{macrocode}
206 %
207 % \end{environment}
208 % \end{environment}
209 % \end{environment}
210 % \end{environment}
211 % \end{environment}
212 % \end{environment}
213 % \end{environment}
214 %
215 % Next we set the body font to roman.
216 %
217 % \begin{macrocode}
218 \theorembodyfont{\rmfamily}
219 % \end{macrocode}
220 %
221 % \begin{environment}{example}
222 % \begin{environment}{convention}
223 % \begin{environment}{notation}
224 % \begin{environment}{question}
225 % \begin{environment}{remark}
226 %
227 % And have some more environments, still numbered with the same
228 % counter.
229 %
230 % \begin{macrocode}
231 \newaliascnt{example}{claim}
232 \newtheorem{example}[example]{\examplech@irxname}
233 \newtheorem*{nnexample}{\examplech@irxname}
234 \aliascntresetthe{example}
235 \newaliascnt{convention}{claim}
236 \newtheorem{convention}[convention]{\conventionch@irxname}
237 \newtheorem*{nnconvention}{\conventionch@irxname}
238 \aliascntresetthe{convention}
239 \newaliascnt{notation}{claim}
240 \newtheorem{notation}[notation]{\notationch@irxname}
241 \newtheorem*{nnnotation}{\notationch@irxname}
242 \aliascntresetthe{notation}
243 \newaliascnt{question}{claim}
244 \newtheorem{question}[question]{\questionch@irxname}
245 \newtheorem*{nnquestion}{\questionch@irxname}
246 \aliascntresetthe{question}
247 \newaliascnt{remark}{claim}
248 \newtheorem{remark}[remark]{\remarkch@irxname}
249 \newtheorem*{nnremark}{\remarkch@irxname}
250 \aliascntresetthe{remark}
251 % \end{macrocode}
252 %
253 % \end{environment}
254 % \end{environment}
255 % \end{environment}
256 % \end{environment}
257 % \end{environment}
258 %
259 % \begin{environment}{exercise}
260 %
261 % The exercise environment has a separate counter.
262 %
263 % \begin{macrocode}
264 \newtheorem{exercise}{\exercisech@irxname}[section]
265 \newtheorem*{nnexercise}{\exercisech@irxname}
266 % \end{macrocode}
267 %
268 % \end{environment}
269 %
270 % \begin{environment}{maintheorem}
271 %
272 % We change now for the main theorem styling
273 %
274 % \begin{macrocode}
275 \theorembodyfont{\itshape}
276 \theoremnumbering{Roman}
277 \newtheorem{maintheorem}{\maintheoremch@irxname}
278 \newtheorem*{nnmaintheorem}{\maintheoremch@irxname}
279 % \end{macrocode}
280 % \end{environment}
281 %
282 % \begin{environment}{proof}
283 % \begin{environment}{subproof}
284 %
285 % The proof environments. We use the boxempty symbol from the AMSa
286 % font.
287 %
288 % \begin{macrocode}
289 \DeclareMathSymbol\ch@irxboxempty{\mathord}{AMSa}{"03}
290 \theoremheaderfont{\scshape}
291 \theorembodyfont{\normalfont}
292 \theoremstyle{nonumberplain}
293 \theoremseparator{:}
294 \theoremsymbol{\hbox{$\ch@irxboxempty$}}
295 \newtheorem{proof}{\proofch@irxname}
296 \theoremsymbol{\hbox{$\triangledown$}}
297 \newtheorem{subproof}{\proofch@irxname}
298 % \end{macrocode}
299 % \end{environment}
300 % \end{environment}
301 %
302 % \begin{environment}{hint}
303 %
304 % The hint environment, without numbers and very small.
305 %
306 % \begin{macrocode}
307 \newenvironment{hint}{\par\footnotesize\medskip\noindent\hintch@irxname: }{\par\smallskip\normalsize}
308 % \end{macrocode}
309 %
310 % \end{environment}
311 %
312 % In the theorem titles only the ordinary text in boldface, not the
313 % math formulas. Nice hack from David Carlisle via tex.stackexchange
314 %
315 % \begin{macrocode}
316 \def\theorem@checkbold{}
317 % \end{macrocode}
318 %
319 % To make these new environments compatible with the |\autoref|
320 % macro of the |hyperref|-package, we need the following
321 % |\*autorefname| commands.
322 % \begin{macrocode}
323 \providecommand{\claimautorefname}{\claimch@irxname}
324 \providecommand{\conjectureautorefname}{\conjecturech@irxname}
325 \providecommand{\conventionautorefname}{\conventionch@irxname}
326 \providecommand{\corollaryautorefname}{\corollarych@irxname}
327 \providecommand{\definitionautorefname}{\definitionch@irxname}
328 \providecommand{\lemmaautorefname}{\lemmach@irxname}
329 \providecommand{\propositionautorefname}{\propositionch@irxname}
330 \providecommand{\exampleautorefname}{\examplech@irxname}
331 \providecommand{\notationautorefname}{\notationch@irxname}
332 \providecommand{\questionautorefname}{\questionch@irxname}
333 \providecommand{\remarkautorefname}{\remarkch@irxname}
334 \providecommand{\exerciseautorefname}{\exercisech@irxname}
335 \providecommand{\thmautorefname}{\theoremch@irxname}
336 \providecommand{\maintheoremautorefname}{\maintheoremch@irxname}
337 % \end{macrocode}
338 %
339 % To redefine |\*autorefname| commands which are predefined in |hyperref|,
340 % we need a little hack: to allow that |hyperref| is loaded after |nchairx|
341 % we put these commands at the beginning of the document part.
342 % \begin{macrocode}
343 \AtBeginDocument{
344 % \end{macrocode}
345 % Now we fill the |\*autorefname| macros with the language specific names,
346 % in order to guarantee compatibility with |babel|.
347 % First in english
348 % \begin{macrocode}
349 \@ifpackagewith{babel}{english,strings}{%
350 \StartBabelCommands{english}{extras}
351 \SetString{\chapterautorefname}{\chapterch@irxname}
352 \SetString{\sectionautorefname}{\sectionch@irxname}
353 \SetString{\subsectionautorefname}{\subsectionch@irxname}
354 \SetString{\subsubsectionautorefname}{\subsubsectionch@irxname}
355 \SetString{\theoremautorefname}{\theoremch@irxname}
356 \EndBabelCommands
357 }{}
358 % \end{macrocode}
359 % then in german
360 % \begin{macrocode}
361 \@ifpackagewith{babel}{german,strings}{%
362 \StartBabelCommands{german}{extras}
363 \SetString{\chapterautorefname}{\chapterch@irxname}
364 \SetString{\sectionautorefname}{\sectionch@irxname}
365 \SetString{\subsectionautorefname}{\subsectionch@irxname}
366 \SetString{\subsubsectionautorefname}{\subsubsectionch@irxname}
367 \SetString{\theoremautorefname}{\theoremch@irxname}
368 \EndBabelCommands
369 }{}
370 % \end{macrocode}
371 % Close the |\AtBeginDocument| command.
372 % \begin{macrocode}
373 }
374 % \end{macrocode}
375 %
376 %
377 % \begin{environment}{claimlist}
378 % \begin{environment}{conjecturelist}
379 % \begin{environment}{conventionlist}
380 % \begin{environment}{corollarylist}
381 % \begin{environment}{definitionlist}
382 % \begin{environment}{lemmalist}
383 % \begin{environment}{propositionlist}
384 % \begin{environment}{theoremlist}
385 % \begin{environment}{prooflist}
386 %
387 % Next, we define list environments for all the above types of
388 % math environments. They are build using the |enumitem| package
389 % and use a rather compact appearance. Each math environment has
390 % its own list, though all of them are equal at the moment.
391 %
392 % \begin{macrocode}
393 \newenvironment{claimlist}[1][]{%
394 \enumerate[%
395 topsep = 0.2em,
396 partopsep = 0em,
397 itemsep = 0.2em,
398 parsep = 0.1em,
399 label=\textit{\roman*.)},
400 #1%
401 ]%
402 }%
403 {\endenumerate}
404 \newenvironment{conjecturelist}[1][]{%
405 \enumerate[%
406 topsep = 0.2em,
407 partopsep = 0em,
408 itemsep = 0.2em,
409 parsep = 0.1em,
410 label=\textit{\roman*.)},
411 #1%
412 ]%
413 }%
414 {\endenumerate}
415 \newenvironment{conventionlist}[1][]{%
416 \enumerate[%
417 topsep = 0.2em,
418 partopsep = 0em,
419 itemsep = 0.2em,
420 parsep = 0.1em,
421 label=\textit{\roman*.)},
422 #1%
423 ]%
424 }%
425 {\endenumerate}
426 \newenvironment{corollarylist}[1][]{%
427 \enumerate[%
428 topsep = 0.2em,
429 partopsep = 0em,
430 itemsep = 0.2em,
431 parsep = 0.1em,
432 label=\textit{\roman*.)},
433 #1%
434 ]
435 }%
436 {\endenumerate}
437 \newenvironment{definitionlist}[1][]{%
438 \enumerate[%
439 topsep = 0.2em,
440 partopsep = 0em,
441 itemsep = 0.2em,
442 parsep = 0.1em,
443 label=\textit{\roman*.)},
444 #1%
445 ]
446 }%
447 {\endenumerate}
448 \newenvironment{lemmalist}[1][]{%
449 \enumerate[%
450 topsep = 0.2em,
451 partopsep = 0em,
452 itemsep = 0.2em,
453 parsep = 0.1em,
454 label=\textit{\roman*.)},
455 #1%
456 ]
457 }%
458 {\endenumerate}
459 \newenvironment{propositionlist}[1][]{%
460 \enumerate[%
461 topsep = 0.2em,
462 partopsep = 0em,
463 itemsep = 0.2em,
464 parsep = 0.1em,
465 label=\textit{\roman*.)},
466 #1%
467 ]
468 }%
469 {\endenumerate}
470 \newenvironment{theoremlist}[1][]{%
471 \enumerate[%
472 topsep = 0.2em,
473 partopsep = 0em,
474 itemsep = 0.2em,
475 parsep = 0.1em,
476 label=\textit{\roman*.)},
477 #1%
478 ]
479 }%
480 {\endenumerate}
481 \newenvironment{prooflist}[1][]{%
482 \enumerate[%
483 topsep = 0.2em,
484 partopsep = 0em,
485 itemsep = 0.2em,
486 parsep = 0.1em,
487 label=\textit{\roman*.)},
488 #1%
489 ]
490 }%
491 {\endenumerate}
492 % \end{macrocode}
493 %
494 % \end{environment}
495 % \end{environment}
496 % \end{environment}
497 % \end{environment}
498 % \end{environment}
499 % \end{environment}
500 % \end{environment}
501 % \end{environment}
502 % \end{environment}
503 %
504 % \begin{environment}{examplelist}
505 % \begin{environment}{notationlist}
506 % \begin{environment}{questionlist}
507 % \begin{environment}{remarklist}
508 %
509 % Also for the following environments we have lists:
510 %
511 % \begin{macrocode}
512 \newenvironment{examplelist}[1][]{%
513 \enumerate[%
514 topsep = 0.2em,
515 partopsep = 0em,
516 itemsep = 0.2em,
517 parsep = 0.1em,
518 label=\textit{\roman*.)},
519 #1%
520 ]%
521 }%
522 {\endenumerate}
523 \newenvironment{notationlist}[1][]{%
524 \enumerate[%
525 topsep = 0.2em,
526 partopsep = 0em,
527 itemsep = 0.2em,
528 parsep = 0.1em,
529 label=\textit{\roman*.)},
530 #1%
531 ]%
532 }%
533 {\enumerate}
534 \newenvironment{questionlist}[1][]{%
535 \enumerate[%
536 topsep = 0.2em,
537 partopsep = 0em,
538 itemsep = 0.2em,
539 parsep = 0.1em,
540 label=\textit{\roman*.)},
541 #1%
542 ]%
543 }%
544 {\endenumerate}
545 \newenvironment{remarklist}[1][]{%
546 \enumerate[%
547 topsep = 0.2em,
548 partopsep = 0em,
549 itemsep = 0.2em,
550 parsep = 0.1em,
551 label=\textit{\roman*.)},
552 #1%
553 ]%
554 }%
555 {\endenumerate}
556 % \end{macrocode}
557 % \end{environment}
558 % \end{environment}
559 % \end{environment}
560 % \end{environment}
561 %
562 % \begin{environment}{exerciselist}
563 %
564 % For the exercises we also need a separate list.
565 %
566 % \begin{macrocode}
567 \newenvironment{exerciselist}[1][]{%
568 \enumerate[%
569 topsep = 0.2em,
570 partopsep = 0em,
571 itemsep = 0.2em,
572 parsep = 0.1em,
573 label=\textit{\roman*.)},
574 #1%
575 ]%
576 }%
577 {\endenumerate}
578 % \end{macrocode}
579 % \end{environment}
580 %
581 % \begin{environment}{maintheoremlist}
582 %
583 % And the main theorem might also consist of several parts which
584 % we want to number.
585 %
586 % \begin{macrocode}
587 \newenvironment{maintheoremlist}[1][]{%
588 \enumerate[%
589 topsep = 0.2em,
590 partopsep = 0em,
591 itemsep = 0.2em,
592 parsep = 0.1em,
593 label=\textit{\roman*.)},
594 #1%
595 ]%
596 }%
597 {\endenumerate}
598 % \end{macrocode}
599 % \end{environment}
600 %
601 % We also provide compact versions of the lists in general (similar to
602 % the |paralist| package)
603 %
604 % \begin{environment}{cptenum}
605 % \begin{macrocode}
606 \newenvironment{cptenum}[1][]{%
607 \enumerate[%
608 topsep = 0.2em,
609 partopsep = 0em,
610 itemsep = 0.2em,
611 parsep = 0.1em,
612 label=\textit{\roman*.)},
613 #1%
614 ]
615 }%
616 {\endenumerate}
617 % \end{macrocode}
618 % \end{environment}
619 %
620 % \begin{environment}{cptitem}
621 % \begin{macrocode}
622 \newenvironment{cptitem}[1][]{%
623 \begin{itemize}[%
624 topsep = 0.2em,
625 partopsep = 0em,
626 itemsep = 0.2em,
627 parsep = 0.1em,
628 #1%
629 ]
630 }%
631 {\end{itemize}}
632 % \end{macrocode}
633 % \end{environment}
634 %
635 % \begin{environment}{cptdesc}
636 % \begin{macrocode}
637 \newenvironment{cptdesc}[1][]{%
638 \begin{description}[%
639 topsep = 0.2em,
640 partopsep = 0em,
641 itemsep = 0.2em,
642 parsep = 0.1em,
643 #1%
644 ]
645 }%
646 {\end{description}}
647 % \end{macrocode}
648 % \end{environment}
649 %