Debian Codegraph @

texmf-dist/source/latex/koma-script/koma-script-source-doc.dtx

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