Debian Codegraph @

texmf-dist/tex/latex/base/doc.sty

raw
1 %%
2 %% This is file `doc.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% doc.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% The source is maintained by the LaTeX Project team and bug
12 %% reports for it can be opened at https://latex-project.org/bugs.html
13 %% (but please observe conditions on bug reports sent to that address!)
14 %%
15 %%
16 %% Copyright (C) 1993-2025
17 %% The LaTeX Project and any individual authors listed elsewhere
18 %% in this file.
19 %%
20 %% This file was generated from file(s) of the LaTeX base system.
21 %% --------------------------------------------------------------
22 %%
23 %% It may be distributed and/or modified under the
24 %% conditions of the LaTeX Project Public License, either version 1.3c
25 %% of this license or (at your option) any later version.
26 %% The latest version of this license is in
27 %% https://www.latex-project.org/lppl.txt
28 %% and version 1.3c or later is part of all distributions of LaTeX
29 %% version 2008 or later.
30 %%
31 %% This file has the LPPL maintenance status "maintained".
32 %%
33 %% This file may only be distributed together with a copy of the LaTeX
34 %% base system. You may however distribute the LaTeX base system without
35 %% such generated files.
36 %%
37 %% The list of all files belonging to the LaTeX base distribution is
38 %% given in the file `manifest.txt'. See also `legal.txt' for additional
39 %% information.
40 %%
41 %% The list of derived (unpacked) files belonging to the distribution
42 %% and covered by LPPL is defined by the unpacking scripts (with
43 %% extension .ins) which are part of the distribution.
44 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
45
46 \DeclareRelease{}{1994-06-01}
47 {doc-2016-02-15.sty}
48 \DeclareRelease{v2.1g}{2016-02-15}
49 {doc-2016-02-15.sty}
50 \DeclareRelease{v2}{2021-06-01}
51 {doc-2021-06-01.sty}
52 \DeclareCurrentRelease{v3}{2022-06-01}
53
54 \ProvidesPackage{doc}
55 [2024/12/25 v3.0q
56 Standard LaTeX documentation package V3 (FMi)]
57 %%
58 %% Package `doc' to use with LaTeX 2e
59 %% Copyright (C) 1989-2023 Frank Mittelbach, all rights reserved.
60
61
62
63
64
65
66 \@ifundefined{macro@cnt}{}{\endinput}
67 \catcode`\^^A=14
68 \catcode`\^^X=14
69 \AtBeginDocument{\catcode`\^^A=14\relax\catcode`\^^X=14\relax}
70 \DeclareKeys
71 {
72 noprint .if = {doc@noprint},
73 noindex .if = {doc@noindex},
74 hyperref .if = {doc@hyperref},
75 nohyperref .ifnot = {doc@hyperref},
76 multicol .if = {doc@multicol},
77 nomulticol .ifnot = {doc@multicol},
78 debugshow .if = {doc@debugshow},
79 reportchangedates .if = {doc@reportchangedates},
80 toplevel .if = {doc@toplevel},
81 notoplevel .ifnot = {doc@toplevel},
82 macrolike .if = {doc@macrolike},
83 envlike .ifnot = {doc@macrolike},
84 idxtype .store = \doc@idxtype,
85 idxgroup .store = \doc@idxgroup,
86 printtype .store = \doc@printtype,
87 outer .if = {doc@outer},
88 }
89 \doc@hyperreftrue
90 \doc@multicoltrue
91 \doc@topleveltrue
92 \ProcessKeyOptions
93 \newif\ifscan@allowed \scan@allowedtrue
94 \def\SetupDoc#1{%
95 \csname keys_set:nn\endcsname{doc}{#1}%
96 \edef\doc@noprintdefault{\ifdoc@noprint true\else false\fi}%
97 \ifdoc@noindex
98 \def\doc@noindexdefault{true}%
99 \scan@allowedfalse
100 \else
101 \def\doc@noindexdefault{false}%
102 \fi
103 }
104 \SetupDoc{} % just save the default values
105 \def\macrocode{\macro@code
106 \frenchspacing \@vobeyspaces
107 \xmacro@code}
108 \def\macro@code{%
109 \topsep \MacrocodeTopsep
110 \@beginparpenalty \predisplaypenalty
111 \if@inlabel\leavevmode\fi
112 \trivlist \parskip \z@ \item[]%
113 \global\setbox\@labels\box\voidb@x
114 \macro@font
115 \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
116 \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
117 \blank@linefalse \def\par{\ifblank@line
118 \leavevmode\fi
119 \blank@linetrue\@@par
120 \penalty\interlinepenalty}
121 \obeylines
122 \@noligs
123 \let\do\@makeother \dospecials
124 \global\@newlistfalse
125 \global\@minipagefalse
126 \ifcodeline@index
127 \everypar{\global\advance\c@CodelineNo\@ne
128 \llap{\theCodelineNo\ \hskip\@totalleftmargin}%
129 \check@module}%
130 \else \everypar{\check@module}%
131 \fi
132 \init@crossref}
133 \newif\ifblank@line
134 \def\endmacrocode{%
135 \ifpm@module \endgroup \pm@modulefalse \fi
136 \everypar{}%
137 \global\@inlabelfalse
138 \endtrivlist
139 \close@crossref}
140 \@ifundefined{MacroFont}{%
141 \if@compatibility
142 \def\MacroFont{\small
143 \usefont\encodingdefault
144 \ttdefault
145 \mddefault
146 \shapedefault
147 }%
148 \else
149 \def\MacroFont{\fontencoding\encodingdefault
150 \fontfamily\ttdefault
151 \fontseries\mddefault
152 \fontshape\shapedefault
153 \small}%
154 \fi
155 }{}
156 \@ifundefined{AltMacroFont}{%
157 \if@compatibility
158 \def\AltMacroFont{\small
159 \usefont\encodingdefault
160 \ttdefault
161 \mddefault
162 \sldefault
163 }%
164 \else
165 \def\AltMacroFont{\fontencoding\encodingdefault
166 \fontfamily\ttdefault
167 \fontseries\mddefault
168 \fontshape\sldefault
169 \small
170 }%
171 \fi
172 }{}
173 \AtBeginDocument{\let\macro@font\MacroFont}
174 \def\check@module{%
175 \ifcheck@modules
176 \ifpm@module \endgroup \pm@modulefalse \fi
177 \expandafter\futurelet\expandafter\next\expandafter\ch@percent
178 \fi}
179 \newif\ifpm@module
180 \def\DontCheckModules{\check@modulesfalse}
181 \def\CheckModules{\check@modulestrue}
182 \newif\ifcheck@modules \check@modulestrue
183 \def\ch@percent{%
184 \if \percentchar\next
185 \expandafter\check@angle
186 \fi}
187 \def\check@angle#1{\futurelet\next\ch@angle}
188 \begingroup
189 \catcode`\<\active
190 \gdef\ch@angle{\ifx<\next
191 \expandafter\ch@plus@etc
192 \else \percentchar \fi}
193 \gdef\ch@plus@etc<{\futurelet\next\check@plus@etc}
194 \gdef\check@plus@etc{%
195 \if +\next
196 \let\next\pm@module
197 \else\if -\next
198 \let\next\pm@module
199 \else\if *\next
200 \let\next\star@module
201 \else\if /\next
202 \let\next\slash@module
203 \else\ifx <\next
204 \percentchar
205 \else
206 \let\next\pm@module
207 \fi\fi\fi\fi\fi
208 \next}
209 \endgroup
210 \begingroup
211 \catcode`\~=\active
212 \lccode`\~=`\>
213 \lowercase{\gdef\pm@module#1~}{\pm@moduletrue
214 \Module{#1}\begingroup
215 \advance\guard@level\@ne
216 \ifnum\guard@level>\c@StandardModuleDepth\AltMacroFont\fi
217 }
218 \lowercase{\gdef\star@module#1~}{%
219 \Module{#1}%
220 \global \advance \guard@level\@ne
221 \ifnum \guard@level>\c@StandardModuleDepth
222 \global\let\macro@font=\AltMacroFont \macro@font
223 \fi}
224 \catcode`\>=\active
225 \gdef\slash@module#1>{%
226 \Module{#1}%
227 \global \advance \guard@level\m@ne
228 \ifnum \guard@level=\c@StandardModuleDepth
229 \global\let\macro@font\MacroFont \macro@font
230 \fi
231 }
232 \endgroup
233 \newcounter{StandardModuleDepth}
234 \newcount \guard@level
235
236 \@ifundefined{Module}{%
237 \def\Module#1{\mod@math@codes$\langle\mathsf{#1}\rangle$}
238 }{}
239 \def\mod@math@codes{\mathcode`\|="226A \mathcode`\&="2026
240 \mathcode`\-="702D \mathcode`\+="702B
241 \mathcode`\:="703A \mathcode`\=="703D }
242 \newskip\MacrocodeTopsep \MacrocodeTopsep = 3pt plus 1.2pt minus 1pt
243 \newdimen\MacroIndent
244 \settowidth\MacroIndent{\rmfamily\scriptsize 00\ }
245 \@namedef{macrocode*}{\macro@code\sxmacro@code}
246 \expandafter\let\csname endmacrocode*\endcsname = \endmacrocode
247 \catcode`\!=\catcode`\% ^^A In this section there must not be
248 ^^A any exclamation marks.
249 ^^A
250 \begingroup
251 \catcode`\|=\z@ \catcode`\[=\@ne \catcode`\]=\tw@
252 \catcode`\{=12 \catcode`\}=12
253 \catcode`\%=12 \catcode`\ =\active \catcode`\\=\active
254 !% \end{macrocode*}
255 ! Next follows the actual definition of |\macro@code|;
256 ! notice the
257 ! use of the new escape character. We manage to get the argument
258 ! surrounded by the string |\end{macrocode}|, but at the end
259 ! however, in spite of the actual characters used during the
260 ! definition of
261 ! this macro, |\end| with the argument |{macrocode}|
262 ! will be executed, to ensure a balanced environment.
263 ! \begin{macrocode*}
264 |gdef|xmacro@code#1% \end{macrocode}[#1|end[macrocode]]
265 !% \end{macrocode*}
266 ! \begin{macro}{\sxmacro@code}
267 ! The definition of |\sxmacro@code| is completely analogous,
268 ! only
269 ! here a slightly different terminating string will be used.
270 ! Note that the space is not active in this environment.
271 ! \begin{macrocode}
272 |catcode`| =12
273 |gdef|sxmacro@code#1% \end{macrocode*}[#1|end[macrocode*]]
274 !% \end{macrocode}
275 ! because the |\catcode| changes have been made local by
276 ! commencing a
277 ! new group, there now follows the matching |\endgroup|
278 ! in a rather
279 ! unusual style of writing.
280 ! \begin{macrocode}
281 |endgroup
282 !% \end{macrocode}
283 \catcode`\!=12
284
285 \reversemarginpar
286 \setlength\marginparpush{0pt} \setlength\marginparwidth{8pc}
287 \setlength\marginparsep{\labelsep}
288 {\catcode`\|=\z@ \catcode`\\=12
289 |gdef|bslash{\}}
290 \def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim
291 \MacroFont \frenchspacing \@vobeyspaces \@xverbatim}
292 \@namedef{verbatim*}{\@beginparpenalty \predisplaypenalty \@verbatim
293 \@setupverbvisiblespace
294 \MacroFont \@vobeyspaces \@sxverbatim}
295 \def\@verbatim{\trivlist \item\relax
296 \if@minipage\else\vskip\parskip\fi
297 \leftskip\@totalleftmargin\rightskip\z@
298 \parindent\z@\parfillskip\@flushglue\parskip\z@
299 \language\l@nohyphenation
300 \@@par
301 \@tempswafalse
302 \def\par{%
303 \if@tempswa
304 \leavevmode \null \@@par\penalty\interlinepenalty
305 \else
306 \@tempswatrue
307 \ifhmode\@@par\penalty\interlinepenalty\fi
308 \fi
309 \check@percent}%
310 \let\do\@makeother \dospecials
311 \obeylines \verbatim@font \@noligs
312 \everypar \expandafter{\the\everypar \unpenalty}%
313 }
314 {\catcode`\%=12
315 \long\gdef\check@percent#1{\ifx #1%\let\next\@empty \else
316 \let\next=#1\fi \next}}
317 \newcount\macro@cnt \macro@cnt=0
318 \newskip\MacroTopsep \MacroTopsep = 7pt plus 2pt minus 2pt
319 \begingroup
320 \catcode`\~\active
321 \gdef\SpecialEscapechar#1{%
322 \begingroup
323 \uccode`\~`#1%
324 \uppercase{\gdef\active@escape@char{~}}%
325 \escapechar\m@ne \xdef\special@escape@char{\string#1}%
326 \endgroup}
327 \endgroup
328 \begingroup \catcode`\|=\z@ \catcode`\\=\active
329 |gdef|init@crossref{|catcode`|\|active |let\|bslash
330 |MakePrivateLetters
331 |catcode|expandafter`|special@escape@char|active
332 |expandafter|let|active@escape@char|scan@macro}
333 |endgroup
334 \SpecialEscapechar{\\}
335 \@ifundefined{MakePrivateLetters}
336 {\let\MakePrivateLetters\makeatletter}{}
337 \def\close@crossref{\SpecialEscapechar\\}
338 \def\scan@macro{%
339 \special@escape@char
340 \step@checksum
341 \ifscan@allowed
342 \let\macro@namepart\@empty
343 \def\next{\futurelet\next\macro@switch}%
344 \else \let\next\@empty \fi
345 \next}
346 \def\DisableCrossrefs{\@bsphack\scan@allowedfalse\@esphack}
347 \def\EnableCrossrefs{\@bsphack\scan@allowedtrue
348 \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack}
349 \def\macro@switch{\ifcat\noexpand\next a%
350 \let\next\macro@name
351 \else \let\next\short@macro \fi
352 \next}
353 \def\short@macro#1{%
354 \edef\macro@namepart{\string#1}%
355 \maybe@index@short@macro\macro@namepart
356 \scan@allowedfalse#1%
357 \scan@allowedtrue }
358 \def\macro@name#1{\edef\macro@namepart{\macro@namepart#1}%
359 \futurelet\next\more@macroname}
360 \def\more@macroname{\ifcat\noexpand\next a%
361 \let\next\macro@name
362 \else \let\next\macro@finish \fi
363 \next}
364 \def\macro@finish{%
365 \macro@namepart
366 \maybe@index@macro \macro@namepart
367 }
368
369 \ExplSyntaxOn
370 \seq_new:N \l__doc_donotindex_seq
371 \prop_new:N \g__doc_idxtype_prop
372 \cs_new:Npn\__doc_trace:x {
373 \legacy_if:nTF{ doc@debugshow }{ \iow_term:x } { \use_none:n }
374 }
375 \cs_new:Npn \doc_dont_index:n {
376 \group_begin:
377 \MakePrivateLetters
378 \__doc_dont_index:n
379 }
380 \cs_new:Npn \__doc_dont_index:n #1 {
381 \group_end:
382 \__doc_trace:x{Disable~ indexing~ for~ '\tl_to_str:n{#1}' }
383 \clist_map_function:nN {#1} \__doc_dont_index_aux:n
384 }
385 \cs_new:Npn \__doc_dont_index_aux:n #1 {
386 \seq_put_right:Nx \l__doc_donotindex_seq {\expandafter\@gobble \string#1}
387 }
388 \cs_set_eq:NN \DoNotIndex \doc_dont_index:n
389 \def \ShowIndexingState {
390 \__doc_trace:x{Show~ doc~ indexing~ state:}
391 \seq_show:N \l__doc_donotindex_seq
392 \prop_show:N \g__doc_idxtype_prop
393 }
394
395 \cs_new:Npn \__doc_idxtype_put:Nn #1#2 {
396 \exp_args:Nx \__doc_idxtype_put:nn { \cs_to_str:N #1 }{#2}
397 \protected@write\@auxout{}
398 {\string\RecordIndexTypeAux {\string#1 }{#2} }
399 }
400 \cs_new:Npn \RecordIndexTypeAux #1#2 {
401 \exp_args:Nx \__doc_idxtype_put:nn { \cs_to_str:N #1 }{#2}
402 }
403 \AtEndDocument{
404 \cs_set_eq:NN \RecordIndexTypeAux \use_none:nn
405 }
406 \cs_set_eq:NN \RecordIndexType \__doc_idxtype_put:Nn
407 \cs_new:Npn \__doc_idxtype_put_scan:nn #1#2 {
408 \exp_args:Nf \__doc_idxtype_put:nn { \tl_to_str:n {#1} }{#2}
409 \protected@write\@auxout{}
410 {\string\RecordIndexTypeAux {\bslash #1 }{#2} }
411 }
412 \cs_generate_variant:Nn \__doc_idxtype_put_scan:nn {o}
413 \cs_set_eq:NN \record@index@type@save \__doc_idxtype_put_scan:on
414 \cs_new:Npn \__doc_idxtype_put:nn #1#2 {
415 \exp_args:NNf
416 \seq_if_in:NnTF \l__doc_donotindex_seq {\tl_to_str:n{#1}}
417 {
418 \__doc_trace:x{Not~ recording~ index~ type~ for~ '\bslash #1' }
419 }
420 {
421 \__doc_trace:x{Recording~ index~ type~ for~ '\bslash #1' ~ as~ #2 }
422 \prop_gput:Nnn \g__doc_idxtype_prop {#1}{#2}
423 }
424 }
425 \cs_new:Npn \exp_args:co #1#2
426 { \cs:w #1 \exp_after:wN \cs_end:\exp_after:wN {#2} }
427 \cs_generate_variant:Nn \tl_to_str:n {o}
428
429 \cs_new:Npn \__doc_maybe_index:o #1 {
430 \exp_args:Nf \__doc_maybe_index_aux:nN { \tl_to_str:o {#1} }
431 \SpecialIndex
432 }
433 \cs_set_eq:NN \maybe@index@macro \__doc_maybe_index:o
434 \cs_new:Npn \__doc_maybe_index_short:o #1 {
435 \exp_args:No \__doc_maybe_index_aux:nN #1
436 \SpecialShortIndex
437 }
438 \cs_set_eq:NN \maybe@index@short@macro \__doc_maybe_index_short:o
439 \cs_new:Npn \__doc_maybe_index_aux:nN #1#2 {
440 \__doc_trace:x{Searching~ for~ '\bslash #1'}
441 \seq_if_in:NnTF \l__doc_donotindex_seq {#1}
442 {
443 \__doc_trace:x{Not~ indexing~ '\bslash #1' }
444 }
445 {
446 \prop_get:NnNTF \g__doc_idxtype_prop {#1} \l__doc_idxtype_tl
447 {
448 \exp_args:Ncno \__doc_maybe_index_aux:Nnn
449 { Code \tl_use:N \l__doc_idxtype_tl Index }
450 {code} {\bslash #1}
451 }
452 {
453 \__doc_trace:x{Indexing~ '\bslash #1'\space (\string #2)}
454 \exp_args:No #2 {\bslash #1}
455 }
456 }
457 }
458 \cs_new:Npn \SpecialShortIndex #1 {
459 \@SpecialIndexHelper@ #1\@nil
460 \@bsphack
461 \ifdoc@noindex \else
462 \str_case_e:nnF {\@gtempa }
463 {
464 {\cs_to_str:N \^^M } {\def\reserved@a{ \string \space \actualchar }
465 \def\reserved@b { \space }
466 \let\reserved@c \@empty }
467 { ~ } {\def\reserved@a{ \string \space \actualchar }
468 \def\reserved@b { \space }
469 \let\reserved@c \@empty }
470 {\c_left_brace_str} { \def\reserved@a{ \bgroup \actualchar }
471 \def\reserved@b { \c_left_brace_str }
472 \def\reserved@c { \noexpand\iffalse
473 \c_right_brace_str
474 \noexpand\fi } }
475 {\c_right_brace_str} { \def\reserved@a{ \egroup \actualchar
476 \noexpand\iffalse
477 \c_left_brace_str
478 \noexpand\fi }
479 \def\reserved@b { \c_right_brace_str }
480 \let\reserved@c \@empty }
481 {\verbatimchar} { \def\reserved@a{ \quotechar\verbatimchar
482 \actualchar }
483 \let\reserved@b \@empty
484 \def\reserved@c
485 { \string\texttt{\string\string\verbatimchar} } }
486 }
487 { \def\reserved@a {\quotechar \@gtempa \actualchar }
488 \def\reserved@b {\quotechar \@gtempa }
489 \let\reserved@c \@empty }
490 \special@index {
491 \reserved@a
492 \string\verb
493 \quotechar *\verbatimchar \quotechar \bslash
494 \reserved@b
495 \verbatimchar
496 \reserved@c
497 \encapchar code}
498 \fi
499 \@esphack
500 }
501
502 \cs_new:Npn \__doc_maybe_index_aux:Nnn #1#2#3 {
503 \cs_if_exist:NTF #1
504 {
505 \__doc_trace:x{Indexing~ '#3'\space as~
506 \tl_use:N \l__doc_idxtype_tl }
507 #1{#2}{#3}
508 }
509 {
510 \PackageError{doc}{Doc~ element~
511 '\tl_use:N \l__doc_idxtype_tl'~ unknown}%
512
513 {When~ using~ '\string\RecordIndexType'~ the~ type~ must~
514 be~ known~\MessageBreak
515 to~ the~ system,~ i.e.,~ declared~ via~
516 '\string\NewDocElement'\MessageBreak
517 before~ it~ can~ be~ used~ in~ indexing.}
518 }
519 }
520 \ExplSyntaxOff
521 \@ifundefined{actualchar}{\def\actualchar{=}}{}
522 \@ifundefined{quotechar}{\def\quotechar{!}}{}
523 \@ifundefined{levelchar}{\def\levelchar{>}}{}
524 \@ifundefined{encapchar}{\def\encapchar{|}}{}
525 \@ifundefined{verbatimchar}{\def\verbatimchar{+}}{}
526 \begingroup
527 \catcode`\|=0
528 \catcode`\\=12
529 |gdef|@SpecialIndexHelper@#1#2|@nil{%
530 |if |noexpand#1\%
531 |gdef|@gtempa{#2}%
532 |else
533 |begingroup
534 |escapechar|m@ne
535 |expandafter|gdef|expandafter|@gtempa|expandafter{|string#1#2}%
536 |endgroup
537 |fi}
538 |endgroup
539 \def\SortIndex#1#2{%
540 \ifdoc@noindex\else
541 \index{#1\actualchar#2}%
542 \fi
543 }
544 \@ifundefined{LeftBraceIndex}{\def\LeftBraceIndex{%
545 \special@index{\bgroup\actualchar
546 \string\verb% % to fool emacs highlighting
547 \quotechar*\verbatimchar
548 \quotechar\bslash{\verbatimchar\string\iffalse}\string\fi}}}{}
549
550 \@ifundefined{RightBraceIndex}{\def\RightBraceIndex{%
551 \special@index{\egroup\actualchar\string\iffalse{\string\fi
552 \string\verb% % to fool emacs highlighting
553 \quotechar*\verbatimchar\quotechar\bslash}\verbatimchar}}}{}
554 \@ifundefined{PercentIndex}
555 {\def\PercentIndex{\it@is@a\percentchar}}{}
556 \def\OldMakeindex{\def\PercentIndex{%
557 \special@index{\quotechar\percentchar\actualchar
558 \string\verb% % to fool emacs highlighting
559 \quotechar*\verbatimchar\quotechar\bslash
560 \percentchar\percentchar\verbatimchar}}}
561 {\catcode`\%=12 \gdef\percentchar{%}}
562 \def\it@is@a#1{\special@index{\quotechar #1\actualchar
563 \string\verb% % to fool emacs highlighting
564 \quotechar*\verbatimchar
565 \quotechar\bslash\quotechar#1\verbatimchar}}
566
567 \newdimen\IndexMin \IndexMin = 80pt
568 \newcount\c@IndexColumns \c@IndexColumns = 3
569 \ifdoc@multicol
570 \RequirePackage{multicol}
571 \renewenvironment{theindex}
572 {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]%
573 \IndexParms \let\item\@idxitem \ignorespaces}%
574 {\end{multicols}}
575 \else
576 \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
577 \columnseprule \z@ \columnsep 35\p@
578 \twocolumn[\index@prologue]%
579 \IndexParms \let\item\@idxitem \ignorespaces}
580 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
581 \fi
582 \long\def\IndexPrologue#1{\@bsphack\def\index@prologue{#1}\@esphack}
583 \@ifundefined{index@prologue}
584 {\def\index@prologue{\section*{Index}%
585 \markboth{Index}{Index}%
586 Numbers written in italic refer to the page
587 where the corresponding entry is described;
588 numbers underlined refer to the
589 \ifcodeline@index
590 code line of the
591 \fi
592 definition; numbers in roman refer to the
593 \ifcodeline@index
594 code lines
595 \else
596 pages
597 \fi
598 where the entry is used.
599 }}{}
600 \@ifundefined{IndexParms}
601 {\def\IndexParms{%
602 \parindent \z@
603 \columnsep 15pt
604 \parskip 0pt plus 1pt
605 \rightskip 15pt
606 \mathsurround \z@
607 \parfillskip=-15pt
608 \small
609 \def\@idxitem{\par\hangindent 30pt}%
610 \def\subitem{\@idxitem\hspace*{15pt}}%
611 \def\subsubitem{\@idxitem\hspace*{25pt}}%
612 \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}%
613 }}{}
614 \def\efill{\hfill\nopagebreak}%
615 \def\pfill{\unskip~%
616 \leaders\hbox to.6em{\hss .\hss}\hfill
617 \penalty500\strut\nobreak
618 \leaders\hbox to.6em{\hss .\hss}\hfil
619 ~\ignorespaces}%
620 \def\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}}
621 \@ifundefined{main}{\def\main#1{\underline{#1}}}{}
622 \@ifundefined{usage}{\def\usage#1{\textit{#1}}}{}
623 \@ifundefined{code}{\def\code#1{#1}}{}
624 \def\PrintIndex{\@input@{\jobname.ind}%
625 \global\let\PrintIndex\@empty}
626 \def\changes{\@bsphack\begingroup\@sanitize
627 \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore
628 \changes@}
629 \def\changes@#1#2#3{%
630 \protected@edef\@tempa{\noexpand\glossary{#1%
631 \ifdoc@reportchangedates
632 \space -- #2\fi
633 \levelchar
634 \ifx\saved@macroname\@empty
635 \quotechar!%
636 \actualchar
637 \generalname
638 \else
639 \saved@indexname
640 \actualchar
641 \string\verb% % to fool emacs highlighting
642 \quotechar*%
643 \verbatimchar\saved@macroname
644 \verbatimchar
645 \fi
646 :\levelchar #3}}%
647 \@tempa\endgroup\@esphack}
648 \def\saved@macroname{}
649 \def\saved@indexname{}
650 \def\generalname{General}
651 \let\RecordChanges\makeglossary
652 \newdimen\GlossaryMin \GlossaryMin = 80pt
653 \newcount\c@GlossaryColumns \c@GlossaryColumns = 2
654 \ifdoc@multicol
655 \newenvironment{theglossary}{%
656 \begin{multicols}\c@GlossaryColumns
657 [\glossary@prologue][\GlossaryMin]%
658 \GlossaryParms \let\item\@idxitem \ignorespaces}%
659 {\end{multicols}}
660 \else
661 \newenvironment{theglossary}{%
662 \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
663 \columnseprule \z@ \columnsep 35\p@
664 \twocolumn[\glossary@prologue]%
665 \GlossaryParms \let\item\@idxitem \ignorespaces}
666 {\if@restonecol\onecolumn\else\clearpage\fi}
667 \fi
668 \long\def\GlossaryPrologue#1{\@bsphack
669 \def\glossary@prologue{#1}%
670 \@esphack}
671 \@ifundefined{glossary@prologue}
672 {\def\glossary@prologue{\section*{{Change History}}%
673 \markboth{{Change History}}{{Change History}}%
674 }}{}
675 \@ifundefined{GlossaryParms}{\let\GlossaryParms\IndexParms
676 \expandafter\def\expandafter\GlossaryParms\expandafter{\GlossaryParms
677 \rightskip 15pt plus 1fil
678 \parfillskip -15pt plus -1fil\relax}
679 }{}
680 \def\PrintChanges{\@input@{\jobname.gls}%
681 \global\let\PrintChanges\@empty}
682 \newcommand\AlsoImplementation{%
683 \long\def\MaybeStop##1{\@bsphack\gdef\Finale{##1%
684 \check@checksum}%
685 \init@checksum
686 \@esphack}%
687 }
688 \AlsoImplementation
689 \def\OnlyDescription{\@bsphack\long\def\MaybeStop##1{%
690 ##1\endinput}\@esphack}
691 \let\Finale\relax
692 \def\StopEventually{\MaybeStop}
693 \ifx\l@nohyphenation\undefined
694 \newlanguage\l@nohyphenation
695 \fi
696 \DeclareRobustCommand\meta[1]{%
697 \ensuremath\langle
698 \ifmmode \expandafter \nfss@text \fi
699 {%
700 \meta@font@select
701 \edef\meta@hyphen@restore
702 {\hyphenchar\the\font\the\hyphenchar\font}%
703 \hyphenchar\font\m@ne
704 \language\l@nohyphenation
705 #1\/%
706 \meta@hyphen@restore
707 }\ensuremath\rangle
708 }
709 \def\meta@font@select{\itshape}
710 \def\IndexInput#1{%
711 \begingroup \macro@code
712 \frenchspacing \@vobeyspaces
713 \input{#1}\endmacrocode
714 \endgroup}
715 \def\maketitle{\par
716 \begingroup \def \thefootnote {\fnsymbol {footnote}}%
717 \setcounter {footnote}\z@
718 \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
719 \long\def\@makefntext##1{\parindent 1em\noindent
720 \hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
721 \if@twocolumn \twocolumn [\@maketitle ]%
722 \else \newpage \global \@topnum \z@ \@maketitle \fi
723 \thispagestyle{titlepage}\@thanks \endgroup
724 \setcounter {footnote}\z@
725 \gdef\@date{\today}\gdef\@thanks{}%
726 \gdef\@author{}\gdef\@title{}}
727 \@ifundefined{ps@titlepage}
728 {\let\ps@titlepage=\ps@plain}{}
729 \def\MakeShortVerb{%
730 \@ifstar
731 {\def\@shortvrbdef{\verb*}\@MakeShortVerb}%
732 {\def\@shortvrbdef{\verb}\@MakeShortVerb}}
733 \def\@MakeShortVerb#1{%
734 \expandafter\ifx\csname cc\string#1\endcsname\relax
735 \@shortvrbinfo{Made }{#1}\@shortvrbdef
736 \add@special{#1}%
737 \expandafter
738 \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
739 \begingroup
740 \catcode`\~\active \lccode`\~`#1%
741 \lowercase{%
742 \global\expandafter\let
743 \csname ac\string#1\endcsname~%
744 \expandafter\gdef\expandafter~\expandafter{\@shortvrbdef~}}%
745 \endgroup
746 \global\catcode`#1\active
747 \else
748 \@shortvrbinfo\@empty{#1 already}%
749 {\@empty\verb% % to fool emacs highlighting
750 (*)}%
751 \fi}
752 \def\DeleteShortVerb#1{%
753 \expandafter\ifx\csname cc\string#1\endcsname\relax
754 \@shortvrbinfo\@empty{#1 not}%
755 {\@empty\verb% % to fool emacs highlighting
756 (*)}%
757 \else
758 \@shortvrbinfo{Deleted }{#1 as}%
759 {\@empty\verb% % to fool emacs
760 % highlighting
761 (*)}%
762 \rem@special{#1}%
763 \global\catcode`#1\csname cc\string#1\endcsname
764 \global \expandafter\let \csname cc\string#1\endcsname \relax
765 \ifnum\catcode`#1=\active
766 \begingroup
767 \catcode`\~\active \lccode`\~`#1%
768 \lowercase{%
769 \global\expandafter\let\expandafter~%
770 \csname ac\string#1\endcsname}%
771 \endgroup \fi \fi}
772 \def\@shortvrbinfo#1#2#3{%
773 \PackageInfo{doc}{%
774 #1\expandafter\@gobble\string#2 a short reference
775 for \expandafter\string#3}}
776 \def\add@special#1{%
777 \rem@special{#1}%
778 \expandafter\gdef\expandafter\dospecials\expandafter
779 {\dospecials \do #1}%
780 \expandafter\gdef\expandafter\@sanitize\expandafter
781 {\@sanitize \@makeother #1}}
782 \def\rem@special#1{%
783 \def\do##1{%
784 \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
785 \xdef\dospecials{\dospecials}%
786 \begingroup
787 \def\@makeother##1{%
788 \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
789 \xdef\@sanitize{\@sanitize}%
790 \endgroup}
791 \def\init@checksum{\relax
792 \global\bslash@cnt\z@}
793 \def\check@checksum{\relax
794 \ifnum\check@sum>\m@ne
795 \ifnum\check@sum=\z@
796 \typeout{**********************************}%
797 \typeout{* This macro file has no checksum!}%
798 \typeout{* The checksum should be \the\bslash@cnt!}%
799 \typeout{**********************************}%
800 \else
801 \ifnum\check@sum=\bslash@cnt
802 \typeout{*******************}%
803 \typeout{* Checksum passed *}%
804 \typeout{*******************}%
805 \else
806 \PackageError{doc}{Checksum not passed
807 (\the\check@sum<>\the\bslash@cnt)}%
808 {The file currently documented seems to be wrong.^^J%
809 Try to get a correct version.}%
810 \fi
811 \fi
812 \fi
813 \global\check@sum\m@ne}
814 \newcount\check@sum \check@sum = \m@ne
815 \newcount\bslash@cnt \bslash@cnt = \z@
816 \def\CheckSum#1{\@bsphack\global\check@sum#1\relax\@esphack}
817 \def\step@checksum{\global\advance\bslash@cnt\@ne}
818 \def\CharacterTable{\begingroup \CharTableChanges \character@table}
819 \begingroup
820 \catcode`\~=11
821 \gdef\character@table#1{\def\used~table{#1}%
822 \ifx\used~table\default~table
823 \typeout{***************************}%
824 \typeout{* Character table correct *}%
825 \typeout{***************************}%
826 \else
827 \PackageError{doc}{Character table corrupted}
828 {\the\wrong@table}
829 \show\default~table
830 \show\used~table
831 \fi
832 \endgroup}
833 \global\let\CharTableChanges\@empty
834 \makeatother
835 \gdef\default~table
836 {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
837 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
838 Digits \0\1\2\3\4\5\6\7\8\9
839 Exclamation \! Double quote \" Hash (number) \#
840 Dollar \$ Percent \% Ampersand \&
841 Acute accent \' Left paren \( Right paren \)
842 Asterisk \* Plus \+ Comma \,
843 Minus \- Point \. Solidus \/
844 Colon \: Semicolon \; Less than \<
845 Equals \= Greater than \> Question mark \?
846 Commercial at \@ Left bracket \[ Backslash \\
847 Right bracket \] Circumflex \^ Underscore \_
848 Grave accent \` Left brace \{ Vertical bar \|
849 Right brace \} Tilde \~}
850 \endgroup
851 \newhelp\wrong@table{Some of the ASCII characters are corrupted.^^J
852 I now \string\show\space you both tables for comparison.}
853 \newif\ifcodeline@index \codeline@indexfalse
854 \let\CodelineNumbered\codeline@indextrue
855 \def\codeline@wrindex#1{\if@filesw
856 \begingroup
857 \set@display@protect
858 \immediate\write\@indexfile
859 {\string\indexentry{#1}%
860 {\number\c@CodelineNo}}%
861 \endgroup
862 \fi}
863 \let\special@index = \@gobble
864 \def\CodelineIndex{\makeindex
865 \codeline@indextrue
866 \let\special@index\codeline@wrindex}
867 \def\PageIndex{\makeindex
868 \codeline@indexfalse
869 \let\special@index\index}
870 \newcount\c@CodelineNo \c@CodelineNo\z@
871 \@ifundefined{theCodelineNo}
872 {\ifx\selectfont\undefined
873 \def\theCodelineNo{\rmfamily\scriptsize\arabic{CodelineNo}}%
874 \else
875 \def\theCodelineNo{\reset@font\scriptsize\arabic{CodelineNo}}%
876 \fi}
877 {}
878 \tolerance=1000\relax
879 { \catcode`\"=12
880 \global\mathcode`\\="705C \global\mathcode`\@="7040 }
881 \@ifundefined{DocstyleParms}{}{\DocstyleParms}
882 \let\DocstyleParms\relax
883 \@ifundefined{AmSTeX}
884 {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex%
885 \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{}
886 \@ifundefined{BibTeX}
887 {\def\BibTeX{{\rmfamily B\kern-.05em%
888 \textsc{i\kern-.025em b}\kern-.08em%
889 T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}}{}
890 \@ifundefined{SliTeX}
891 {\def\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox
892 {\scshape i}\kern -.03em\TeX}}}{}
893 \@ifundefined{PlainTeX}{\def\PlainTeX{\textsc{Plain}\kern2pt\TeX}}{}
894 \@ifundefined{Web}{\def\Web{\textsc{Web}}}{}
895 \def\MakePercentIgnore{\catcode`\%9\relax}
896 \def\MakePercentComment{\catcode`\%14\relax}
897 \def\DocInput#1{\MakePercentIgnore\input{#1}\MakePercentComment}
898 \def\GetFileInfo#1{%
899 \def\filename{#1}%
900 \def\@tempb##1 ##2 ##3\relax##4\relax{%
901 \def\filedate{##1}%
902 \def\fileversion{##2}%
903 \def\fileinfo{##3}}%
904 \edef\@tempa{\csname ver@#1\endcsname}%
905 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
906
907 \AddToHook{begindocument/before}[doc/hyperref]{%
908 \ifdoc@hyperref
909 \expandafter\let\expandafter\doc@eoph@@k\csname doc.sty-h@@k\endcsname
910 \RequirePackage{hypdoc}
911 \expandafter\let\csname doc.sty-h@@k\endcsname\doc@eoph@@k
912 \ifx\special@index\@gobble % do we write index entries at all?
913 \else
914 \ifcodeline@index
915 \let\special@index\HD@codeline@wrindex
916 \else
917 \let\special@index\HD@page@wrindex
918 \fi
919 \fi
920 \AddToHook{class/amsdtx/after}{%
921 \pdfstringdefDisableCommands{\let\env\@empty }}%
922 \def\doc@providetarget{\HD@target}%
923 \def\doc@handleencap#1{\encapchar hdclindex{\the\c@HD@hypercount}{#1}}%
924 \else
925 \let\doc@providetarget\@empty
926 \def\doc@handleencap#1{\encapchar #1}%
927 \def\hdclindex#1#2{\ifx\@nil#2\@nil\else\csname #2\expandafter\endcsname\fi}%
928 \def\hdpindex #1{\ifx\@nil#1\@nil\else\csname #1\expandafter\endcsname\fi}%
929 \fi
930 }
931
932 \ExplSyntaxOn
933 \long\def\@doc@env#1#2#3{
934 \endgroup
935 \clist_map_inline:nn {#3} { \@doc@env@{#1}{#2}{##1} }
936 }
937
938 \ExplSyntaxOff
939 \long\def\@doc@env@#1#2#3{%
940 \topsep\MacroTopsep
941 \trivlist
942 \edef\saved@macroname{\string#3}%
943 \if #1%
944 \edef\saved@indexname{\expandafter\@gobble\saved@macroname}%
945 \expandafter\ifx
946 \csname Code#2Index\endcsname
947 \CodeMacroIndex
948 \else
949 \record@index@type@save
950 {\saved@indexname}{#2}%
951 \fi
952 \else
953 \let\saved@indexname\saved@macroname
954 \fi
955 \def\makelabel##1{\llap{##1}}%
956 \if@inlabel
957 \let\@tempa\@empty
958 \count@\macro@cnt
959 \loop\ifnum\count@>\z@
960 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne
961 \repeat
962 \edef\makelabel##1{\llap{\vtop to\baselineskip{\@tempa\hbox{##1}\vss}}}%
963 \advance\macro@cnt\@ne
964 \else
965 \macro@cnt\@ne
966 \fi
967 \ifdoc@noprint
968 \item
969 \else
970 \edef\@tempa{%
971 \noexpand\item[%
972 \noexpand\doc@providetarget
973 \noexpand\strut
974 \noexpand\@nameuse{Print#2Name}{\saved@macroname}]}%
975 \@tempa
976 \fi
977 \ifdoc@noindex\else
978 \global\advance\c@CodelineNo\@ne
979 \csname SpecialMain#2Index\expandafter\endcsname
980 \expandafter{\saved@macroname}\nobreak
981 \global\advance\c@CodelineNo\m@ne
982 \fi
983 \if#1\expandafter\DoNotIndex \expandafter {\saved@macroname}\fi
984 \ignorespaces}
985 \def\doc@env#1#2[#3]{%
986 \@nameuse{doc@noprint\doc@noprintdefault}%
987 \@nameuse{doc@noindex\doc@noindexdefault}%
988 \csname keys_set:nn\endcsname{doc}{#3}%
989 \begingroup
990 \ifdoc@outer
991 \catcode`\\12
992 \fi
993 \MakePrivateLetters
994 \@doc@env{#1}{#2}%
995 }
996
997 \def\@doc@describe#1#2{%
998 \ifdoc@noprint\else
999 \marginpar{\raggedleft
1000 \strut
1001 \doc@providetarget
1002 \@nameuse{PrintDescribe#1}{#2}}%
1003 \fi
1004 \ifdoc@noindex\else
1005 \@nameuse{Special#1Index}{#2}%
1006 \fi
1007 \@esphack
1008 \endgroup
1009 \ignorespaces}
1010 \def\doc@describe#1[#2]{%
1011 \leavevmode\@bsphack
1012 \csname keys_set:nn\endcsname{doc}{#2}%
1013 \@doc@describe{#1}}
1014 \@ifundefined{temptokenb}{\newtoks\@temptokenb}{}
1015 \def\doc@createspecialindexes#1#2#3{%
1016 \@temptokena{\space (#2)}%
1017 \@temptokenb{#3:}%
1018 \@nameedef{SpecialMain#1Index}##1{%
1019 \noexpand\@bsphack
1020 \ifdoc@toplevel
1021 \noexpand\special@index{##1\noexpand\actualchar
1022 {\string\ttfamily\space##1}%
1023 \ifx\@nil#2\@nil\else \the\@temptokena \fi
1024 \noexpand\encapchar main}%
1025 \fi
1026 \ifx\@nil#3\@nil\else
1027 \noexpand\special@index{\the\@temptokenb\noexpand\levelchar
1028 ##1\noexpand\actualchar{\string\ttfamily\space##1}%
1029 \noexpand\encapchar main}%
1030 \fi
1031 \noexpand\@esphack}%
1032 \@nameedef{Special#1Index}##1{%
1033 \noexpand\@bsphack
1034 \ifdoc@toplevel
1035 \noexpand\doc@providetarget
1036 \noexpand\index{##1\noexpand\actualchar{\string\ttfamily\space##1}%
1037 \ifx\@nil#2\@nil\else \the\@temptokena \fi
1038 \noexpand\doc@handleencap{usage}}%
1039 \fi
1040 \ifx\@nil#3\@nil\else
1041 \noexpand\index{\the\@temptokenb\noexpand\levelchar
1042 ##1\noexpand\actualchar{\string\ttfamily\space##1}%
1043 \noexpand\doc@handleencap{usage}}%
1044 \fi
1045 \noexpand\@esphack}}
1046 \def\doc@createspecialmacrolikeindexes#1#2#3{%
1047 \@temptokena{\space (#2)}%
1048 \@temptokenb{#3:}%
1049 \@nameedef{Code#1Index}##1##2{%
1050 \noexpand\@SpecialIndexHelper@##2\noexpand\@nil
1051 \noexpand\@bsphack
1052 \noexpand\ifdoc@noindex\noexpand\else
1053 \ifdoc@toplevel
1054 \noexpand\special@index{\noexpand\@gtempa\noexpand\actualchar
1055 \string\verb% % to fool emacs highlighting
1056 \noexpand\quotechar*\noexpand\verbatimchar
1057 \noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar
1058 \ifx\@nil#2\@nil\else \the\@temptokena \fi
1059 \noexpand\encapchar ##1}%
1060 \fi
1061 \ifx\@nil#3\@nil\else
1062 \noexpand\special@index{\the\@temptokenb\noexpand\levelchar
1063 \noexpand\@gtempa\noexpand\actualchar
1064 \string\verb% % to fool emacs highlighting
1065 \noexpand\quotechar*\noexpand\verbatimchar
1066 \noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar
1067 \noexpand\encapchar ##1}%
1068 \fi
1069 \noexpand\fi
1070 \noexpand\@esphack}%
1071 \@nameedef{SpecialMain#1Index}##1{%
1072 \expandafter\noexpand\csname Code#1Index\endcsname
1073 {main}{##1}}%
1074 \@nameedef{Special#1Index}##1{%
1075 \noexpand\@SpecialIndexHelper@##1\noexpand\@nil
1076 \noexpand\@bsphack
1077 \noexpand\ifdoc@noindex\noexpand\else
1078 \ifdoc@toplevel
1079 \noexpand\doc@providetarget
1080 \noexpand\index{\noexpand\@gtempa\noexpand\actualchar
1081 \string\verb% % to fool emacs highlighting
1082 \noexpand\quotechar*\noexpand\verbatimchar
1083 \noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar
1084 \ifx\@nil#2\@nil\else \the\@temptokena \fi
1085 \noexpand\doc@handleencap{usage}}%
1086 \fi
1087 \ifx\@nil#3\@nil\else
1088 \noexpand\index{\the\@temptokenb\noexpand\levelchar
1089 \noexpand\@gtempa\noexpand\actualchar
1090 \string\verb% % to fool emacs highlighting
1091 \noexpand\quotechar*\noexpand\verbatimchar
1092 \noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar
1093 \noexpand\doc@handleencap{usage}}%
1094 \fi
1095 \noexpand\fi
1096 \noexpand\@esphack}}
1097
1098 \def\doc@createdescribe#1{%
1099 \@namedef{Describe#1}{%
1100 \begingroup
1101 \MakePrivateLetters
1102 \@ifnextchar[%]
1103 {\doc@describe{#1}}{\doc@describe{#1}[]}}}
1104 \def\doc@createenv#1#2#3{%
1105 \@namedef{#3}{%
1106 \@ifnextchar[%]
1107 {\doc@env{#1}{#2}}{\doc@env{#1}{#2}[]}}%
1108 \@namedef{end#3}{\endtrivlist}%
1109 }
1110
1111 \def\@nameedef#1{\expandafter\edef\csname #1\endcsname}
1112
1113
1114 \def\doc@declareerror#1#2{%
1115 \PackageError{doc}{Doc element '#1/#2' already defined?\@gobble}%
1116 {There is already a definition for
1117 '\string\Print#1Name',\MessageBreak
1118 '\string\PrintDescribe#1'
1119 or the environment '#2'.\MessageBreak
1120 Maybe you are overwriting something by mistake!\MessageBreak
1121 Otherwise use '\string\RenewDocElement' instead.}%
1122 }
1123
1124 \def\doc@notdeclarederror#1#2{%
1125 \PackageError{doc}{Doc element '#1/#2' unknown}%
1126 {I expected an existing definition for
1127 '\string\Print#1Name',\MessageBreak
1128 '\string\PrintDescribe#1' and
1129 the environment '#2' but\MessageBreak
1130 not all of them are defined.\MessageBreak
1131 Maybe you wanted to use
1132 '\string\NewDocElement'?}%
1133 }
1134 \def\doc@ignoredinfo#1#2{%
1135 \PackageInfo{doc}{Doc element '#1/#2' declaration
1136 ignored}%
1137 }
1138 \newcommand\NewDocElement[3][]{%
1139 \@ifundefined{Print#2Name}%
1140 {\@ifundefined{PrintDescribe#2}%
1141 {\@ifundefined{#3}%
1142 {\@ifundefined{end#3}%
1143 {\@NewDocElement{#1}}%
1144 \doc@declareerror
1145 }\doc@declareerror
1146 }\doc@declareerror
1147 }\doc@declareerror
1148 {#2}{#3}%
1149 }
1150 \newcommand\ProvideDocElement[3][]{%
1151 \@ifundefined{Print#2Name}%
1152 {\@ifundefined{PrintDescribe#2}%
1153 {\@ifundefined{#3}%
1154 {\@ifundefined{end#3}%
1155 {\@NewDocElement{#1}}%
1156 \doc@ignoredinfo
1157 }\doc@ignoredinfo
1158 }\doc@ignoredinfo
1159 }\doc@ignoredinfo
1160 {#2}{#3}%
1161 }
1162 \newcommand\RenewDocElement[3][]{%
1163 \@ifundefined{Print#2Name}\doc@notdeclarederror
1164 {\@ifundefined{PrintDescribe#2}\doc@notdeclarederror
1165 {\@ifundefined{#3}\doc@notdeclarederror
1166 {\@ifundefined{end#3}\doc@notdeclarederror
1167 {\@NewDocElement{#1}}%
1168 }%
1169 }%
1170 }%
1171 {#2}{#3}%
1172 }
1173 \def\@NewDocElement#1#2#3{%
1174 \doc@macrolikefalse
1175 \doc@topleveltrue
1176 \def\doc@idxtype{#3}%
1177 \def\doc@idxgroup{#3s}%
1178 \let\doc@printtype\@empty
1179 \csname keys_set:nn\endcsname{doc}{#1}%
1180 \ifx\doc@printtype\@empty
1181 \@temptokena{}%
1182 \else
1183 \@temptokena\expandafter{\expandafter
1184 \textnormal\expandafter{\expandafter
1185 \space\expandafter
1186 (\doc@printtype)}}%
1187 \fi
1188 \@nameedef{Print#2Name}##1{%
1189 {\noexpand\MacroFont
1190 \ifdoc@macrolike
1191 \noexpand\string
1192 \fi
1193 ##1%
1194 \the\@temptokena
1195 }}%
1196 \expandafter\let\csname PrintDescribe#2\expandafter\endcsname
1197 \csname Print#2Name\endcsname
1198 \edef\doc@expr{%
1199 \ifdoc@macrolike
1200 \noexpand\doc@createspecialmacrolikeindexes
1201 \else
1202 \noexpand\doc@createspecialindexes
1203 \fi
1204 {#2}%
1205 }%
1206 \expandafter\expandafter\expandafter
1207 \doc@expr
1208 \expandafter\expandafter\expandafter
1209 {\expandafter\doc@idxtype\expandafter}\expandafter
1210 {\doc@idxgroup}%
1211 \doc@createdescribe{#2}%
1212 \ifdoc@macrolike
1213 \doc@createenv{TT}{#2}{#3}%
1214 \else
1215 \doc@createenv{TF}{#2}{#3}%
1216 \fi
1217 }
1218
1219
1220 \NewDocElement[macrolike = true ,
1221 idxtype = ,
1222 idxgroup = ,
1223 printtype =
1224 ]{Macro}{macro}
1225
1226 \def\SpecialMainIndex{\SpecialMainMacroIndex}
1227
1228 \def\SpecialUsageIndex{\SpecialMacroIndex}
1229
1230 \def\SpecialIndex {\CodeMacroIndex{code}}
1231
1232 \NewDocElement[macrolike = false ,
1233 idxtype = env. ,
1234 idxgroup = environments ,
1235 printtype = \textit{env.}
1236 ]{Env}{environment}
1237 \AddToHook{package/hypdoc/before}{%
1238 \let\@@PrintDescribeMacro \PrintDescribeMacro
1239 \let\@@PrintDescribeEnv \PrintDescribeEnv
1240 \let\@@PrintMacroName \PrintMacroName
1241 \let\@@PrintEnvName \PrintEnvName
1242 \let\@@SpecialUsageIndex \SpecialUsageIndex
1243 \let\@@SpecialEnvIndex \SpecialEnvIndex
1244 \let\@@SortIndex \SortIndex
1245 \let\@@DescribeMacro \DescribeMacro
1246 \let\@@DescribeEnv \DescribeEnv
1247 }
1248 \AddToHook{package/hypdoc/after}{%
1249 \let\PrintDescribeMacro \@@PrintDescribeMacro
1250 \let\PrintDescribeEnv \@@PrintDescribeEnv
1251 \let\PrintMacroName \@@PrintMacroName
1252 \let\PrintEnvName \@@PrintEnvName
1253 \let\SpecialUsageIndex \@@SpecialUsageIndex
1254 \let\SpecialEnvIndex \@@SpecialEnvIndex
1255 \let\SortIndex \@@SortIndex
1256 \let\DescribeMacro \@@DescribeMacro
1257 \let\DescribeEnv \@@DescribeEnv
1258 }
1259
1260 \DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}
1261 \AddToHook{class/amsdtx/after}{%
1262 \DeclareRobustCommand\cs[1]{%
1263 \@boxorbreak{%
1264 \ntt
1265 \addbslash#1\@empty
1266 \@xp\@xp\@xp\@indexcs\@xp\@nobslash\string#1\@nil
1267 }%
1268 }%
1269 \def\cn{\cs}%
1270 }
1271
1272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1273 \endinput
1274 %%
1275 %% End of file `doc.sty'.