summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/koma-script-source-doc.dtx
blob: 2cad321e5deac341ee7a11d115039a42eacd1548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
% \iffalse meta-comment
% ==========================================================================
% komascript-source.doc.dtx
% Copyright (c) Markus Kohm, 2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% --------------------------------------------------------------------------
% Note: This is a self unpacking dtx-file, so you have to run:
%         tex koma-script-source-doc.dtx
%       to unpack the file(s), but
%         lualatex-dev koma-script-source-doc.dtx
%         mkindex koma-script-source-doc
%         lualatex-dev koma-script-source-doc.dtx
%         mkindex koma-script-source-doc
%         lualatex-dev koma-script-source-doc.dtx
%       to generate the manual. Before generation of the manual it is
%       recommended to install or at least unpack KOMA-Script.
% ==========================================================================
%%
%<+drv>\ProvidesFile{koma-script-source-doc.drv}
%<+class>\ProvidesClass{koma-script-source-doc}
%<*ins>
\expandafter\expandafter\expandafter\ifx\csname ProvidesFile\endcsname\relax
  \def\ProvidesFile#1[#2]{}
\fi
%</ins>
%<*dtx>
\ProvidesFile{koma-script-source-doc.dtx}
%</dtx>
%<+ins>\ProvidesFile{koma-script-source-doc.ins}
[2022-07-08 v0.92 KOMA-Script source documentation]
%<*dtx>
\ifx\documentclass\undefined
%</dtx>
%<*ins>
  \input docstrip.tex
  \ifToplevel{\keepsilent\askforoverwritefalse}
  \generate{%
%    \file{koma-script-source-doc.drv}{%
%      \from{koma-script-source-doc.dtx}{drv}%
%    }
%    \file{koma-script-source-doc.ins}{%
%      \from{koma-script-source-doc.dtx}{ins}%
%    }
    \file{koma-script-source-doc.cls}{%
      \from{koma-script-source-doc.dtx}{class}%
      \from{scrlogo.dtx}{logo,forcedefine}%
    }%
  }
%</ins>
%<*dtx>
\else
  \let\endbatchfile\relax
\fi
%</dtx>  
%<*dtx|ins>
\endbatchfile
%</dtx|ins>
%<*drv>
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{libertinus}
\usepackage{babel}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{d.\,i.},
  idxgroup  = Documentation items,
  printtype = \textit{d.\,i.},
]{DocItem}{docitem}
\begin{document}
\DocInput{koma-script-source-doc.dtx}
\end{document}
%</drv>
% \fi^^A meta-comment
%
% \changes{v0.0}{2022/01/15}{start of the new class}
% \changes{v0.1}{2022/01/15}{first self documenting test}
% \changes{v0.6}{2022/02/02}{force definition of \KOMAScript{} logo}
% \changes{v0.6}{2022/02/02}{\pkg{hyperref} hook for \KOMAScript{} logo moved
%   to \file{scrlogo.dtx}}
%
% \DoNotIndex{\actualchar}
%
% \GetFileInfo{\jobname.dtx}
% \title{\href{https://komascript.de}{\KOMAScript} Source Documentation\\
%   Using\\
%   \cls*{koma-script-source-doc}}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Version \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
% From 2002 up to end of 2021 \cls*{scrdoc} was the class, that has been used
% for the sources of \KOMAScript{} and several other packages of the
% \KOMAScript{} author. This class was more or less a ugly hack to use a
% modified and extended version of \cls{ltxdoc}, the source documentation
% class of The \LaTeX{} Team. There has been advisement to redesign this
% class for years, but as changing the source documentation class is more a
% work of month than of days, I've always put it on the back burner.
%
% In January 2022, The \LaTeX{} Team switched over from \pkg{doc} version 2 to
% version 3. The new version is compatible on user interface level, but as
% expected not on implementation level. So the extensions made in \cls*{scrdoc}
% result in several error messages. For such cases The \LaTeX{} Team has the
% fallback solution to use an old \pkg{doc}. But this can only be used, if you
% load \pkg{doc} yourself using either |\usepackage| or
% |\RequirePackage|. If class \cls{ltxdoc} is used, the fallback does not
% exist.
%
% A first workaround for \cls*{scrdoc} was a typical hacker solution, that
% forces \cls{ltxdoc} to use an old version of \pkg{doc} and to fix the
% resulting issues after loading \cls{ltxdoc}. But this does only work as long
% as new releases of \cls{ltxdoc} are compatible with the \pkg{doc} release of
% 2021.
%
% So in January 2022, it was really time for a new \KOMAScript{} source
% documentation class. This new class does not use internal commands of
% \cls{ltxdoc} any longer but uses the extended interface of \pkg{doc} version
% 3 to define further documentation items.
% \end{abstract}
%
% \tableofcontents
%
% \section{Prerequisites}
% \label{sec:prerequisites}
%
% Class \cls*{koma-script-source-doc} needs at least class \cls{ltxdoc} version
% 2.1d which depends on package \pkg{doc} version 3, because it used several
% of the new features of that \pkg{doc} release. This is part of
% \texttt{latex-base-dev} 2022-06-01 pre-release~1 distributed on
% \href{https://www.ctan.org}{CTAN} on 14th January 2022 and therefore will be
% part of \LaTeX{} 2022-06-01. If you still use an older \LaTeX{} you cannot
% use class \cls*{koma-script-source-doc}.
%
%
% \section{Basic Settings}
% \label{sec:basicsettings}
%
% For \KOMAScript{} we use some basic settings:
% \begin{itemize}
% \item Generation of the indexing of new commands is generally enabled by
%   \pkg{doc}. We do not use \cs{EnableCrossrefs}, because this would not
%   allow to disable this feature using \cs{DisableCrossrefs}. It is also
%   recommended not to generally use \cs{EnableCrossrefs} in the
%   \file{dtx}-file.
% \item We use \cs{CodeLineIndex} to have code line numbers for the
%   indexing. This could be problematic sometimes. In this case, you should
%   use \cs{PageIndex} and \cs{CodelineNumbered} to use page numbers in the
%   index but nevertheless add line numbers to the code.
% \item For \KOMAScript{} code we usually record the changes. So we use
%   \cs{RecordChanges} and option \opt{reportchangedates} This is the only
%   real changelog we do. However, if your \file{dtx}-file contains the user
%   manual, it would be recommended to list the main changes like new features
%   and incompatibilities as a section either at the very beginning or the end
%   of the user manual.
% \item \DescribeOption{indexlatex} For \KOMAScript{} sources I do not like to
%   index all the \LaTeX{} interface commands and internal
%   commands\footnote{This does only work for those \LaTeX{} macros, already
%   internally listed. The list should be generated automatically after each
%   \LaTeX{} release. Unfortunately, currently it is build step by step with
%   every new \KOMAScript{} release instead.}. You can changes this, using
%   option \opt{indexlatex}. You can also use explicit \opt{indexlatex=false}
%   to again not index the \LaTeX{} kernel macros.
% \item You also should use \cs{GetFileInfo}\marg{dtx-filename} to get
%   information like \cs{filedate} and \cs{fileversion} from the
%   \cs{ProvidesFile} command of the \file{dtx}-file. Sometimes it may even be
%   better to use the generated package or class as argument.
% \end{itemize}
%
%
% \section{Simple Formatting Commands}
% \label{sec:simpleformatting}
%
% \DescribeCommand{\file}
% \DescribeCommand{\opt}
% \DescribeCommand{\optvalue}
% \DescribeCommand{\env}
% \DescribeCommand{\cnt}
% \DescribeCommand{\fnt}
% \DescribeCommand{\len}
% \DescribeCommand{\var}
% \DescribeCommand{\plen}
% \DescribeCommand{\pstyle}
% \DescribeCommand{\dhook}
% There are some very simple formatting commands. They all expect one
% mandatory argument \meta{object name}. The default formatting is to use
% \cs{texttt}. The commands are mentioned for the name of a file, option,
% value of an option, environment, \LaTeX{} counter, font, length (either
% dimension or skip), variable (usually \KOMAScript{} variables used by
% \cls*{scrlttr2} or \pkg*{scrletter}), pseudo-length (of \cls*{scrlttr2} or
% \pkg*{scrletter}), page style, or do hook.
%
% \DescribeCommand{\cls}
% \DescribeCommand{\pkg}
% The commands:
% \begin{quote}
%   \cs{cls}\oarg{hyper link}\marg{package name}\hfill and\hfill
%   \cs{pkg}\oarg{hyper link}\marg{class name}
% \end{quote}
% do not only print the name of a class or package, but also generate a hyper
% link. For this the commands have a first optional argument. If this is
% empty, no link will be generated. If it is not empty, it has to be the
% link. If it is not used an automatic package link to the
% \href{https://www.ctan.org/pkg}{CTAN} package with the same name will be
% generated. There are also star variants \cs{cls*} and \cs{pkg*}, that do not
% produce any link. For links with special characters like \texttt{\char`\#}
% it is recommended to use \cs{href} and the star variant.
% \begin{center}
%   Examples:\hspace{0pt plus 1filll}\null\\[-\baselineskip]
%   \cs{cls}|{scrbook}| \textrightarrow{} \cls{scrbook}\\
%   \cs{cls*}|{scrbook}| \textrightarrow{} \cls*{scrbook}\\
%   \cs{cls}|[https://koma-script.de]{koma-script-source-doc}|
%     \textrightarrow{} \cls[https://koma-script.de]{koma-script-source-doc}\\
%   \cs{pkg}|[]{scrlayer}| \textrightarrow{} \pkg[]{scrlayer} \\
%   \cs{href}|{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguien.pdf#cha:typearea}{\pkg*{typearea}}|
%     \textrightarrow{}
%     \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguien.pdf#chapter.2}{\pkg*{typearea}}
% \end{center}
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation}
%
%    \begin{macrocode}
%<*class>
%    \end{macrocode}
%
% \subsection{Class Options}
%
% We use \pkg{l3keys2e} for the options. Using \pkg*{scrkbase} would be nice
% too, but it cannot be used until \KOMAScript{} is available, to the
% emergency fallback to using the standard class \cls*{article} wouldn't make
% sense in this case.
%    \begin{macrocode}
\RequirePackage{l3keys2e}
\ExplSyntaxOn
%    \end{macrocode}
% \begin{option}{indexlatex}
% \changes{v0.3}{2022/01/17}{new option}
% The option to switch on/off the indexing of \LaTeX{} interface and internal
% macros (and also \TeX{} primitives). The pre-setting is \texttt{false}. The
% default of the option is \texttt{true}.
%    \begin{macrocode}
\newif \ifkdoc@indexlatex \kdoc@indexlatexfalse
\keys_define:nn {kdoc}
  {
    indexlatex  .choice:,
    indexlatex / true  .code:n = { \legacy_if_set_true:n  { kdoc@indexlatex } },
    indexlatex / false .code:n = { \legacy_if_set_false:n { kdoc@indexlatex } },
    indexlatex .default:n = { true },
  }
%    \end{macrocode}
% \end{option}
% \begin{macrocode}
\ExplSyntaxOff
\ProcessKeysOptions {kdoc}
%    \end{macrocode}
%
%
% \subsection{Base Class and Packages}
%
% \changes{v0.2}{2022/01/16}{emergency fallback to \cls*{article}}
% \changes{v0.3}{2022/01/17}{new basic defaults}
% \changes{v0.3}{2022/01/17}{\cs{DoNotIndex} of several \LaTeX{} kernel
%   macros}
% \changes{v0.3a}{2022/01/21}{using an old \pkg{doc} is fatal}
% Currently we use base class \cls{ltxdoc} at least version 2021/12/07
% v2.1d. In future this could change. In this case we would need to load
% package \pkg{doc} at least version 2022/06/01 v3.0g. However, we also want
% \cls{ltxdoc} to use \KOMAScript{} class \cls*{scrartcl} instead of standard
% class \cls*{article}. But if \KOMAScript{} has not been made, we cannot use
% a \KOMAScript{} class or package to compile the source. So in this case
% we use an emergency fallback.
%    \begin{macrocode}
\IfFileExists{scrartcl.cls}{%
  \declare@file@substitution{article.cls}{scrartcl.cls}
  \PassOptionsToClass{fontsize=10pt}{scrartcl}
}{%
  \ClassWarningNoLine{koma-script-source-doc}{%
    Usually this class should be used with KOMA-Script\MessageBreak
    scrartcl. But as that class is not available we use\MessageBreak
    standard class article as emergency fallback.\MessageBreak
    It is recommended to repeat this LaTeX run after\MessageBreak
    build/installation of a complete KOMA-Script%
  }%
}
\LoadClassWithOptions{ltxdoc}[2021/12/07]
\IfPackageAtLeastTF{doc}{2022/06/01}{}{%
  \ClassError{koma-script-source-doc}{old package `doc' detected}{%
    This class needs `doc' v3. It cannot be used with\MessageBreak
    `doc' v2. `doc' v3 is available at LaTeX developer\MessageBreak
    release from at least January 2022}%
  \csname fi\endcsname\csname @@end\endcsname\end\endinput
}
\SetupDoc{reportchangedates}
\CodelineIndex
\RecordChanges
\ifkdoc@indexlatex\else
  \DoNotIndex{\.,\\,\ ,\@,\@Alph,\@M}
  \DoNotIndex{\@abstrtfalse,\@abstrttrue,\@addtoreset,\@afterheading}
  \DoNotIndex{\@afterindentfalse,\@alph,\@arabic}
  \DoNotIndex{\@beginparpenalty}
  \DoNotIndex{\@car,\@cdr,\@centercr}
  \DoNotIndex{\@dblfloat,\@dotsep}
  \DoNotIndex{\@dottedtocline,\@empty,\@endparpenalty}
  \DoNotIndex{\@float,\@fontswitch}
  \DoNotIndex{\@gobbletwo}
  \DoNotIndex{\@hangfrom,\@highpenalty}
  \DoNotIndex{\@ifnextchar,\@ifundefined,\@itempenalty}
  \DoNotIndex{\@latex@warning}
  \DoNotIndex{\@m,\@medpenalty,\@minus,\@mkboth,\@mparswitchfalse}
  \DoNotIndex{\@mparswitchtrue}
  \DoNotIndex{\@ne,\@nil,\@nobreakfalse,\@nobreaktrue,\@nomath}
  \DoNotIndex{\@plus}
  \DoNotIndex{\@Roman,\@roman}
  \DoNotIndex{\@tempa,\@tempcnta,\@tempdima,\@tempskipka}
  \DoNotIndex{\@tempswafalse,\@tempswatrue}
  \DoNotIndex{\@tempb,\@tempcntb,\@tempdimb,\@tempskipkb}
  \DoNotIndex{\@tempswbfalse,\@tempswbtrue}
  \DoNotIndex{\@tempc,\@tempcntc,\@tempdimc,\@tempskipkc}
  \DoNotIndex{\@tocrmarg,\@topnewpage,\@topnum,\@twocolumnfalse}
  \DoNotIndex{\@twocolumntrue,\@twosidefalse,\@twosidetrue}
  \DoNotIndex{\@whiledim,\@whilenum}
  \DoNotIndex{\addcontentsline,\addpenalty,\addtocontents,\addtolength}
  \DoNotIndex{\addvspace,\advance,\AtBeginDocument}
  \DoNotIndex{\begin,\begingroup,\bfseries,\box,\bullet}
  \DoNotIndex{\c@figure,\c@page,\c@secnumdepth,\c@table,\c@tocdepth}
  \DoNotIndex{\cdot,\centering,\changes,\cleardoublepage,\clearpage}
  \DoNotIndex{\cmd,\col@number,\CurrentOption,\CodelineIndex,\cs}
  \DoNotIndex{\day,\dblfloatpagefraction,\dbltopfraction}
  \DoNotIndex{\declare@file@substitution}
  \DoNotIndex{\DeclareOldFontCommand,\DeclareOption,\def,\DisableCrossrefs}
  \DoNotIndex{\divide,\DoNotIndex}
  \DoNotIndex{\ifdim,\else,\fi,\empty,\em,\EnableCrossrefs,\end}
  \DoNotIndex{\end@dblfloat}
  \DoNotIndex{\end@float,\endgroup,\endlist,\endquotation,\endtitlepage}
  \DoNotIndex{\everypar,\ExecuteOptions,\expandafter}
  \DoNotIndex{\fboxrule,\fboxsep}
  \DoNotIndex{\g@addto@macro,\gdef,\global}
  \DoNotIndex{\hangindent,\hbox,\hfil,\hrule,\hsize,\hskip,\hspace,\hss}
  \DoNotIndex{\if@tempswa,\ifcase,\or,\fi,\fi}
  \DoNotIndex{\ifnum,\ifodd,\ifx,\fi,\fi,\fi}
  \DoNotIndex{\include,\input,\InputIfFileExists,\item,\itshape}
  \DoNotIndex{\kern,\kernel@ifnextchar}
  \DoNotIndex{\leavevmode,\leftmark,\leftskip,\let,\lineskip}
  \DoNotIndex{\list,\long,\LoadClass,\LoadClassWithOptions}
  \DoNotIndex{\m@ne,\m@th,\marginpar,\markboth,\markright,\mathbf,\mathcal}
  \DoNotIndex{\mathit,\mathnormal,\mathrm,\mathsf,\mathtt,\MessageBreak}
  \DoNotIndex{\month}
  \DoNotIndex{\newblock,\newcommand,\newcount,\newcounter,\newdimen}
  \DoNotIndex{\newenvironment,\newlength,\newpage,\nobreak,\noindent}
  \DoNotIndex{\normalfont,\normallineskip,\normalsize,\null,\number}
  \DoNotIndex{\numberline,\normalcolor}
  \DoNotIndex{\OldMakeindex,\OnlyDescription,\overfullrule}
  \DoNotIndex{\p@,\PackageError,\PackageInfo,\PackageWarningNoLine}
  \DoNotIndex{\pagenumbering,\pagestyle,\par,\paragraph,\parbox}
  \DoNotIndex{\PassOptionsToPackage,\pcal,\penalty,\pmit,\PrintChanges}
  \DoNotIndex{\PrintIndex,\ProcessOptions,\protect,\providecommand}
  \DoNotIndex{\ProvidesClass}
  \DoNotIndex{\raggedbottom,\raggedleft,\raggedright,\refstepcounter,\relax}
  \DoNotIndex{\renewcommand,\RenewDocElement,\RequirePackage}
  \DoNotIndex{\reserved@a,\reserved@b,\reserved@c,\reset@font}
  \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rmfamily}
  \DoNotIndex{\scshape,\secdef,\setbox,\setcounter,\setlength}
  \DoNotIndex{\settowidth,\sfcode,\sffamily,\skip,\sloppy,\slshape,\space}
  \DoNotIndex{\string}
  \DoNotIndex{\TeX,\textbf,\textit,\textrm,\textsf,\texttt,\textup}
  \DoNotIndex{\the,\thispagestyle,\triangleright,\ttfamily}
  \DoNotIndex{\twocolumn,\typeout}
  \DoNotIndex{\undefined,\usecounter}
  \DoNotIndex{\vfil,\vfill,\vspace}
  \DoNotIndex{\wd,\xdef,\year,\z@}
\fi
%    \end{macrocode}
%
% \changes{v0.2}{2022/01/16}{do not fail if \pkg*{typearea} has not been
%   loaded}
% The left margin is highly used, but the right margin is not. So it is a kind
% of \opt{mpinclude} but with the left instead of the right margin. A simple
% solution for this is to move the whole page content to the right. But we do
% so only, if \cls*{koma-script-source-doc} is used with \cls*{scrartcl}.
%    \begin{macrocode}
\ifdefined\AfterCalculatingTypearea
  \AfterCalculatingTypearea{%
    \addtolength{\oddsidemargin}
                {.5\dimexpr\oddsidemargin+1in\relax}%
    \setlength{\marginparwidth}
              {\dimexpr \oddsidemargin+1in-2\marginparsep\relax}%
    \setlength{\marginparpush}{0pt}%
  }
  \KOMAoption{DIV}{9}
\fi
%    \end{macrocode}
%
% Because \pkg{doc} uses a late hook to load \pkg{hyperref} there may be a
% problem with package \pkg{auxhook} used by \pkg{hyperref}. So we load it
% early to avoid such problems.
%    \begin{macrocode}
\RequirePackage{auxhook}
%    \end{macrocode}
%
%
% \begin{macro}{\index@prologue,\glossary@prologue}
% \changes{v0.5}{2022/01/31}{generating ToC entry}
% \begin{macro}{\kssd@section@hack}
% \changes{v0.5}{2022/01/31}{new}
% We want to have an entry to the table of contents for the index and the
% glossary. So we patch the default prologues. This is not a perfect solution,
% but it works and  makes it possible to still define a complete new prologue
% using \cs{IndexPrologue} resp. \cs{GlossaryPrologue} as documented for
% \pkg{doc}.
%    \begin{macrocode}
\expandafter\def\expandafter\index@prologue\expandafter{%
  \expandafter\kssd@section@hack\index@prologue}
\expandafter\def\expandafter\glossary@prologue\expandafter{%
  \expandafter\kssd@section@hack\glossary@prologue}
\newcommand*{\kssd@section@hack}{%
  \let\ksdd@markboth\markboth
  \def\markboth##1##2{%
    \@ifundefined{addsectiontocentry}{%
      \@ifundefined{addxcontentsline}{%
        \addcontentsline{toc}{section}{\numberline{}##1}%
      }{%
        \addxcontentsline{toc}{section}{##1}%
      }%
    }{%
      \addsectiontocentry{}{##1}%
    }%
    \let\markboth\ksdd@markboth
    \markboth{##1}{##2}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{Simple Formatting Macros}
%
% These are very simply defined macros for names of
% \begin{command}{\file}
% files,
%    \begin{macrocode}
\newcommand*{\file}{\texttt}
%    \end{macrocode}
% \begin{command}{\cls}
% \changes{v0.8}{2022/02/08}{using \cs{textsf}}
% \changes{v0.9}{2022/02/09}{using \cs{pkg} for automatic link generation}
% classes,
%    \begin{macrocode}
\newcommand*{\cls}{\pkg}
%    \end{macrocode}
% \begin{command}{\pkg}
% \changes{v0.8}{2022/02/08}{using \cs{textsf}}
% \changes{v0.9}{2022/02/09}{automatic link generation}
% packages (note: we cannot use \cs{ExplSyntaxOn}/\cs{ExplSyntaxOff}, because
% \cs{href} would generate a file link),
%    \begin{macrocode}
\NewDocumentCommand{\pkg}{sO{https://www.ctan.org/pkg/#3}m}{%
  \IfBooleanTF{#1}{\@gobble}{%
    \csname tl_if_blank:nTF\endcsname{#2}{\@gobble}{\href}%
  }%
  {#2}{\textsf{#3}}%
}
%    \end{macrocode}
% \begin{command}{\opt}
% options,
%    \begin{macrocode}
\newcommand*{\opt}{\texttt}
%    \end{macrocode}
% \begin{command}{\optvalue}
% option values,
%    \begin{macrocode}
\newcommand*{\optvalue}{\texttt}
%    \end{macrocode}
% \begin{command}{\env}
% environments,
%    \begin{macrocode}
\newcommand*{\env}{\texttt}
%    \end{macrocode}
% \begin{command}{\len}
% \changes{v0.6}{2022/02/02}{added}
% lengths,
%    \begin{macrocode}
\newcommand*{\len}{\cs}
%    \end{macrocode}
% \begin{command}{\cnt}
% counters,
%    \begin{macrocode}
\newcommand*{\cnt}{\texttt}
%    \end{macrocode}
% \begin{command}{\fnt}
% fonts,
%    \begin{macrocode}
\newcommand*{\fnt}{\texttt}
%    \end{macrocode}
% \begin{command}{\var}
% \changes{v0.6}{2022/02/02}{added}
% variables,
%    \begin{macrocode}
\newcommand*{\var}{\texttt}
%    \end{macrocode}
% \begin{command}{\plen}
% \changes{v0.6}{2022/02/02}{added}
% pseudo-lengths,
%    \begin{macrocode}
\newcommand*{\plen}{\texttt}
%    \end{macrocode}
% \begin{command}{\pstyle}
% \changes{v0.8}{2022/02/08}{added}
% page styles,
%    \begin{macrocode}
\newcommand*{\pstyle}{\texttt}
%    \end{macrocode}
% \begin{command}{\dhook}
% \changes{v0.91}{2022/03/10}{added}
% do hooks.
%    \begin{macrocode}
\newcommand*{\dhook}{\texttt}
%    \end{macrocode}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
%
%
% \subsection{Documentation Items}
% \label{sec:documentationitems}
%
% \KOMAScript{} has several additional items beside macros and environments.
% The old \cls*{scrdoc} class provides macros, environments, options, lengths,
% counters, variables and fonts. But now we also distinguish internal macros
% vs. users commands and internal lengths vs. user lengths. In this
% documentation we additionally provide documentation items.
%
% \begin{docitem}{Macro}
% \begin{command}{\DescribeMacro}
% \begin{environment}{macro}
% An internal macro.
%    \begin{macrocode}
\RenewDocElement[%
  macrolike = true,
  toplevel  = false,
  idxtype   = ,
  idxgroup  = TeX macros (internal)\actualchar\TeX{} macros (internal),
  printtype = \textit{intern}
]{Macro}{macro}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{Command}
% \begin{command}{\DescribeCommand}    
% \begin{environment}{command}
% User command.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = true,
  toplevel  = true,
  idxtype   = ,
  idxgroup  = Commands,
  printtype = ,
]{Command}{command}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{Env}
% \begin{command}{\DescribeEnv}    
% \begin{environment}{environment}
% Environments.
%    \begin{macrocode}
\RenewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{env.} ,
  idxgroup  = Environments,
  printtype = \textit{env.}
]{Env}{environment}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{Option}
% \begin{command}{\DescribeOption}
% \begin{environment}{option}
% Options.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{opt.},
  idxgroup  = Options,
  printtype = \textit{opt.}
]{Option}{option}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{ILength}
% \begin{command}{\DescribeILength}
% \begin{environment}{ilength}
% An internal length.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = true,
  toplevel  = false,
  idxtype   = ,
  idxgroup  = Lengths (internal),
  printtype = \textit{ilen.}
]{ILength}{ilength}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{Length}
% \begin{command}{\DescribeLength}
% \begin{environment}{length}
% User length.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = true,
  toplevel  = true,
  idxtype   = \textit{len.},
  idxgroup  = Lengths (user),
  printtype = \textit{len.},
]{Length}{length}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{Counter}
% \begin{command}{\DescribeCounter}
% \begin{environment}{counter}
% User counter.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{cnt.},
  idxgroup  = Counters,
  printtype = \textit{cnt.},
]{Counter}{counter}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{KOMAfont}
% \begin{command}{\DescribeKOMAfont}
% \begin{environment}{fontelement}
% \KOMAScript{} font element
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{font},
  idxgroup  = KOMA-Script font elements\actualchar\KOMAScript{} font elements,
  printtype = \textit{font},
]{KOMAfont}{fontelement}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{KOMAvar}
% \begin{command}{\DescribeKOMAvar}
% \begin{environment}{variable}
% \KOMAScript{} variable (used by \cls*{scrlttr2} and \pkg*{scrletter}).
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{var.},
  idxgroup  = KOMA-Script variables\actualchar\KOMAScript{} variables,
  printtype = \textit{var.},
]{KOMAvar}{variable} 
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{PLength}
% \changes{v0.6}{2022/02/02}{added}
% \begin{command}{\DescribePLength}
% \changes{v0.6}{2022/02/02}{added}
% \begin{environment}{peudolength}
% \changes{v0.6}{2022/02/02}{added}
% \KOMAScript{} pseudo-lengths (used by \cls*{scrlttr2} and \pkg*{scrletter}).
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{plen.},
  idxgroup  = KOMA-Script pseudo-lengths\actualchar\KOMAScript{} pseudo-lengths,
  printtype = \textit{plen.},
]{PLength}{pseudolength} 
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{PageStyle}
% \changes{v0.8}{2022/02/08}{added}
% \changes{v0.92}{2022/07/08}{index group fixed}
% \begin{command}{\DescribePageStyle}
% \changes{v0.8}{2022/02/08}{added}
% \begin{environment}{pgstyle}
% \changes{v0.8}{2022/02/08}{added}
% Page style.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{pgstyle},
  idxgroup  = Page styles,
  printtype = \textit{style}
]{PageStyle}{pgstyle}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
% \begin{docitem}{DoHook}
% \changes{v0.91}{2022/03/10}{added}
% \changes{v0.92}{2022/07/08}{index group fixed}
% \begin{command}{\DescribeDoHook}
% \changes{v0.91}{2022/03/10}{added}
% \begin{environment}{dohook}
% \changes{v0.91}{2022/03/10}{added}
% Page style.
%    \begin{macrocode}
\NewDocElement[%
  macrolike = false,
  toplevel  = true,
  idxtype   = \textit{do hook},
  idxgroup  = Do hooks,
  printtype = \textit{dohook}
]{DoHook}{dohook}
%    \end{macrocode}
% \end{environment}
% \end{command}
% \end{docitem}
%
%    \begin{macrocode}
%</class>
%    \end{macrocode}
%
% \Finale
% \PrintChanges
%
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
% End: