diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/tocbasic.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/tocbasic.dtx | 278 |
1 files changed, 163 insertions, 115 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/tocbasic.dtx b/Master/texmf-dist/source/latex/koma-script/tocbasic.dtx index eb3513966e6..aa133bb8343 100644 --- a/Master/texmf-dist/source/latex/koma-script/tocbasic.dtx +++ b/Master/texmf-dist/source/latex/koma-script/tocbasic.dtx @@ -1,8 +1,8 @@ -% \CheckSum{1612} +% \CheckSum{1592} % \iffalse meta-comment % ====================================================================== % tocbasic.dtx -% Copyright (c) Markus Kohm, 2008-2017 +% Copyright (c) Markus Kohm, 2008-2018 % % This file is part of the LaTeX2e KOMA-Script bundle. % @@ -20,7 +20,7 @@ % This work consists of all files listed in manifest.txt. % ---------------------------------------------------------------------- % tocbasic.dtx -% Copyright (c) Markus Kohm, 2008-2017 +% Copyright (c) Markus Kohm, 2008-2018 % % Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, % Version 1.3c, verteilt und/oder veraendert werden. @@ -55,7 +55,7 @@ % Right brace \} Tilde \~} % % \iffalse -%%% From File: $Id: tocbasic.dtx 2709 2017-11-21 08:03:52Z kohm $ +%%% From File: $Id: tocbasic.dtx 3050 2018-12-30 14:36:55Z kohm $ %<identify>%%% (run: identify) %<prepare>%%% (run: prepare) %<option>%%% (run: option) @@ -66,7 +66,7 @@ \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi \begingroup \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} - \filedate$Date: 2017-11-21 09:03:52 +0100 (Tue, 21 Nov 2017) $ + \filedate$Date: 2018-12-30 15:36:55 +0100 (Sun, 30 Dec 2018) $ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} \filerevision$Revision: 1962 $ \endgroup @@ -213,6 +213,51 @@ % processing options. % % +% +% \subsection{Unwanted Packages} +% \label{sec:unpackages} +% +% There are packages, that are not recommended to be used together with +% \textsf{tocbasic}: +% \begin{macrocode} +%<*body> +% \end{macrocode} +% \begin{description} +% \item[\textsf{multitoc}:] This package implements multi-column ToCs using +% \textsf{multicol}. Unfortunately there is a bug in that package, that +% disables all extensions but \texttt{toc}, \texttt{lof} and \texttt{lot} and +% even these if the corresponding option has not been set. +% \begin{macrocode} +\AfterPackage*{multitoc}{% + \@ifpackagelater{multitoc}{2018/08/31}{}{% + \PackageWarningNoLine{tocbasic}{% + Usage of package `multitoc' is not recommended!\MessageBreak + Note, this package generally results in empty ToCs\MessageBreak + for all extension but `toc', `lof' and `lot' and\MessageBreak + even for these extensions if you do not use the\MessageBreak + corresponding multitoc options.\MessageBreak + It is recommended to use:\MessageBreak + \space\space\string\usepackage{multicol}\MessageBreak + \space\space\string\BeforeStartingTOC{\string\begin{multicols}{2}}% + \MessageBreak + \space\space\string\AfterStartingTOC{\string\end{multicols}}% + \MessageBreak + instead of loading package `multitoc'.\MessageBreak + See the KOMA-Script manual for more information\MessageBreak + about using \string\BeforeStartingTOC\space and + \string\AfterStartingTOC\MessageBreak + and the multicol manual for more information\MessageBreak + about the `multicols' environment% + }% + }% +} +% \end{macrocode} +% \end{description} +% \begin{macrocode} +%</body> +% \end{macrocode} +% +% % \subsection{Having a List of All Tocs} % \label{sec:listoftocs} % @@ -730,24 +775,26 @@ % \end{macro} % \end{macro} % \begin{macro}{\BeforeStartingTOC} -% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined} -% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of -% undefined \cs{scr@ifundefinedorrelax}} +% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}^^A +% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of +% undefined \cs{scr@ifundefinedorrelax}}^^A +% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}^^A % \begin{macro}{\AfterStartingTOC} -% \changes{v3.04b}{2010/01/05}{fix:define the hook if not already defined} -% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of -% undefined \cs{scr@ifundefinedorrelax}} -% These are the commands to add code to the general or individual hooks. If -% the first, optional argument was given, the second, mandatory argument -% will be added to the individual hook, otherwise the general hook will be -% extended. +% \changes{v3.04b}{2010/01/05}{fix:define the hook if not already defined}^^A +% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of +% undefined \cs{scr@ifundefinedorrelax}}^^A +% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}^^A +% These are the commands to add code to the general or individual hooks. If +% the first, optional argument was given, the second, mandatory argument +% will be added to the individual hook, otherwise the general hook will be +% extended. % \begin{macrocode} \newcommand{\BeforeStartingTOC}[2][]{% \ifx\relax#1\relax \g@addto@macro\tocbasic@@before@hook{#2}% \else \@ifundefined{tb@#1@before@hook}{% - \PackageInfo{tocbasic}{defining new hook before starting `#1'}% +%<trace> \PackageInfo{tocbasic}{defining new hook before starting `#1'}% \expandafter\global\expandafter\let\csname tb@#1@before@hook\endcsname \@empty }{}% @@ -759,7 +806,7 @@ \g@addto@macro\tocbasic@@after@hook{#2}% \else \@ifundefined{tb@#1@after@hook}{% - \PackageInfo{tocbasic}{defining new hook after starting `#1'}% +%<trace> \PackageInfo{tocbasic}{defining new hook after starting `#1'}% \expandafter\global\expandafter\let\csname tb@#1@after@hook\endcsname \@empty }{}% @@ -902,19 +949,22 @@ % \end{macro} % % \begin{macro}{\tocbasic@listhead} -% \changes{v3.02a}{2009/01/20}{no explicite marks if ``numbered''}% -% \changes{v3.09a}{2011/04/12}{again no explicite marks if ``numbered''}% -% \changes{v3.12}{2013/09/24}{usage of new -% \cs{tocbasic@addxcontentsline}}% -% \changes{v3.15}{2014/12/10}{moved \cs{@mkboth} inside \cs{chapter*}}^^A -% \changes{v3.15}{2014/12/10}{usage of \cs{addsec} if available}^^A -% \changes{v3.15}{2014/12/10}{usage of \cs{@mkright} if available}^^A -% \changes{v3.17}{2015/03/08}{moved \cs{@mkboth} outside \cs{chapter*}}^^A -% \changes{v3.17}{2015/03/08}{usage of \cs{@mkdouble} if available}^^A -% \changes{v3.17}{2015/03/25}{penalty and skip reconstruction after -% \cs{@mkright}, \cs{@mkboth}, or \cs{@mkdouble}}^^A -% Setting the headings of a list of something. The heading is the only -% argument. +% \changes{v3.02a}{2009/01/20}{no explicite marks if ``numbered''}% +% \changes{v3.09a}{2011/04/12}{again no explicite marks if ``numbered''}% +% \changes{v3.12}{2013/09/24}{usage of new +% \cs{tocbasic@addxcontentsline}}% +% \changes{v3.15}{2014/12/10}{moved \cs{@mkboth} inside \cs{chapter*}}^^A +% \changes{v3.15}{2014/12/10}{usage of \cs{addsec} if available}^^A +% \changes{v3.15}{2014/12/10}{usage of \cs{@mkright} if available}^^A +% \changes{v3.17}{2015/03/08}{moved \cs{@mkboth} outside \cs{chapter*}}^^A +% \changes{v3.17}{2015/03/08}{usage of \cs{@mkdouble} if available}^^A +% \changes{v3.17}{2015/03/25}{penalty and skip reconstruction after +% \cs{@mkright}, \cs{@mkboth}, or \cs{@mkdouble}}^^A +% \changes{v3.26}{2018/06/22}{removed spurious group}^^A +% \changes{v3.26}{2018/09/03}{usage of \cs{addsecmark} or \cs{sectionmark} +% instead of \cs{@mkright} or \cs{markright}}^^A +% Setting the headings of a list of something. The heading is the only +% argument. % \begin{macrocode} \newcommand*{\tocbasic@listhead}[1]{% \@ifundefined{tocbasic@listhead@\@currext}{% @@ -931,11 +981,8 @@ \expandafter\addxcontentsline\expandafter{\ext@toc}% {subsection}{##1}% }{}% - \@ifundefined{@mkright}{% - \ifx\@mkboth\@gobbletwo\else\markright{\MakeMarkcase{##1}}\fi - }{% - \@mkright{\MakeMarkcase{##1}}% - }% + \c@secnumdepth=-\maxdimen + \subsectionmark{##1}% \endgroup \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi }% @@ -967,34 +1014,31 @@ \section{##1}% }{% \iftocfeature{\@currext}{totoc}{% - \begingroup - \@ifundefined{addsec}{% - \section*{##1}% - \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi - \begingroup - \@ifundefined{@mkright}{% - \ifx\@mkboth\@gobbletwo - \else\markright{\MakeMarkcase{##1}}\fi - }{% - \@mkright{\MakeMarkcase{##1}}% - }% - \expandafter\addxcontentsline\expandafter{\ext@toc}% - {section}{##1}% - \endgroup - \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi - }{% - \addsec{##1}% - }% - \endgroup + \@ifundefined{addsec}{% + \section*{##1}% + \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi + \begingroup + \@ifundefined{@mkright}{% + \IfActiveMkBoth{\markright{\MakeMarkcase{##1}}}{}% + }{% + \@mkright{\MakeMarkcase{##1}}% + }% + \expandafter\addxcontentsline\expandafter{\ext@toc}% + {section}{##1}% + \endgroup + \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi + }{% + \addsec{##1}% + }% }{% \section*{##1}% \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi \begingroup - \@ifundefined{@mkright}{% - \ifx\@mkboth\@gobbletwo - \else\markright{\MakeMarkcase{##1}}\fi + \@ifundefined{addsecmark}{% + \c@secnumdepth=-\maxdimen + \sectionmark{##1}% }{% - \@mkright{\MakeMarkcase{##1}}% + \addsecmark{##1}% }% \endgroup \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi @@ -1031,21 +1075,23 @@ } % \end{macrocode} % \begin{macro}{\BeforeTOCHead} -% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined} -% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of -% undefined \cs{scr@ifundefinedorrelax}} +% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}^^A +% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of +% undefined \cs{scr@ifundefinedorrelax}}^^A +% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}^^A % \begin{macro}{\AfterTOCHead} -% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined} -% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of -% undefined \cs{scr@ifundefinedorrelax}} -% These are the commands to add code to the general or individual hooks. If -% the first, optional argument was given, the second, mandatory argument -% will be added to the individual hook, otherwise the general hook will be -% extended. +% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}^^A +% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of +% undefined \cs{scr@ifundefinedorrelax}}^^A +% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}^^A +% These are the commands to add code to the general or individual hooks. If +% the first, optional argument was given, the second, mandatory argument +% will be added to the individual hook, otherwise the general hook will be +% extended. % \begin{macrocode} \newcommand{\BeforeTOCHead}[2][]{% \@ifundefined{tb@#1@beforehead@hook}{% - \PackageInfo{tocbasic}{defining new hook before heading of `#1'}% +%<trace> \PackageInfo{tocbasic}{defining new hook before heading of `#1'}% \expandafter\global\expandafter\let\csname tb@#1@beforehead@hook\endcsname \@empty }{}% @@ -1053,7 +1099,7 @@ } \newcommand{\AfterTOCHead}[2][]{% \@ifundefined{tb@#1@afterhead@hook}{% - \PackageInfo{tocbasic}{defining new hook after heading of `#1'}% +%<trace> \PackageInfo{tocbasic}{defining new hook after heading of `#1'}% \expandafter\global\expandafter\let\csname tb@#1@afterhead@hook\endcsname \@empty }{}% @@ -1092,7 +1138,11 @@ % \end{macro} % % \begin{macro}{\setuptoc} +% \changes{v3.26}{2018/08/29}{Verwendung von \cs{scr@trim@spaces} statt +% \cs{tb@@sp@def}}^^A % \begin{macro}{\unsettoc} +% \changes{v3.26}{2018/08/29}{Verwendung von \cs{scr@trim@spaces} statt +% \cs{tb@@sp@def}}^^A % Known features are: % \begin{description} % \item[\texttt{totoc}] writes the title of the list of to the table of @@ -1119,29 +1169,16 @@ % \begin{macrocode} \newcommand*{\setuptoc}[2]{% \@for\@tempa:=#2\do{% - \expandafter\tb@@sp@def\expandafter\@tempa\expandafter{\@tempa}% + \scr@trim@spaces\@tempa \@namedef{tocbasic@#1@feature@\@tempa}{}% }% } \newcommand*{\unsettoc}[2]{% \@for\@tempa:=#2\do{% - \expandafter\tb@@sp@def\expandafter\@tempa\expandafter{\@tempa}% + \scr@trim@spaces\@tempa \expandafter\let\csname tocbasic@#1@feature@\@tempa\endcsname\relax }% } -\def\@tempa#1{% - \def\tb@@sp@def##1##2{% - \futurelet\tb@sp@tempa\tb@@sp@d##2\@nil\@nil#1\@nil\relax##1}% - \def\tb@@sp@d{% - \ifx\tb@sp@tempa\@sptoken - \expandafter\tb@@sp@b - \else - \expandafter\tb@@sp@b\expandafter#1% - \fi}% - \def\tb@@sp@b#1##1 \@nil{\tb@@sp@c##1}% -} -\@tempa{ } -\def\tb@@sp@c#1\@nil#2\relax#3{\@temptokena{#1}\edef#3{\the\@temptokena}} % \end{macrocode} % Do not add the files, that babel handles by default. % \begin{macrocode} @@ -1203,6 +1240,7 @@ % initialised \cs{relax}}^^A % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by % \cs{kernel@ifnextchar}}^^A +% \changes{v3.26a}{2018/12/30}{fixed usage of \cs{kernel@ifnextchar}}^^A % This command defines only a new TOC and a new caption command for this % TOC. It does not define a new foat unless option float was set! It does % not define a new nonfloat unless option nonfloat was set! The optional @@ -1310,6 +1348,16 @@ }% % \end{macrocode} % \end{macro} +% \begin{macro}{\tb@nt@owner} +% \changes{v3.20}{2015/12/16}{local valid only}^^A +% \changes{v3.26}{2018/06/09}{moved to pass 1}^^A +% The owner of the new list extension. +% \begin{macrocode} + \DefineFamilyKey[.toc]{KOMAarg}{owner}{% + \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}% + }% +% \end{macrocode} +% \end{macro} % After this we define pseudo option \texttt{@else@} to ignore all currently % not needed options. After this we do the first option execution run. % \begin{macrocode} @@ -1317,12 +1365,24 @@ \FamilyExecuteOptions[.toc]{KOMAarg}{#1}% \RelaxFamilyKey[.toc]{KOMAarg}{@else@}% % \end{macrocode} -% For the second run we do not need to set up these options again. So define -% it as no-opt. +% \changes{v3.26}{2018/06/09}{add extension already after first pass}^^A +% First of all, every TOC needs an extension, that should be added to the +% list of known extensions. This has to be done also, if no options has been +% given! +% \begin{macrocode} + }% + \expandafter\newcommand\csname ext@\tb@nt@type\endcsname{}% + \expandafter\let\csname ext@\tb@nt@type\endcsname\tb@nt@ext + \addtotoclist[\tb@nt@owner]{\csname ext@\tb@nt@type\endcsname}% + \IfArgIsEmpty{#1}{}{% +% \end{macrocode} +% For the second option pass we do not need to set up these options +% again. So define it as no-opt. % \begin{macrocode} \DefineFamilyKey[.toc]{KOMAarg}{type}{\FamilyKeyStateProcessed}% \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}{\FamilyKeyStateProcessed}% \DefineFamilyKey[.toc]{KOMAarg}{extension}{\FamilyKeyStateProcessed}% + \DefineFamilyKey[.toc]{KOMAarg}{owner}{\FamilyKeyStateProcessed}% % \end{macrocode} % \changes{v3.20}{2015/12/16}{defining toc style depending options}^^A % \changes{v3.20}{2016/06/12}{using prefix \texttt{tocentry} instead of @@ -1560,15 +1620,6 @@ \FamilyBoolKey[.toc]{KOMAarg}{nonfloat}{tb@nt@nonfloat}% % \end{macrocode} % \end{macro} -% \begin{macro}{\tb@nt@owner} -% \changes{v3.20}{2015/12/16}{local valid only}^^A -% The owner of the new list extension. -% \begin{macrocode} - \DefineFamilyKey[.toc]{KOMAarg}{owner}{% - \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}% - }% -% \end{macrocode} -% \end{macro} % \begin{macro}{\tb@nt@types} % \changes{v3.20}{2015/12/16}{local valid only}^^A % Sometimes the plural of the type is needed and may be defined by a @@ -1579,19 +1630,19 @@ }% % \end{macrocode} % \end{macro} -% \changes{v3.25}{2017/11/20}{new (internal)} -% The new option \texttt{setup} allowes to setup ToC features provided by -% \cs{setuptoc}. Note, currently there is no test whether or not a feature -% does exist! +% \changes{v3.25}{2017/11/20}{new (internal)} +% The new option \texttt{setup} allowes to setup ToC features provided by +% \cs{setuptoc}. Note, currently there is no test whether or not a feature +% does exist! % \begin{macrocode} \DefineFamilyKey[.toc]{KOMAarg}{setup}{% \setuptoc\tb@nt@ext{##1}% }% % \end{macrocode} -% \changes{v3.25}{2017/11/20}{new (internal)} -% The new option \texttt{unset} allowes to unset ToC features provided -% by \cs{unsettoc}. Note, currently there is no test whether or not a feature -% does exist! +% \changes{v3.25}{2017/11/20}{new (internal)} +% The new option \texttt{unset} allowes to unset ToC features provided +% by \cs{unsettoc}. Note, currently there is no test whether or not a +% feature does exist! % \begin{macrocode} \DefineFamilyKey[.toc]{KOMAarg}{unset}{% \unsettoc\tb@nt@ext{##1}% @@ -1599,11 +1650,14 @@ % \end{macrocode} % Last but not least we have to execute the options and reset the option % definitions. -% \changes{v3.25}{2017/09/27}{\texttt{nonfloat} fixed}^^A +% \changes{v3.25}{2017/09/27}{\texttt{nonfloat} fixed}^^A +% \changes{v3.26}{2018/06/09}{added missing reset of \texttt{unset} and +% \texttt{setup}}^^A % \begin{macrocode} \FamilyExecuteOptions[.toc]{KOMAarg}{#1}% + \RelaxFamilyKey[.toc]{KOMAarg}{unset}% + \RelaxFamilyKey[.toc]{KOMAarg}{setup}% \RelaxFamilyKey[.toc]{KOMAarg}{types}% - \RelaxFamilyKey[.toc]{KOMAarg}{owner}% \RelaxFamilyKey[.toc]{KOMAarg}{nonfloat}% \RelaxFamilyKey[.toc]{KOMAarg}{name}% \RelaxFamilyKey[.toc]{KOMAarg}{listname}% @@ -1613,23 +1667,17 @@ \RelaxFamilyKey[.toc]{KOMAarg}{forcenames}% \RelaxFamilyKey[.toc]{KOMAarg}{floatpos}% \RelaxFamilyKey[.toc]{KOMAarg}{float}% - \RelaxFamilyKey[.toc]{KOMAarg}{extension}% \RelaxFamilyKey[.toc]{KOMAarg}{counterwithin}% \RelaxFamilyKey[.toc]{KOMAarg}{atend}% \RelaxFamilyKey[.toc]{KOMAarg}{atbegin}% \tb@nt@extra@relax@opts + \RelaxFamilyKey[.toc]{KOMAarg}{owner}% + \RelaxFamilyKey[.toc]{KOMAarg}{extension}% \RelaxFamilyKey[.toc]{KOMAarg}{tocentrystyle}% \RelaxFamilyKey[.toc]{KOMAarg}{type}% }% % \end{macrocode} -% First of all, every TOC needs an extension, that should be added to the -% list of known extensions. -% \begin{macrocode} - \expandafter\newcommand\csname ext@\tb@nt@type\endcsname{}% - \expandafter\let\csname ext@\tb@nt@type\endcsname\tb@nt@ext - \addtotoclist[\tb@nt@owner]{\csname ext@\tb@nt@type\endcsname}% -% \end{macrocode} -% And we save the type of the extension at \cs{tb@nt@type@\meta{extension}} +% We save the type of the extension at \cs{tb@nt@type@\meta{extension}} % for later usage. % \begin{macrocode} \expandafter\let\csname tb@nt@type@\tb@nt@ext\endcsname\tb@nt@type |