% \iffalse meta-comment
% ==========================================================================
% komascript-source.doc.dtx
% Copyright (c) Markus Kohm, 2023
%
% 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/scrguide-de.pdf#cha:typearea}{\pkg*{typearea}}|
%     \textrightarrow{}
%     \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.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:
