From 0f04be16f7c95e84cd17884ce759b58426c407eb Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 17 Apr 2023 19:57:41 +0000
Subject: koma-script (17apr23)

git-svn-id: svn://tug.org/texlive/trunk@66870 c570f23f-e606-0410-a88d-b1316a301751
---
 .../latex/koma-script/scrkernel-tocstyle.dtx       | 123 ++++++++++++---------
 1 file changed, 72 insertions(+), 51 deletions(-)

(limited to 'Master/texmf-dist/source/latex/koma-script/scrkernel-tocstyle.dtx')

diff --git a/Master/texmf-dist/source/latex/koma-script/scrkernel-tocstyle.dtx b/Master/texmf-dist/source/latex/koma-script/scrkernel-tocstyle.dtx
index 6a78b383642..d4944b1556a 100644
--- a/Master/texmf-dist/source/latex/koma-script/scrkernel-tocstyle.dtx
+++ b/Master/texmf-dist/source/latex/koma-script/scrkernel-tocstyle.dtx
@@ -18,7 +18,7 @@
 %
 % This work consists of all files listed in MANIFEST.md.
 % ======================================================================
-%%% From File: $Id: scrkernel-tocstyle.dtx 3874 2022-06-05 10:38:02Z kohm $
+%%% From File: $Id: scrkernel-tocstyle.dtx 3972 2022-10-24 08:08:05Z kohm $
 % The runs of run-time file generation:
 %<preidentify>%%%            (run: preidentify)
 % - everything that is needed before selfidentification of resulting files
@@ -42,9 +42,9 @@
 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
 \begingroup
   \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
-  \filedate$Date: 2022-06-05 12:38:02 +0200 (So, 05. Jun 2022) $
+  \filedate$Date: 2022-10-24 10:08:05 +0200 (Mo, 24. Okt 2022) $
   \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
-  \filerevision$Revision: 3874 $
+  \filerevision$Revision: 3972 $
   \edef\reserved@a{%
     \noexpand\endgroup
     \noexpand\ProvidesFile{scrkernel-tocstyle.dtx}%
@@ -1094,6 +1094,7 @@
 %
 % \begin{command}{\DeclareTOCStyleEntry}
 % \changes{v3.20}{2015/11/13}{added}
+% \changes{v3.39}{2022/10/24}{error message about missing options improved}
 % This user command defines a new ToC entry command. It tests, if all needed
 % style macros are already defined. Otherwise an error will be shown and the
 % ToC entry command will not be defined. The arguments are:
@@ -1141,7 +1142,8 @@
       \aftergroup\@tempswatrue
       \def\do##1##2##3##4{%
         \scr@ifundefinedorrelax{##1#3##2}{%
-          \PackageError{tocbasic}{toc style `#2' needs ##4}{%
+          \PackageError{tocbasic}{toc style `#2' needs ##4\MessageBreak
+            of `#3'}{%
             Usually the ##4 is defined using option `##3'.\MessageBreak
             In some cases it may be set defining command
             `\expandafter\string\csname ##1#3##2\endcsname'.\MessageBreak
@@ -1536,6 +1538,7 @@
 %    \end{macrocode}
 % or, if this cannot be used, by using a standard value analogues to the
 % values of the standard classes and the \KOMAScript{} classes.
+% \changes{v3.39}{2022/10/24}{default level for \texttt{lstlisting} added}
 %    \begin{macrocode}
   \@ifundefined{#1tocdepth}{%
     \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
@@ -1547,12 +1550,14 @@
                 \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                   \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                     \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
+                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
 %    \end{macrocode}
 % As last chance, we can use the same number already used for a headings level
 % with the same name.
 %    \begin{macrocode}
-                      \expandafter\let\csname #1tocdepth\expandafter\endcsname
-                      \csname #1numdepth\endcsname
+                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
+                        \csname #1numdepth\endcsname
+                      }%
                     }%
                   }%
                 }%
@@ -1564,6 +1569,16 @@
     }%
   }{}%
 %    \end{macrocode}
+% \changes{v3.39}{2022/10/24}{try also using \cs{toclevel@\meta{level name}} as
+%   default level}
+% Last but not least, if \cs{tocdepth@\meta{level name}} has been defined, we
+% can use this one.
+%    \begin{macrocode}
+  \@ifundefined{#1tocdepth}{%
+    \expandafter\let\csname #1tocdepth\expandafter\endcsname
+    \csname toclevel@#1\endcsname
+  }{}%
+%    \end{macrocode}
 % The indent can also be defined automatically by a parent level.
 %    \begin{macrocode}
 %<*tocline|toctext>
@@ -1639,6 +1654,7 @@
 % If all the automatic setting methods were not successful, we try standard
 % values used from the standard classes or older versions of the \KOMAScript{}
 % classes.
+% \changes{v3.39}{2022/10/24}{default indent for \texttt{lstlisting} added}
 %    \begin{macrocode}
   \@ifundefined{scr@tso@#1@indent}{%
 %<*dottedtocline|undottedtocline|largetocline>
@@ -1646,48 +1662,50 @@
 %</dottedtocline|undottedtocline|largetocline>
       \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
         \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
-          \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
-            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
+          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
+            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
+              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
 %    \end{macrocode}
 % The follow code needs information about the existence of the chapter
 % level. So the chapter level should already be defined, before the first
 % usage!
 %    \begin{macrocode}
-              \scr@ifundefinedorrelax{l@chapter}{%
-                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
-                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
-                    \Ifstr{#1}{subsubsection}{%
-                      \@namedef{scr@tso@#1@indent}{3.8em}%
-                    }{%
-                      \Ifstr{#1}{paragraph}{%
-                        \@namedef{scr@tso@#1@indent}{7em}%
+                \scr@ifundefinedorrelax{l@chapter}{%
+                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
+                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
+                      \Ifstr{#1}{subsubsection}{%
+                        \@namedef{scr@tso@#1@indent}{3.8em}%
                       }{%
-                        \Ifstr{#1}{subparagraph}{%
-                          \@namedef{scr@tso@#1@indent}{10em}%
+                        \Ifstr{#1}{paragraph}{%
+                          \@namedef{scr@tso@#1@indent}{7em}%
                         }{%
+                          \Ifstr{#1}{subparagraph}{%
+                            \@namedef{scr@tso@#1@indent}{10em}%
+                          }{%
 %    \end{macrocode}
 % If nothing helps, the user has to define the values.
 %    \begin{macrocode}
+                          }%
                         }%
                       }%
                     }%
                   }%
-                }%
-              }{%
-                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
-                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
-                    \Ifstr{#1}{subsubsection}{%
-                      \@namedef{scr@tso@#1@indent}{7.0em}%
-                    }{%
-                      \Ifstr{#1}{paragraph}{%
-                        \@namedef{scr@tso@#1@indent}{10em}%
+                }{%
+                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
+                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
+                      \Ifstr{#1}{subsubsection}{%
+                        \@namedef{scr@tso@#1@indent}{7.0em}%
                       }{%
-                        \Ifstr{#1}{subparagraph}{%
-                          \@namedef{scr@tso@#1@indent}{12em}%
+                        \Ifstr{#1}{paragraph}{%
+                          \@namedef{scr@tso@#1@indent}{10em}%
                         }{%
+                          \Ifstr{#1}{subparagraph}{%
+                            \@namedef{scr@tso@#1@indent}{12em}%
+                          }{%
 %    \end{macrocode}
 % Once more: if nothing helps, the user has to define the values.
 %    \begin{macrocode}
+                          }%
                         }%
                       }%
                     }%
@@ -1709,6 +1727,7 @@
   }{}%
 %    \end{macrocode}
 % Almost the same for the number width:
+% \changes{v3.39}{2022/10/24}{default number width for \texttt{lstlisting} added}
 %    \begin{macrocode}
 %<*dottedtocline|undottedtocline|tocline>
 %<*tocline>
@@ -1734,45 +1753,47 @@
 %</dottedtocline|undottedtocline>
       \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
         \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
-          \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
+          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
+            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
 %    \end{macrocode}
 % Depending on existence of the chapter level:
 %    \begin{macrocode}
-            \scr@ifundefinedorrelax{chapter}{%
-              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
-                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
-                  \Ifstr{#1}{subsubsection}{%
-                    \@namedef{scr@tso@#1@numwidth}{3.2em}%
-                  }{%
-                    \Ifstr{#1}{paragraph}{%
-                      \@namedef{scr@tso@#1@numwidth}{4.1em}%
+              \scr@ifundefinedorrelax{chapter}{%
+                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
+                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
+                    \Ifstr{#1}{subsubsection}{%
+                      \@namedef{scr@tso@#1@numwidth}{3.2em}%
                     }{%
-                      \Ifstr{#1}{subparagraph}{%
-                        \@namedef{scr@tso@#1@numwidth}{5m}%
+                      \Ifstr{#1}{paragraph}{%
+                        \@namedef{scr@tso@#1@numwidth}{4.1em}%
                       }{%
+                        \Ifstr{#1}{subparagraph}{%
+                          \@namedef{scr@tso@#1@numwidth}{5m}%
+                        }{%
 %    \end{macrocode}
 % Need option to be set.
 %    \begin{macrocode}
+                        }%
                       }%
                     }%
                   }%
                 }%
-              }%
-            }{%
-              \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
-                \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
-                  \Ifstr{#1}{subsubsection}{%
-                    \@namedef{scr@tso@#1@numwidth}{3.1em}%
-                  }{%
-                    \Ifstr{#1}{paragraph}{%
-                      \@namedef{scr@tso@#1@numwidth}{5em}%
+              }{%
+                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
+                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
+                    \Ifstr{#1}{subsubsection}{%
+                      \@namedef{scr@tso@#1@numwidth}{3.1em}%
                     }{%
-                      \Ifstr{#1}{subparagraph}{%
-                        \@namedef{scr@tso@#1@numwidth}{6em}%
+                      \Ifstr{#1}{paragraph}{%
+                        \@namedef{scr@tso@#1@numwidth}{5em}%
                       }{%
+                        \Ifstr{#1}{subparagraph}{%
+                          \@namedef{scr@tso@#1@numwidth}{6em}%
+                        }{%
 %    \end{macrocode}
 % Need option to be set.
 %    \begin{macrocode}
+                        }%
                       }%
                     }%
                   }%
-- 
cgit v1.2.3

