summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/tocbasic.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/source/tocbasic.dtx')
-rw-r--r--macros/latex/contrib/koma-script/source/tocbasic.dtx54
1 files changed, 43 insertions, 11 deletions
diff --git a/macros/latex/contrib/koma-script/source/tocbasic.dtx b/macros/latex/contrib/koma-script/source/tocbasic.dtx
index 44a222f81d..90a27fd670 100644
--- a/macros/latex/contrib/koma-script/source/tocbasic.dtx
+++ b/macros/latex/contrib/koma-script/source/tocbasic.dtx
@@ -54,7 +54,7 @@
% Right brace \} Tilde \~}
%
% \iffalse
-%%% From File: $Id: tocbasic.dtx 3518 2020-08-25 08:26:01Z kohm $
+%%% From File: $Id: tocbasic.dtx 3617 2021-10-12 09:21:01Z kohm $
%<identify>%%% (run: identify)
%<prepare>%%% (run: prepare)
%<option>%%% (run: option)
@@ -65,7 +65,7 @@
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
- \filedate$Date: 2020-08-25 10:26:01 +0200 (Tue, 25 Aug 2020) $
+ \filedate$Date: 2021-10-12 11:21:01 +0200 (Tue, 12 Oct 2021) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 1962 $
\endgroup
@@ -1917,9 +1917,12 @@
% \end{macrocode}
% The counter and hooks of float and nonfloat environments:
% \changes{v3.10b}{2012/04/04}{\cs{noexpand} added to fix problems using
-% \cs{autodot}}%^^A
+% \cs{autodot}}
% \changes{v3.13}{2014/07/31}{add \cs{autodot} only to hierachical
-% counters}%^^A
+% counters}
+% \changes{v3.35}{2021/10/12}{ignore \texttt{counterwithin} if it is
+% ``\texttt{chapter}'' resp. ``\texttt{section}'' and \cs{ifmainmatter} is
+% not \cs{iffalse} and the counterwithin counter is < 1}
% \begin{macrocode}
\if@tempswa
\@ifundefined{c@\tb@nt@type}{%
@@ -1929,14 +1932,43 @@
}%
\ifx\tb@nt@counterwithin\@empty\else
\@addtoreset{\tb@nt@type}{\tb@nt@counterwithin}%
- \begingroup\edef\@tempa{%
- \noexpand\endgroup
- \noexpand\renewcommand*\expandafter\noexpand
- \csname the\tb@nt@type\endcsname{%
- \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
- .\noexpand\arabic{\tb@nt@type}%
+ \begingroup
+ \def\reserved@c{section}%
+ \@ifundefined{chapter}{}{%
+ \@ifundefined{c@chapter}{}{%
+ \@ifundefined{l@chapter}{}{%
+ \def\reserved@c{chapter}}}}%
+ \expandafter\Ifstr\expandafter{\reserved@c}{\tb@nt@counterwithin}{%
+ \edef\@tempa{%
+ \noexpand\endgroup
+ \noexpand\renewcommand*\expandafter\noexpand
+ \csname the\tb@nt@type\endcsname{%
+ \unexpanded{%
+ \expandafter\ifx\csname ifmainmatter\expandafter\endcsname
+ \csname iffalse\endcsname\else
+ }%
+ \noexpand\ifnum
+ \expandafter\noexpand\csname c@\tb@nt@counterwithin\endcsname
+ >\noexpand\z@
+ \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
+ .%
+ \noexpand\fi
+ \noexpand\fi
+ \noexpand\arabic{\tb@nt@type}%
+ }%
+ }%
+ }{%
+ \edef\@tempa{%
+ \noexpand\endgroup
+ \noexpand\renewcommand*\expandafter\noexpand
+ \csname the\tb@nt@type\endcsname{%
+ \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
+ .%
+ \noexpand\arabic{\tb@nt@type}%
+ }%
+ }%
}%
- }\@tempa
+ \@tempa
\fi
\begingroup
\edef\@tempa{%