% \iffalse meta-comment
% ======================================================================
% scrkernel-listsof.dtx
% Copyright (c) Markus Kohm, 2002-2025
%
% 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.
% ======================================================================
%%% From File: $Id: scrkernel-listsof.dtx 4193 2025-08-12 14:24:39Z kohm $
%<prepare>%%%            (run: prepare)
%<option>%%%            (run: option)
%<body>%%%            (run: body)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
  \filedate$Date: 2025-08-12 16:24:39 +0200 (Di, 12. Aug 2025) $
  \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
  \filerevision$Revision: 4193 $
  \edef\reserved@a{%
    \noexpand\endgroup
    \noexpand\ProvidesFile{scrkernel-listsof.dtx}%
                          [\filedate\space\filerevision\space
                           KOMA-Script source
                           (lists of)]%
  }%
\reserved@a
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\usepackage{hvlogos}
\setcounter{StandardModuleDepth}{2}
\begin{document}
\DocInput{scrkernel-listsof.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v2.95}{2002/06/28}{first version after splitting \file{scrclass.dtx}}
% \changes{v3.36}{2022/02/28}{switch over from \cls*{scrdoc} to
%   \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/28}{whole implementation documentation in English}
% \changes{v3.40}{2023/04/17}{guide names changed}
%
% \GetFileInfo{scrkernel-listsof.dtx}
% \title{Table of Contents, List of Figures, and List of Tables Within
%   \href{https://komascript.de}{\KOMAScript} Classes}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
%   \LaTeX{} classes provides a number of directories like the table of
%   contents, list of figures, and list of
%   tables. \file{scrkernel-listsof.dtx} provides parts of the implementation
%   of them. But note: Since the \KOMAScript{} classes use \pkg*{tocbasic} for
%   all these tables and lists, most of the code has been moved to
%   \file{tocbasic.dtx} and \file{scrkernel-tocstyle.dtx}.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user documentation the commands implemented here in the
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
% English \file{scrguide-en.pdf}.
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of the table of contents and similar lists in the
%   \KOMAScript{} classes}
%
% Only \cls*{scrartcl}, \cls*{scrbook} and \cls{scrreprt} provide floats and
% headings. So only these need to provide tables and lists of such
% elements. Especially the letter class \cls*{scrlttr2} does not need any of
% this code.
%
%    \begin{macrocode}
%<*!letter>
%    \end{macrocode}
% 
% \subsection{Code used by all of the tables and lists of content}
%
% \begin{macro}{\numberline@numberpostfix}
% \changes{v3.20}{2016/03/15}{used to add \cs{autodot}}
% We extend this macro of \pkg*{tocbasic} to add the \cs{autodot} to the
% numbers.
% \begin{description}
% \item[ToDo:] Replace this by any kind of \emph{addto hook command}, maybe
%   even by a generic \LaTeX{} hook.
% \end{description}
%    \begin{macrocode}
%<*body>
\g@addto@macro{\numberline@numberpostfix}{\autodot}
%</body>
%    \end{macrocode}
% \end{macro}%^^A \numberline@numberpostfix
%
% \begin{command}{\numberline}
% \changes{v3.20}{2016/03/15}{using definition of \pkg*{tocbasic}}
% Just activate the usage of the \pkg*{tocbasic} definition of
% \cs{numberline}.
%    \begin{macrocode}
%<*body>
\usetocbasicnumberline[%
  \ClassInfo{\KOMAClassName}{Redefining `\string\numberline'}%
]
%</body>  
%    \end{macrocode}
% \end{command}%^^A \numberline
%
% \changes{v3.06}{2010/06/02}{activating \pkg*{tocbasic} feature
%   \texttt{chapteratlist}}
% For classes with chapters we use the \pkg*{tocbasic} feature
% \texttt{chapteratlist} for all directories of category/owner
% \texttt{float}. This is done not only for already existing directories but
% also for those, that will be added later (using \pkg*{tocbasic}). Note: By
% default this feature is used to add a vertical distance to, e.g., the list
% of figures and the list of tables with each new chapter.
%    \begin{macrocode}
%<*body&(book|report)>
\doforeachtocfile[float]{%
  \setuptoc{\@currext}{chapteratlist}%
}
\AtAddToTocList[float]{%
  \setuptoc{\@currext}{chapteratlist}%
}
%</body&(book|report)>
%    \end{macrocode}
%
% \begin{macro}{\before@starttoc,\after@starttoc}
% \changes{v2.8q}{2001/11/14}{added}
% If either \texttt{tocleft} or \texttt{listsleft} is used, we need to collect
% additional information about the natural width of the numbers and also have
% to change the used width of the numbers. So we have two macros, that will be
% added to the \pkg*{tocbasic} hooks. \cs{before@starttoc} does some internal
% changes before \cs{@starttoc} to collect and use the
% information. \cs{after@starttoc} writes the information to the \file{aux}
% file after \cs{@starttoc}.
% \begin{macro}{\scr@dottedtocline}
% \changes{v2.9k}{2003/01/03}{also change the third argument}^^A
% \begin{macro}{\scr@numberline}
% \changes{v3.06}{2010/05/18}{removed}^^A
% \end{macro}
% \begin{macro}{\last@l@number}
% The \KOMAScript{} classes themselves use the \pkg*{tocbasic} entry style
% \texttt{tocline}. However other packages may use the \LaTeX{} kernel command
% \cs{@dottedtocline}. Currently we support these too. But to do so, we need
% to locally redefine \cs{@dottedtocline} to change the second and third
% argument. The second is the \meta{indent} and has always to be 0 (with
% \texttt{listsleft}). The third is the number width and has to be
% \cs{last@l@number}. I do not like to redefine \LaTeX{} kernel macros, so
% maybe the support for list entries, which use \cs{@dottedtocline}, will be
% removed in future. However, in this case we still would need some of the
% code or similar code to initialize values and features of \pkg*{tocbasic}.
% At loading time we only need to \emph{reserve} the macros. The real
% definition will be done when reading the auxiliary files of the lists or the
% main \file{aux} file.
%    \begin{macrocode}
%<*body>
\newcommand*{\scr@dottedtocline}{}
\newcommand*{\last@l@number}{}
%    \end{macrocode}
% \end{macro}^^A \last@l@number
% \end{macro}^^A \scr@dottedtocline
% \begin{macro}{\@l@number,\set@l@number}
% \changes{v2.8q}{2001/11/14}{added}
% We also need local macros to store the currently maximal number width while
% reading an auxiliary file. \cs{set@l@number} not only has to update
% \cs{@l@number} but also to set \len{@temdima} to the real maximum. It is
% used inside \cs{numberline@box}, which is used inside \cs{numberline}, if
% the \pkg*{tocbasic} definition of \cs{numberline} is used.
%    \begin{macrocode}
\newcommand*{\@l@number}{}
\newcommand*{\set@l@number}[1]{%
  \settowidth{\@tempdima}{#1\enskip}%
  \ifdim\@tempdima >\@l@number
    \xdef\@l@number{\the\@tempdima}%
  \fi%
  \ifdim\@tempdima >\last@l@number \else
    \setlength{\@tempdima}{\last@l@number}%
  \fi%
}
%    \end{macrocode}
% \end{macro}^^A \@l@number,\set@l@number
% \changes{v2.95a}{2006/07/12}{empty case initialization}
% \changes{v3.06}{2010/05/18}{re-defining \cs{numberline} instead of
%   \cs{numberline@box}}
% \changes{v3.37}{2022/06/17}{typofix}
% The usage of all these local macros has to be initialized in
% \cs{before@starttoc}.
%    \begin{macrocode}
\newcommand*{\before@starttoc}[1]{%
  \let\scr@dottedtocline=\@dottedtocline
  \renewcommand*{\@dottedtocline}[3]{%
    \scr@dottedtocline{##1}{\z@}{\last@l@number}}%
  \renewcommand*{\numberline@box}[1]{%
    \set@l@number{##1}\hb@xt@\@tempdima{##1}}%
  \gdef\@l@number{\z@}%
  \@ifundefined{#1@l@number}{%
    \def\last@l@number{2em}%
  }{%
    \expandafter\ifx\csname #1@l@number\endcsname\@empty
      \let\last@l@number\z@
    \else
      \expandafter\let\expandafter\last@l@number
      \expandafter=\csname#1@l@number\endcsname
    \fi
  }%
%    \end{macrocode}
% \changes{v3.20}{2015/11/26}{initialization of \pkg*{tocbasic} values}
% We also have to locally change the indent and number width values of the
% \pkg*{tocbasic} styles.
%    \begin{macrocode}
  \begingroup
    \def\do@endgroup{\endgroup}%
    \def\do##1{%
      \scr@ifundefinedorrelax{scr@tso@##1@numwidth}{}{%
%<*trace>
        \ClassInfo{\KOMAClassName}{%
          Setting numwidth of `##1' to \last@l@number}%
%</trace>
        \l@addto@macro\do@endgroup{%
          \@namedef{scr@tso@##1@numwidth}{\last@l@number}%
        }%
      }%
      \scr@ifundefinedorrelax{scr@tso@##1@indent}{}{%
%<*trace>
        \ClassInfo{\KOMAClassName}{%
          Setting indent of `##1' to \string\z@}%
%</trace>
        \l@addto@macro\do@endgroup{%
          \@namedef{scr@tso@##1@indent}{\z@}%
        }%
      }%
    }%
    \@nameuse{scr@dte@donumwidth}%
  \do@endgroup
}
\newcommand*{\after@starttoc}[1]{%
  \protected@write\@auxout{}{%
    \string\gdef\expandafter\string\csname#1@l@number\endcsname{%
      \@l@number}}%
}
%    \end{macrocode}
% Last but not least we have to add the code to the \pkg*{tocbasic} hooks
% before and after \cs{@starttoc}. Note: This is also used for the table of
% contents, but in this case \cs{if@dynlist} will be used different.
% \begin{description}
% \item[ToDo:] A better suggestion could be to use \meta{category} dependent
%   code here to use \cs{if@dynlist} only for \meta{category} \texttt{float}
%   but \cs{if@tocleft} for \meta{category} \texttt{ToC}. So the support for
%   things like \emph{table of appendix contents} could be benefit.
% \end{description}
%    \begin{macrocode}
\g@addto@macro\tocbasic@@before@hook{%
  \if@dynlist\expandafter\before@starttoc\expandafter{\@currext}\fi
}
\g@addto@macro\tocbasic@@after@hook{%
  \if@dynlist\expandafter\after@starttoc\expandafter{\@currext}\fi
}
%</body>
%    \end{macrocode}
% \end{macro}^^A \@dottedtocline
%
%
% \subsection{The table of contents}
%
% \changes{v3.27}{2019/05/11}{init code moved from \file{tocbasic.dtx}}
% \changes{v3.01}{2008/11/13}{auto-activation of feature \texttt{onecolumn}}
% Set feature \texttt{onecolumn} for every ToC file.
%    \begin{macrocode}
%<*prepare&(book|report)>
\AtAddToTocList[\@currname.\@currext]{\setuptoc{\@currext}{onecolumn}}%
\AtAddToTocList[ToC]{\setuptoc{\@currext}{onecolumn}}%
%</prepare&(book|report)>
%    \end{macrocode}
% Tell the package, what files are used:
% \changes{v3.27}{2019/05/11}{use category \texttt{ToC} for the table of
%   contents}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}%^^A
%    \begin{macrocode}
%<*prepare>
\addtotoclist[ToC]{toc}
\Ifstr{\ext@toc}{toc}{}{%
  \expandafter\addtotoclist
  \expandafter[\expandafter T\expandafter o\expandafter C\expandafter ]%
  \expandafter{\ext@toc}%
}
%</prepare>
%    \end{macrocode}
%
% \begin{macro}{\@tocleftfalse,\@tocleftrue,\if@tocleft}
% \changes{v2.8q}{2001/11/14}{added}
% \changes{v2.98c}{2008/03/05}{earlier definition}
% The switch is used to store the information whether to use a flat
% (\cs{@toclefttrue}) or a graduated (\cs{@tocleftalse}) table of contents.
%    \begin{macrocode}
%<*option>
\newif\if@tocleft
%</option>
%    \end{macrocode}
% \end{macro}^^A … \if@tocleft
%
% \begin{option}{toc}
% \changes{v2.98c}{2008/03/04}{added}
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
% \changes{v3.12}{2013/08/26}{\cs{KOMA@options} replaced by
%   \cs{KOMAExecuteOptions}}
% \changes{v3.12a}{2014/01/17}{\cs{KOMAExecuteOptions} replaced by
%   \cs{KOMAoptions}}
% \changes{v3.18}{2015/06/15}{value \opt{\quotechar=indexnumbered} added}
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
%   option storage commands}
% The main features of the table of contents can be configured by this
% option.
%    \begin{macrocode}
%<*option>
\KOMA@key{toc}{%
  \KOMA@set@ncmdkey{toc}{@tempa}{%
%    \end{macrocode}
% \changes{v3.28}{2019/10/21}{several alias values added}
% The provided values are (aliases are also available):
% \begin{description}
% \item[\opt{=noindex}:] (default) for the index neither add an entry to the
%   table of contents nor number the heading of the index.
% \end{description}
%    \begin{macrocode}
    {noindex}{0},{noidx}{0},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=index}:] for the index add an entry to the table of contents,
%   but do not number the index.
% \end{description}
%    \begin{macrocode}
    {index}{1},{idx}{1},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=indexnumbered}:] number the index and therefore also add an
%   entry to the table of contents.
% \end{description}
%    \begin{macrocode}
    {indexnumbered}{2},{idxnumbered}{2},{numberedindex}{2},{numberedidx}{2},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=nolistof}:] (default) for any list with category/owner
%   \texttt{float} neither add an entry to the table of contents, nor
%   number the heading of the list of the floats.
% \end{description}
%    \begin{macrocode}
    {nolistof}{3},{nolistsof}{3},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=listof}:] for each list with category/owner \texttt{float} add an
%   entry to the table of contents, but do not number the list of the floats.
% \end{description}
%    \begin{macrocode}
    {listof}{4},{listsof}{4},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=listofnumbered}:] for each list of category/owner \texttt{float}
% number the list of floats and therefore add an entry to table of contents.
% \end{description}
%    \begin{macrocode}
    {listofnumbered}{5},{numberedlistof}{5},%
    {listsofnumbered}{5},{numberedlistsof}{5},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=nobibliography}:] (default) for the bibliography neither add an
%   entry to the table if contents nor number the heading.
% \end{description}
%    \begin{macrocode}
    {nobibliography}{6},{nobib}{6},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=bibliography}:] for the bibliography add an entry to the table
%   of contents, but do not number the bibliography.
% \end{description}
%    \begin{macrocode}
    {bibliography}{7},{bib}{7},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=bibliographynumbered}:] number the bibliography and therefore
%   add an entry to the table of contents.
% \end{description}
%    \begin{macrocode}
    {bibliographynumbered}{8},{bibnumbered}{8},{numberedbibliography}{8},%
    {numberedbib}{8},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=flat}:] use the flat version of the table of contents (all
%   numbers are at one column, all texts in another one).
% \end{description}
%    \begin{macrocode}
    {flat}{9},{left}{9},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=graduated}:] (default) use a hierarchical indented table of
%   contents similar to the standard classes.
% \end{description}
%    \begin{macrocode}
    {graduated}{10},{indent}{10},{indented}{10},%
%    \end{macrocode}
% \changes{v3.12}{2014/09/24}{values \opt{\quotechar=numberline} and
%   \opt{\quotechar=nonumberline} etc. added}
% \begin{description}
% \item[\opt{=numberline}:] indent entries without number like entries with
%   number.
% \end{description}
%    \begin{macrocode}
    {indenttextentries}{11},{indentunnumbered}{11},{numberline}{11},%
%    \end{macrocode}
%    \begin{macrocode}
% \begin{description}
% \item[\opt{nonumberline}:] (default) do not indent the first line of an
%   entry without number
% \end{description}
%    \begin{macrocode}
    {leftaligntextentries}{12},{leftalignunnumbered}{12},{nonumberline}{12},%
%    \end{macrocode}
% \changes{v3.15}{2015/01/14}{values \opt{\quotechar=chapterentrywithdots},
%   \opt{\quotechar=chapterentrywithoutdot} resp.
%   \opt{\quotechar=sectionentrywithdots},
%   \opt{\quotechar=sectionentrywithoutdot} added}
% \begin{description}
% \item[\opt{=chapterentrywithdots}:] classes with \cs{chapter} provide a dot
%   filler also for chapter entries.
% \end{description}
%    \begin{macrocode}
%<book|report>    {chapterentrywithdots}{13},{chapterentrydotfill}{13},
%    \end{macrocode}
% \begin{description}
% \item[\opt{=chapterentrywithoutdots}:] (default) classes with \cs{chapter} use
%   a space filler for chapter entries.
% \end{description}
%    \begin{macrocode}
%<book|report>    {chapterentrywithoutdots}{14},{chapterentryfill}{14}%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=sectionentrywithdots}:] classes without \cs{chapter} use
%  dot filler also for section entries.
% \end{description}
%    \begin{macrocode}
%<article>    {sectionentrywithdots}{13},{sectionentrydotfill}{13},
%    \end{macrocode}
% \begin{description}
% \item[\opt{=sectionentrywithoutdots}:] (default) classes without
%   \cs{chapter} use a space filler for section entries.
% \end{description}
%    \begin{macrocode}
%<article>    {sectionentrywithoutdots}{14},{sectionentryfill}{14}%
  }{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifcase \@tempa\relax % noindex
      \KOMAoptions{index=notoc}%
    \or % index
      \KOMAoptions{index=totoc}%
    \or % indexnumbered
      \KOMAoptions{index=numbered}%
    \or % listof
      \KOMAoptions{listof=notoc}%
    \or % nolistof
      \KOMAoptions{listof=totoc}%
    \or % listofnumbered
      \KOMAoptions{listof=numbered}%
    \or % nobibliography
      \KOMAoptions{bibliography=nottotoc}%
    \or % bibliography
      \KOMAoptions{bibliography=totoc}%
    \or % bibliographynumbered
      \KOMAoptions{bibliography=totocnumbered}%
    \or % flat
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{flat}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{graduated}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{flat}%
      \@toclefttrue
    \or % graduated
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{flat}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{graduated}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{graduated}%
      \@tocleftfalse
    \or % indenttextentries
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{indenttextentries}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{leftaligntextentries}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{indenttextentries}%
      \expandafter\setuptoc\expandafter{\ext@toc}{numberline}%
    \or % leftaligntextentries
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{indenttextentries}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{leftaligntextentries}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{leftaligntextentries}%
      \expandafter\unsettoc\expandafter{\ext@toc}{numberline}%
    \or % chapterentrywithdots/sectionentrywithdots
%<book|report>      \KOMAoptions{chapterentrydots=true}%
%<article>      \KOMAoptions{sectionentrydots=true}%
    \or % chapterentrywithoutdots/sectionentrywithoutdots
%<book|report>      \KOMAoptions{chapterentrydots=false}%
%<article>      \KOMAoptions{sectionentrydots=false}%
    \fi
  \fi
}
%</option>
%    \end{macrocode}
% \end{option}
%
% \begin{option}{tocleft,tocindent}
% \changes{v2.8q}{2001/11/14}{added}
% \changes{v2.98c}{2008/03/05}{obsolet}
% \changes{v3.01a}{2008/11/20}{deprecated}
% \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
%    \begin{macrocode}
%<*option&!v4>
\KOMA@DeclareDeprecatedOption{tocleft}{toc=flat}
\KOMA@DeclareDeprecatedOption{tocindent}{toc=graduated}
%</option&!v4>
%    \end{macrocode}
% \end{option}^^A tocleft,tocindent
%
% \begin{command}{\contentsname}
% \begin{command}{\listoftocname}
% \changes{v3.00}{2008/07/03}{added to be used by \pkg*{tocbasic}}
% \changes{v3.27}{2019/05/11}{language dependency added}
% The name of the  table of contents.
%    \begin{macrocode}
%<*body>
\newcommand*\contentsname{Contents}
\newcommand*\listoftocname{\contentsname}
\providecaptionname{american,australian,british,canadian,english,newzealand,%
  UKenglish,ukenglish,USenglish,usenglish}\contentsname{Contents}%
%</body>
%    \end{macrocode}
% \end{command}^^A \listoftocname
% \end{command}^^A \contentsname
%
% \begin{counter}{tocdepth}
% The counter is used to define, down to which level the entries are shown in
% the table of contents (resp. list of floats, because the same value is used
% there). Note: We don't use symbolic values here, because usage of symbolic
% values would add an additional order dependency with the corresponding
% \cs{DeclareSecionCommand}.
%    \begin{macrocode}
%<*body>
%<book|report>\setcounter{tocdepth}{2}
%<article>\setcounter{tocdepth}{3}
%</body>
%    \end{macrocode}
% \end{counter}^^A tocdepth
%
% \begin{macro}{\toc@heading}
% \changes{v2.3h}{1995/01/21}{added for \cls*{scrartcl}}
% \changes{v2.95}{2002/06/28}{added for \cls*{scrreprt}and \cls*{scrbook}}
% \changes{v3.00}{2008/07/04}{deprecated}
% \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
% \changes{v3.30}{2020/02/24}{white space at end of warning removed}
% This has been defined before usage of \pkg*{tocbasic}. Internally it is not
% used any longer.
%    \begin{macrocode}
%<*body>
\newcommand*\toc@heading{%
  \ClassWarning{\KOMAClassName}{%
    usage of deprecated \string\toc@heading!\MessageBreak
    You should use the features of package `tocbasic'\MessageBreak
    instead of \string\toc@heading.\MessageBreak
    Definition of \string\toc@heading\space may be removed from\MessageBreak
    KOMA-Script soon, so it should not be used%
  }%
%<article>  \section*{\contentsname}%
%<book|report>  \chapter*{\contentsname}%
  \@mkboth{\MakeMarkcase{\contentsname}}{\MakeMarkcase{\contentsname}}%
}
%</body>
%    \end{macrocode}
% \end{macro}^^A \toc@heading
%
% \begin{macro}{\toc@l@number}
% \changes{v2.8q}{2001/11/14}{added}
% The number length storage used by \cs{before@starttoc} for \meta{extension}
% \texttt{toc}. For safety we just \emph{reserve} it.
%    \begin{macrocode}
%<*body>
\newcommand*{\toc@l@number}{}
%</body>
%    \end{macrocode}
% \end{macro}^^A \toc@l@number
%
% \begin{command}{\tableofcontents}
% \changes{v2.3h}{1995/01/21}{using \cs{toc@heading}}
% \changes{v2.8l}{2001/08/16}{group added an \len{parskip} set to 0}
% \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse} and \cs{@parskip@indent}}
% \changes{v2.8q}{2001/11/14}{\cs{if@tocleft} changed}
% \changes{v2.95}{2002/06/28}{\cls*{scrartcl} also uses \cs{if@tocleft}}
% \changes{v2.95}{2004/11/05}{\cs{@parskipfalse} and \cs{@parskip@indent} replaced}
% \changes{v3.00}{2008/07/04}{re-implementation using \pkg*{tocbasic}}
% The table of contents. See the note above about the local change of
% \cs{if@dynlist}.
%    \begin{macrocode}
%<*body>
\newcommand*{\tableofcontents}{%
  \begingroup
    \let\if@dynlist\if@tocleft
    \expandafter\listoftoc\expandafter{\ext@toc}%
  \endgroup
}
%</body>
%    \end{macrocode}
% \end{command}^^A \tableofcontents
%
% \begin{command}{\addtocentrydefault}
% \changes{v3.08}{2010/11/01}{added}
% \changes{v3.12}{2013/09/24}{using new \pkg*{tocbasic} macro
%   \cs{tocbasic@addxcontentsline}}
% Instead of making the entries into the table of contents directly with
% the \LaTeX{} low level command \cs{addcontentsline} we provide a class
% specific low level user command
% \begin{quote}
%   \cs{addtocentrydefault}\marg{level name}\marg{formatted number}\marg{entry text}
% \end{quote}
% that uses the \pkg*{tocbasic} package author command
% \cs{tocbasic@addctontentsline}. We cannot use \cs{addxcontentsline} because
% this will run \cs{add\meta{level name}\meta{toc}entry} if available and
% \cs{addtocentrydefault} is used by the entry commands
% \cs{addchaptertocentry}, \cs{addsectiontocentry}. So \cs{addtoentrydefault}
% is a helper for the callbacks from \cs{addxcontentsline} and needs to use
% the package author interface instead of the user interface. For not numbered
% entries the \meta{formatted number} should be empty (not only expand to no
% output). Note: Entries with empty \meta{entry text} will be omitted.
%    \begin{macrocode}
%<*body>
\newcommand{\addtocentrydefault}[3]{%
  \expandafter\tocbasic@addxcontentsline\expandafter{\ext@toc}{#1}{#2}{#3}%
}
%</body>
%    \end{macrocode}
% \end{command}
%
%
% \subsection{The lists of floats (or similar environments)}
%
% The list of tables, list of figures and similar lists of environments with
% category/owner \texttt{float} are very similar to the table of contents. But
% they use a own set of options and also some commands.
%
% \changes{v3.25}{2017/10/10}{extension \texttt{lof} not added explicitely}
% \changes{v3.25}{2017/10/10}{extension \texttt{lot} not added explicitely}
% Note: We must not add extensions \texttt{lof} and \texttt{lot} explicitely,
% because these files will be prepared using \cs{DeclareNewTOC} that also
% registers the extension.
%
% \changes{v3.01}{2008/11/13}{auto-activation of feature \texttt{onecolumn}}
% Set feature \texttt{onecolumn} for every float list file.
%    \begin{macrocode}
%<*prepare&(book|report)>
\AtAddToTocList[float]{\setuptoc{\@currext}{onecolumn}}%
%</prepare&(book|report)>
%    \end{macrocode}
%
% \begin{macro}{\float@@listhead}
% \changes{v2.98c}{2008/03/05}{added}
% \changes{v3.01}{2008/11/14}{deprecated}
% Prints only the heading, nothing else. The heading text is the argument.
%    \begin{macrocode}
%<*option>
\newcommand*{\float@@listhead}{%
%<article>  \section*
%<report|book>  \chapter*
}
%</option>
%    \end{macrocode}
% \end{macro}^^A \float@@listhead
%
% \begin{macro}{\@dynlistfalse,\@dynlisttrue,\if@dynlist}
% \changes{v2.8q}{2001/11/14}{added}
% The switch to select the flat (\cs{@dynlisttrue}) or graduated
% (\cs{@dynlistfalse)} list type.
%    \begin{macrocode}
%<*option>
\newif\if@dynlist
%</option>
%    \end{macrocode}
% \end{macro}^^A … \if@dynlist
%
% \begin{option}{listof}
% \changes{v2.98c}{2008/03/05}{added}
% \changes{v3.06}{2010/06/02}{options for \pkg*{tocbasic} features do not only
%   work for the currently defined lists but all future lists of category
%   \texttt{float}}
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
% \changes{v3.12}{2013/06/26}{\cs{KOMA@options} replaced by
%   \cs{KOMAExecuteOptions}}
% \changes{v3.12a}{2014/01/17}{\cs{KOMAExecuteOptions} replaced by
%   \cs{KOMAoptions}}
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
%   option storage commands}
% The main features of the lists of floats can be configured by this option.
%    \begin{macrocode}
%<*option>
\KOMA@key{listof}{%
  \KOMA@set@ncmdkey{listof}{@tempa}{%
%    \end{macrocode}
% The provided values are (aliases are also available):
% \begin{description}
% \item[\opt{=notoc}:] (default) neither number the lists of floats nor add
%   entries to them into the table of contents.
% \end{description}
%    \begin{macrocode}
    {notoc}{0},{nottotoc}{0},{plainheading}{0},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=totoc}:] do not number the lists of floats but nevertheless add
%   an entry for each of them to the table of contents.
% \end{description}
%    \begin{macrocode}
    {totoc}{1},{toc}{1},{notnumbered}{1},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=numbered}:] number the lists of floats and therefore also add an
%   for each of them to the table of contents.
% \end{description}
%    \begin{macrocode}
    {numbered}{2},{totocnumbered}{2},{tocnumbered}{2},{numberedtotoc}{2},%
    {numberedtoc}{2},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=flat}:] use the flat version of the lists of floats (all
%   numbers are at one column, all texts in another one). Usually this only
%   removes the indent and calculates the needed width of the numbers. But,
%   e.g., if chapters are added, it does work over all levels.
% \end{description}
%    \begin{macrocode}
    {flat}{3},{left}{3},%
% \item[\opt{=graduated}:] (default) use hierarchical indented lists of
%   floats similar to the standard classes.
% \end{description}
%    \begin{macrocode}
    {graduated}{4},{indent}{4},{indented}{4},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=leveldown}:] Use for the lists of floats a section hierarchy one
%   level below the standard level.
% \end{description}
%    \begin{macrocode}
    {leveldown}{5},
%    \end{macrocode}
% \changes{v3.25}{2017/12/04}{value \opt{\quotechar=standardlevel} added}
% \begin{description}
% \item[\opt{=standardlevel}:] (default) Use for the lists of floats the
%   standard hierarchy.
% \end{description}
%    \begin{macrocode}
    {standardlevel}{6},
%    \end{macrocode}
% \changes{v3.06}{2010/05/18}{value \opt{\quotechar=entryprefix} added}
% \begin{description}
% \item[\opt{=entryprefix}:] Prefix the number of each entry with
%   \cs{listof\meta{toc}entryprefix}. Note: This is more or less senseless and
%   does not work correctly with chapter entries in the lists of floats. It is
%   recommended to reconfigure the entries, e.g., using
%   \cs{DeclareTOCStyleEntry} or redefining \cs{add\meta{level
%   name}\meta{toc}entry} instead. Note: \opt{listof=entryprefix} also
%   activates \opt{listof=flat}.
% \end{description}
%    \begin{macrocode}
    {entryprefix}{7},
%    \end{macrocode}
% \changes{v3.12}{2014/09/24}{values \opt{\quotechar=numberline} and
%   \opt{\quotechar=nonumberline} etc. added}
% \begin{description}
% \item[\opt{=numberline}:] indent entries without number like entries with
%   number.
% \end{description}
%    \begin{macrocode}
    {indenttextentries}{8},{indentunnumbered}{8},{numberline}{8},%
%    \end{macrocode}
%    \begin{macrocode}
% \begin{description}
% \item[\opt{=nonumberline}:] (default) do not indent the first line of an
%   entry without number
% \end{description}
%    \begin{macrocode}
    {leftaligntextentries}{9},{leftalignunnumbered}{9},{nonumberline}{9}%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=chapterentry}:] \cls*{scrbook} and \cls*{scrreprt} provides
%   chapter entries into the lists of floats.
% \end{description}
%    \begin{macrocode}
%<*book|report>
    ,{chapterentry}{10},{withchapterentry}{10},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=nochaptergap}:] Alternatively the lists of floats can ignore chapters.
% \end{description}
%    \begin{macrocode}
    {nochaptergap}{11},{ignorechapter}{11},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=chaptergapsmall}:] (default) chapters can add a small
%   vertical distance into the lists of floats.
% \end{description}
%    \begin{macrocode}
    {chaptergapsmall}{12},{smallchaptergap}{12},%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=chaptergapline}:] chapters can add an empty line to the lists of
%   floats.
% \end{description}
%    \begin{macrocode}
    {chaptergapline}{13},{onelinechaptergap}{13}%
%</book|report>
  }{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifcase \@tempa\relax % notoc
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{nolistof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listofnumbered}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{nolistof}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{notoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{totoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{numbered}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{notoc}%
      \renewcommand*{\float@@listhead}{%
%<article>      \section*
%<report|book>      \chapter*
      }%
      \doforeachtocfile[float]{%
        \unsettoc{\@currext}{numbered}%
        \unsettoc{\@currext}{totoc}%
      }%
      \AtAddToTocList[float]{%
        \unsettoc{\@currext}{numbered}%
        \unsettoc{\@currext}{totoc}%
      }%
    \or% totoc
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{nolistof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listofnumbered}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{listof}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{notoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{totoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{numbered}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{totoc}%
      \renewcommand*{\float@@listhead}{%
%<article>      \addsec
%<report|book>      \addchap
      }%
      \doforeachtocfile[float]{%
        \unsettoc{\@currext}{numbered}%
        \setuptoc{\@currext}{totoc}%
      }%
      \AtAddToTocList[float]{%
        \unsettoc{\@currext}{numbered}%
        \setuptoc{\@currext}{totoc}%
      }%
    \or% numbered
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{nolistof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listof}%
      \KOMA@kav@remove{\KOMAClassFileName}{toc}{listofnumbered}%
      \KOMA@kav@add{\KOMAClassFileName}{toc}{listofnumbered}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{notoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{totoc}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{numbered}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{numbered}%
      \renewcommand*{\float@@listhead}{%
%<article>      \section
%<report|book>      \chapter
      }%
      \doforeachtocfile[float]{%
        \setuptoc{\@currext}{numbered}%
        \setuptoc{\@currext}{totoc}%
      }%
      \AtAddToTocList[float]{%
        \setuptoc{\@currext}{numbered}%
        \setuptoc{\@currext}{totoc}%
      }%
    \or% flat
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{flat}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{graduated}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{flat}%
      \@dynlisttrue
    \or% graduated
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{flat}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{graduated}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{graduated}%
      \@dynlistfalse
    \or% leveldown
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{standardlevel}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{leveldown}%
      \doforeachtocfile[float]{%
        \setuptoc{\@currext}{leveldown}%
      }%
      \AtAddToTocList[float]{%
        \setuptoc{\@currext}{leveldown}%
      }%
    \or% standardlevel
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{leveldown}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{standardlevel}%
      \doforeachtocfile[float]{%
        \unsettoc{\@currext}{leveldown}%
      }%
      \AtAddToTocList[float]{%
        \unsettoc{\@currext}{leveldown}%
      }%
    \or% entryprefix
      \KOMA@kav@add{\KOMAClassFileName}{listof}{entryprefix}%
      \@dynlisttrue
      \doforeachtocfile[float]{%
        \BeforeStartingTOC[\@currext]{%
          \scr@ifundefinedorrelax{listof\@currext entryname}{}{%
            \expandafter\def\expandafter\numberline@prefix
            \expandafter{\csname listof\@currext entryname\endcsname
              \nobreakspace}%
          }%
        }%
      }%
      \AtAddToTocList[float]{%
        \BeforeStartingTOC[\@currext]{%
          \scr@ifundefinedorrelax{listof\@currext entryname}{}{%
            \expandafter\def\expandafter\numberline@prefix
            \expandafter{\csname listof\@currext entryname\endcsname
              \nobreakspace}%
          }%
        }%
      }%
    \or% indenttextentries
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{indenttextentries}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{leftaligntextentries}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{indenttextentries}%
      \doforeachtocfile[float]{%
        \setuptoc{\@currext}{numberline}%
      }%
      \AtAddToTocList[float]{%
        \setuptoc{\@currext}{numberline}%
      }
    \or% leftaligntextentries
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{indenttextentries}%
      \KOMA@kav@remove{\KOMAClassFileName}{listof}{leftaligntextentries}%
      \KOMA@kav@add{\KOMAClassFileName}{listof}{leftaligntextentries}%
      \doforeachtocfile[float]{%
        \unsettoc{\@currext}{numberline}%
      }%
      \AtAddToTocList[float]{%
        \unsettoc{\@currext}{numberline}%
      }
%<*book|report>
    \or% chapterentry
      \KOMAoptions{chapteratlists=entry}%
    \or% chaptergap
      \KOMAoptions{chapteratlists=\z@}%
    \or% chaptergapsmall
      \KOMAoptions{chapteratlists=10\p@}%
    \or% chaptergapline
      \KOMAoptions{chapteratlists=\baselineskip}%
%</book|report>
    \fi
  \fi
}
\KOMA@kav@add{\KOMAClassFileName}{toc}{nolistof}
\KOMA@kav@add{\KOMAClassFileName}{listof}{notoc}
\KOMA@kav@add{\KOMAClassFileName}{listof}{graduated}
\KOMA@kav@add{\KOMAClassFileName}{listof}{leftaligntextentries}
%</option>
%    \end{macrocode}
% \end{option}^^A listof
%
% \begin{option}{liststotoc}
% \changes{v2.3h}{1995/01/21}{added}
% \changes{v2.8b}{2001/06/26}{using \cs{float@headings}}
% \changes{v2.4a}{1996/03/13}{\cs{listtabelname} relaces by \cs{listtablename}}
% \changes{v2.8g}{2001/07/18}{\cs{float@headings} renamed to
%     \cs{float@listhead}} 
% \changes{v2.98c}{2008/03/05}{obsolet}
% \changes{v3.01a}{2008/11/20}{deprecated}
% \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
%    \begin{macrocode}
%<*option&!v4>
\KOMA@DeclareDeprecatedOption{liststotoc}{listof=totoc}
%</option&!v4>
%    \end{macrocode}
% \end{option}^^A liststotoc
%
% \begin{option}{liststotocnumbered}
% \changes{v2.8q}{2002/04/08}{added}
% \changes{v2.9p}{2003/07/07}{number also in the running head}
% \changes{v2.98c}{2008/03/05}{obsolet}
% \changes{v3.01a}{2008/11/20}{deprecated}
% \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
%    \begin{macrocode}
%<*option&!v4>
\KOMA@DeclareDeprecatedOption{liststotocnumbered}{listof=numbered}
%</option&!v4>
%    \end{macrocode}
% \end{option}^^A liststotocnumbered
%
%
% \begin{option}{listsleft,listsindent}
% \changes{v2.8q}{2001/11/14}{added}
% \changes{v2.98c}{2008/03/05}{obsolet}
% \changes{v3.01a}{2008/11/20}{deprecated}
% \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
%    \begin{macrocode}
%<*option&!v4>
\KOMA@DeclareDeprecatedOption{listsleft}{listof=flat}
\KOMA@DeclareDeprecatedOption{listsindent}{listof=graduated}
%</option&!v4>
%    \end{macrocode}
% \end{option}^^A listsleft,listsindent
%
% \begin{option}{chapteratlists}
% \changes{v2.96a}{2006/12/03}{added}
% \changes{v2.98c}{2008/03/05}{not with \cls*{scrartcl}}
% \changes{v3.12a}{2014/01/17}{missing \cs{FamilyKeyStateProcessed} added}
% \changes{v3.17}{2015/03/12}{internal value storage}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
%   option storage commands}
% \begin{macro}{\@chaptertolistsfalse,\@chaptertoliststrue,\if@chaptertolists}
% \changes{v2.96a}{2006/12/03}{added}
% \changes{v3.12}{2013/09/24}{don't add lists to lists}
% \begin{macro}{\@chapterlistsgap}
% \changes{v2.96a}{2006/12/03}{added}
% We can do several special treatments inside the lists of floats, when a new
% chapter starts.
%    \begin{macrocode}
%<*option&(book|report)>
\newcommand*{\@chapterlistsgap}{10\p@}
\newif\if@chaptertolists\@chaptertolistsfalse
\KOMA@key{chapteratlists}[entry]{%
  \FamilyKeyStateProcessed
  \KOMA@kav@remove{\KOMAClassFileName}{listof}{chapterentry}%
  \KOMA@kav@remove{\KOMAClassFileName}{listof}{chaptergap}%
  \KOMA@kav@remove{\KOMAClassFileName}{listof}{chaptergapsmall}%
  \KOMA@kav@remove{\KOMAClassFileName}{listof}{chaptergapline}%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=entry}:] add the chapter heading also to the lists of
% float. \cs{@chaptertolisttrue} is used and the distance \cs{@chapterlistgap}
% is set to \len{z@}.
% \end{description}
%    \begin{macrocode}
  \Ifstr{#1}{entry}{%
    \@chaptertoliststrue\renewcommand*{\@chapterlistsgap}{\z@}%
    \KOMA@kav@replacevalue{\KOMAClassFileName}{chapteratlists}{entry}%
    \KOMA@kav@add{\KOMAClassFileName}{listof}{chapterentry}%
  }{%
%    \end{macrocode}
% \begin{description}
% \item[\opt{=\meta{distance}}:] use a vertical \meta{distance}.
% \end{description}
%    \begin{macrocode}
    \@chaptertolistsfalse\renewcommand*{\@chapterlistsgap}{#1}%
    \KOMA@kav@replacevalue{\KOMAClassFileName}{chapteratlists}%
                                               {\@chapterlistsgap}%
    \def\reserved@a{\z@}%
    \ifx\@chapterlistsgap\reserved@a
      \KOMA@kav@add{\KOMAClassFileName}{listof}{chaptergap}%
    \else
      \def\reserved@a{10\p@}%
      \ifx\@chapterlistsgap\reserved@a
        \KOMA@kav@add{\KOMAClassFileName}{listof}{chaptergapsmall}%
      \else
        \def\reserved@a{\baselineskip}%
        \ifx\@chapterlistsgap\reserved@a
          \KOMA@kav@add{\KOMAClassFileName}{listof}{chaptergapline}%
        \fi
      \fi
    \fi
  }%
}
\BeforeTOCHead{\@chaptertolistsfalse}
\KOMA@kav@add{\KOMAClassFileName}{chapteratlists}{10\p@}%
\KOMA@kav@add{\KOMAClassFileName}{listof}{chaptergapsmall}%
%</option&(book|report)>
%    \end{macrocode}
% \end{macro}^^A \@chapterlistgap
% \end{macro}^^A \if@chaptertolists
% \end{option}^^A chapteratlists
%
%
% \begin{macro}{\float@listhead}
% \changes{v2.8b}{2001/06/26}{added}
% \changes{v2.8g}{2001/07/18}{\cs{float@headings} renamed to
%   \cs{float@listhead}}
% \changes{v2.98c}{2008/03/05}{using \cs{float@@listhead}}
% \changes{v3.00}{2008/07/04}{deprecated}
% \changes{v3.10}{2011/08/31}{using\cs{MakeMarkcase}}
% In 2001 I've designed an interface to allow other package authors to set the
% headings of lists of floats the same way \KOMAScript{} classes do. Anselm
% Lingnau accepted this interface (but did not like may macro names, so these
% were changed in \KOMAScript{} 2.8g). But for \KOMAScript{} 3 I've needed a
% more powerful interface. So this became deprecated. Unfortunately Anselm is
% not willing to use the new \pkg*{tocbasic} for \pkg{float}. See
% \pkg*{scrhack} for a solution and how \pkg{float} could benefit from using
% \pkg*{tocbasic}.
%    \begin{macrocode}
%<*body>
\newcommand*{\float@listhead}[1]{%
  \scr@float@listhead@warning
  \float@@listhead{#1}%
  \@mkboth{\MakeMarkcase{#1}}{\MakeMarkcase{#1}}%
%    \end{macrocode}
% \changes{v2.8q}{2001/11/14}{support for dynamic number width}
% This is the best occasion to also add the code for the dynamic number width.
%    \begin{macrocode}
  \if@dynlist%
    \newcommand*{\scr@starttoc}{}%
    \let\scr@starttoc=\@starttoc
    \renewcommand*{\@starttoc}[1]{%
      \before@starttoc{##1}\scr@starttoc{##1}\after@starttoc{##1}%
    }%
  \fi
}
%    \end{macrocode}
% \begin{macro}{\scr@float@listhead@warning,\scr@float@addtolists@warning}
% \changes{v3.01}{2008/11/13}{added}
% \changes{v3.12}{2013/09/25}{text changed}
% \changes{v3.12a}{2014/03/05}{text corrected}
% \changes{v3.30}{2020/02/25}{spurious space at end of warning message
%   removed}
% \changes{v3.43}{2024/10/24}{warning changed}
% \changes{v3.45}{2025/06/04}{\cs{@ifpackageloaded} replaced by
%   \cs{IfPackageLoadedTF}}
% Here the warning messages, that are used for using the deprecated interface.
%    \begin{macrocode}
\newcommand*{\scr@float@listhead@warning}{%
  \ClassWarning{\KOMAClassName}{%
    Usage of \string\float@listhead\space detected!\MessageBreak
    This could be, because you are using\MessageBreak
    \IfPackageLoadedTF{floatrow}{%
      \IfPackageLoadedTF{floatrowbytocbasic}{%
        a package that does not support the KOMA-Script\MessageBreak
        interface of KOMA-Script package `tocbasic`.\MessageBreak
      }{%
        package `floatrow` without `floatrowbytocbasic`.\MessageBreak
      }%
    }{%
      \IfPackageLoadedTF{float}{%
        \IfPackageLoadedTF{floatbytocbasic}{%
          a package that does not support the KOMA-Script\MessageBreak
          interface of KOMA-Script package `tocbasic`.\MessageBreak
        }{%
          package `float` without `floatbytocbasic`.\MessageBreak
        }%
      }{%
        a package that does not support the KOMA-Script\MessageBreak
        interface of KOMA-Script package `tocbasic`.\MessageBreak
      }%
    }%
    Implementation of \string\float@listhead\space became\MessageBreak
    deprecated in KOMA-Script v3.01 2008/11/14 and\MessageBreak
    has been replaced by several more flexible\MessageBreak
    features of package `tocbasic`.\MessageBreak
    Implementation of \string\float@listhead\space will\MessageBreak
    be removed from KOMA-Script soon%
  }%
}
\newcommand*{\scr@float@addtolists@warning}{%
  \ClassWarningNoLine{\KOMAClassName}{%
    \string\float@addtolists\space detected!\MessageBreak
    Implementation of \string\float@addtolist\space became\MessageBreak
    deprecated in KOMA-Script v3.01 2008/11/14 and\MessageBreak
    has been replaced by several more flexible\MessageBreak
    features of package `tocbasic`.\MessageBreak
    Since Version 3.12 support for deprecated\MessageBreak
    \string\float@addtolist\space interface has been\MessageBreak
    restricted to only some of the KOMA-Script\MessageBreak
    features and been removed from others.\MessageBreak
    Since Version 3.43 support for deprecated\MessageBreak
    \string\float@addtolist\space interface has been\MessageBreak
    removed from all KOMA-Script classes%
  }%
  \global\let\scr@float@addtolists@warning\relax
}
%</body>
%    \end{macrocode}
% \end{macro}^^A \scr@float@listhead@warning,scr@float@addtolists@warning
% \end{macro}^^A \float@listhead
%
% \begin{command}{\listfigurename,\listtablename}
% \begin{command}{\listoflofname,\listoflotname,
%                 \listoflofentryname,\listoflotentryname}
% \changes{v3.00}{2008/07/03}{neu für Paket \pkg*{tocbasic}}
% \changes{v3.25}{2017/10/10}{\cs{renewcommand} statt \cs{newcommand}}%^^A
% The names used by \pkg*{tocbasic}.
%    \begin{macrocode}
%<*body>
\renewcommand*\listfigurename{List of Figures}
\providecaptionname{american,australian,british,canadian,english,newzealand,%
  UKenglish,ukenglish,USenglish,usenglish}\listfigurename{List of Figures}
\renewcommand*\listoflofname{\listfigurename}
\renewcommand*\listoflofentryname{\figurename}
\renewcommand*\listtablename{List of Tables}
\providecaptionname{american,australian,british,canadian,english,newzealand,%
  UKenglish,ukenglish,USenglish,usenglish}\listtablename{List of Tables}
\renewcommand*\listoflotname{\listtablename}
\renewcommand*\listoflotentryname{\tablename}
%</body>
%    \end{macrocode}
% \end{command}^^A \listoflofname … \listoflotentryname
% \end{command}^^A \listfigurename,\listtablename
%
% \begin{command}{\listoffigures}
% \changes{v2.3h}{1995/01/21}{using \cs{lof@heading}}
% \changes{v2.4k}{1996/12/13}{\cs{lof@heading} for all classes}
% \changes{v2.8l}{2001/08/16}{group added an \len{parskip} set to 0}
% \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
% \changes{v2.95}{2004/11/05}{\cs{@parskipfalse} and \cs{@parskip@indent}
%   replaced}
% \changes{v3.00}{2008/07/04}{using \pkg*{tocbasic}}
% \changes{v3.23}{2017/03/24}{using \cs{ext@figure} instead of \file{lof}}
% \changes{v3.25}{2017/10/10}{implicit definition by \cs{DeclareNewTOC}}
% The list of figures.
% \end{command}^^A \listoffigures
%
% \begin{macro}{\l@figure}
% \changes{v3.25}{2017/10/10}{implicit definition by \cs{DeclareNewTOC}}
% Entry command for the list of figures.
% \end{macro}^^A \l@figure
%
% \begin{command}{\listoftables}
% \changes{v2.3h}{1995/01/21}{using \cs{lot@heading}}
% \changes{v2.4k}{1996/12/13}{\cs{lot@heading} for all classes}
% \changes{v2.8l}{2001/08/16}{group added an \len{parskip} set to 0}
% \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
% \changes{v2.95}{2004/11/05}{\cs{@parskipfalse} and \cs{@parskip@indent}
%   replaced}
% \changes{v3.00}{2008/07/04}{using \pkg*{tocbasic}}
% \changes{v3.23}{2017/03/24}{using \cs{ext@table} instead of \file{lot}}
% \changes{v3.25}{2017/10/10}{implicit definition by \cs{DeclareNewTOC}}
% The list of figures.
% \end{command}^^A \listoftables
%
% \begin{macro}{\l@table}
% \changes{v3.25}{2017/10/10}{implicit definition by \cs{DeclareNewTOC}}
% Entry command for the list of tables.
% \end{macro}^^A \l@table
%
%    \begin{macrocode}
%</!letter>
%    \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:
