% \CheckSum{1932} % \iffalse meta-comment % ====================================================================== % tocstyle-obsolete.dtx % Copyright (c) Markus Kohm, 2007-2020 % % This file is part of the LaTeX2e KOMA-Script obsolete 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 and of this work. % % This work has the LPPL maintenance status "not maintained". It was % experimental and now is also deprecated! % % The author of this work is Markus Kohm. % % This work consists of the files `tocbasic.dtx' and `README'. % ---------------------------------------------------------------------- % tocstyle-obsolete.dtx % Copyright (c) Markus Kohm, 2007-2020 % % Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, % Version 1.3c, verteilt und/oder veraendert werden. % Die neuste Version dieser Lizenz ist % http://www.latex-project.org/lppl.txt % und Version 1.3c ist Teil aller Verteilungen von LaTeX % Version 2005/12/01 oder spaeter. % % Dieses Werk hat den LPPL-Verwaltungs-Status "not maintained" % (nicht verwaltet). Es war immer experimentell und ist außerdem % veraltet. % % Der Autor dieses Werkes ist Markus Kohm. % % Dieses Werk besteht aus den Dateien `tocbasic.dtx' und `README'. % ====================================================================== % \fi % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \iffalse %%% From File: $Id: tocstyle-obsolete.dtx 3500 2020-06-06 09:44:58Z kohm $ %<*dtx> % \fi \def\LaTeXformat{LaTeX2e} \let\ifbeta=\iffalse %^^A with = will be replaced by release process \ifx\fmtname\LaTeXformat\else % \iffalse % %<*insfile> % \fi \def\batchfile{tocstyle-obsolete.dtx} \input docstrip.tex \ifToplevel{% \Msg{**********************************************************************} \Msg{*} \Msg{* This is `\batchfile', a batchfile to unpack the package tocstyle.} \Msg{*} \Msg{**********************************************************************} \keepsilent \askforoverwritefalse } \preamble Copyright (c) 2007-2020 by Markus Kohm This file has been generated. ----------------------------- 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 "not maintained". This file may only be distributed together with the file `scrpage2-obsolete.dtx'. You may however distribute the file `scrpage2-obsolete.dtx' without this file. An bilingual (English and German) manual may be generated from the source file `scrpage2-obsolete.dtx' using: pdflatex scrpage2-obsolete.dtx THIS IS AN OBSOLETE, EXPERIMENTAL PACKAGE! YOU SHOULD NOT USE IT! \endpreamble \generate{\usepreamble\defaultpreamble \file{tocstyle.sty}{% \from{tocstyle-obsolete.dtx}{package,trace,tocstyle}% % \from{scrlogo.dtx}{logo}% }% } %\ifToplevel{% % \generate{\usepreamble\defaultpreamble % \file{tocstyle.ins}{% % \from{tocstyle-obsolete.dtx}{insfile}% % }% % \file{tocstyle-obsolete.tex}{% % \from{tocstyle.dtx}{doc}% % }% % \file{tocstyle.drv}{% % \from{tocstyle-obsolete.dtx}{driver}% % }% % }% %} % \iffalse % %<*dtx> % \fi \def\ProvidesFile{\csname fi\endcsname\csname endinput\endcsname} \fi \ProvidesFile{tocstyle-obsolete.dtx} % \iffalse % %\NeedsTeXFormat{LaTeX2e}[1995/06/01] %\ProvidesPackage{tocstyle} %\ProvidesFile{tocstyle.drv} %\ProvidesFile{tocstyle.tex} %\changes{v0.2k-alpha}{2020/06/06}{only comments have been changed}%^^A %<*dtx|package|driver|doc> [2020/06/06 v0.2k-alpha deprecated package (versatile toc styles)] % %<*driver> \documentclass{scrdoc} \usepackage[ngerman,english]{babel} \usepackage{listings} \lstnewenvironment{lstcode}[1][]{% \lstset{language=[LaTeX]TeX,basicstyle=\ttfamily\small,#1}% }{} \usepackage{tocstyle} \usetocstyle[toc]{nopagecolumn} \CodelineIndex \RecordChanges \GetFileInfo{tocstyle-obsolete.dtx} \title{The Obsolete Package \texttt{tocstyle}% \footnote{This is version \fileversion\ of file \texttt{\filename}.}} \date{\filedate} \author{Markus Kohm} \let\Macro\cs \let\Package\textsf \let\File\texttt \let\Option\texttt \let\Counter\texttt \let\ShowOutput\quote \let\endShowOutput\endquote \let\Parameter\marg \let\OParameter\oarg \newcommand\PParameter[1]{\mbox{\texttt{\{#1\}}}} \let\PName\meta \let\PValue\texttt \newlength\descwidth \newenvironment{desctabular}{% \setlength{\descwidth}{\linewidth} \addtolength{\descwidth}{-1em} \addtolength{\descwidth}{-2\tabcolsep} \tabular{@{}lp{\descwidth}@{}} \hline }{% \hline \endtabular } \newcommand{\pventry}[2]{% \multicolumn{2}{@{}l@{}}{\PValue{#1}}\\ ~ & #2 \\ } \providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:} \newcommand*{\AUTOREF}{} \makeatletter \def\AUTOREF#1:#2:{% \edef\@tempa{#1}% \edef\@tempb{tab}\ifx\@tempa\@tempb table~\fi \edef\@tempb{sec}\ifx\@tempa\@tempb section~\fi \ref{#1:#2}% } \makeatother \begin{document} \maketitle \DocInput{\filename} \end{document} % % \fi % % \selectlanguage{english} % % \changes{v0.1}{2007/06/23}{start of new package}%^^A % \changes{v0.2h}{2016/04/12}{\cs{@ifnextchar} replaced by % \cs{kernel@ifnextchar}}%^^A % %\iffalse %\chapter{Other Styles for Table of Contents and Lists of Floats} %\labelbase{tocstyle} %\BeginIndex{Package}{tocstyle} %\fi % % \begin{abstract} %\iffalse %<*doc> %\fi While the main classes of the \KOMAScript\ bundle were made, there where several ideas for formating the table of contents and lists of floats, but almost none of them where implemented. One reason was, that the \KOMAScript\ author didn't like to change the \LaTeX\ kernel at a class, because this may result in serveral problems with other packages. The package \Package{tocstyle} was an experiment to fill the gap. Since \KOMAScript~3.20 most of the features of \Package{tocstyle} are also provided by other \KOMAScript{} packages like \Package{tocbasic}. Since \KOMAScript~3.31 the package has been removed from \KOMAScript. It is deprecated and should not be used any longer. %\iffalse % %\fi % \end{abstract} % % \def\appendixtocdepth{\value{tocdepth}} % \tableofcontents % \def\appendixtocdepth{2} % %\iffalse %<*doc> %\fi % \section{Package Status} \label{sec:tocstyle.status} Package \Package{tocstyle} has alpha status for a very long time (since 2007), despite the fact that it was very stable all over the years. The main reason for this is that it was an experiment and I always intended to make a better successor. Another reason was, that there are known issues, which are hardly to fix. So \Package{tocstyle} never became an official part of \KOMAScript. Nevertheless it has been published with \KOMAScript, because I thought it would be an useful addition. I never thought that the interim status of the package would be for more than eight years. With \KOMAScript~3.20 several features of \Package{tocstyle} can be found also in \Package{tocbasic}. I recommend to use that official and essential part of \KOMAScript{} instead of \Package{tocstyle} whenever possible. With \KOMAScript~3.31 \Package{tocstyle} has moved from \KOMAScript{} bundle to \KOMAScript-obsolete. \section{How It Works} \label{sec:tocstyle.howitworks} Loading the package \Package{tocstyle} will redefine the kernel macro \Macro{@starttoc}. Using the redefined \Macro{@starttoc} will redefine \Macro{@dottedtocline}, \Macro{l@part} down to \Macro{l@subparagraph}, \Macro{l@figure}, and \Macro{l@table}, if and only if \Package{tocstyle} wasn't deactivated for all TOCs or this TOC. Usage the redefined \Macro{@dottedtocline} will redefine \Macro{numberline}. Redefining \Macro{@starttoc}, \Macro{@dottedtocline}, and \Macro{numberline} will activate the features of \Package{tocstyle} for all lists that uses these, e.g. table of contents, list of figures and list of tables at the standard or the \KOMAScript{} classes. But while not all classes uses \Macro{@dottedtocline} and \Macro{@numberline} for all entries to table of contents and list of floats the package redefines some other macros that are typically used for those entries. These are e.g. \Macro{l@part}, \Macro{l@chapter} and some more. If the class even does not use those macros, you may not use \Package{tocstyle} to change the lists. The term TOC will be used for all kind of list, that may be processed by \Package{tocstyle}. The package tests wether the original kernel macros \Macro{@starttoc}, \Macro{@dottedtocline}, and \Macro{numberline} were used or not and warns if not. Package \Package{tocstyle} needs some more information. For the standard and the \KOMAScript{} classes these informations may be detected by the package. If the result is not the expected, you may configure these informations manually. The entries of every TOC hat a depth. See the counter \Counter{tocdepth} for more information about the depth. You may change several settings for the entries of either all depths of all TOCs, all depths of one TOC, or one depth of one TOC. But most users will not need to set up \Package{tocstyle} at this low level. They simply will select one of the predefined styles and maybe select one of the optional features. \section{Optional Features} \label{sec:tocstyle.options} Optional features will be selected using a package option while loading the package or using the package option as a global option loading the class using \Macro{documentclass}. Optional features change generall behaviour of all TOCs. %\iffalse \begin{Description} \Option{tocindentauto} \Option{tocindentmanual} \end{Description} \BeginIndex{Option}{tocindentauto}\BeginIndex{Option}{tocindentmanual} % %<*dtx> %\fi \DescribeMacro{tocindentauto} \DescribeMacro{tocindentmanual} %\iffalse % %<*doc> %\fi With option \Option{tocindentauto} all widths at the TOCs are calculated by \Package{tocstyle}. The calculation of the width needs at least one \LaTeX{} run with all TOC entries. So you need at least three \LaTeX{} runs: \begin{itemize} \item one to write all the TOC entries to the TOC file \item one with the known TOC entries from the TOC file but unknown widths \item one with the known TOC entries from the TOC file and known widths \end{itemize} If the TOC entries changed between the second and the third run\,---\,e.g. because of page numbers changed\,---\,you'll need one more run (and so on). Note: The widths of all entries of same depth and same TOC are same. Don't ask for less width of page numbers at the first than the last TOC page! %\iffalse \EndIndex{Option}{tocindentauto}\EndIndex{Option}{tocindentmanual} %\fi % %\iffalse \begin{Description} \Option{tocgraduated} \Option{tocflat} \Option{tocfullflat} \end{Description}% \BeginIndex{Option}{tocgraduated}\BeginIndex{Option}{tocflat}% \BeginIndex{Option}{tocfullflat}% % %<*dtx> %\fi \DescribeMacro{tocgraduated} \DescribeMacro{tocflat} \DescribeMacro{tocfullflat} %\iffalse % %<*doc> %\fi The option \Option{tocgraduated} selects the graduated version of all TOCs. You know the graduated version from the standard classes. Entries of lower depth are indented against entries of higher depth. This may e.g. look like: \begin{ShowOutput} \showtoc[{% \aliastoc{\tocstyleTOC}{toc}% \usetocstyle[toc]{standard}% \settocfeature[toc]{raggedhook}{\raggedright}% \selecttocstyleoption{tocgraduated}% }]{toc} \end{ShowOutput} The option \Option{tocflat} selects the flat\,---\,aka left aligned\,---\,version of all TOCs. You know the flat version from the \KOMAScript{} classes using option \Option{tocleft}. This may e.g. look like: \begin{ShowOutput} \showtoc[{% \aliastoc{\tocstyleTOC}{toc}% \usetocstyle[toc]{standard}% \selecttocstyleoption{tocflat}% }]{toc}% \end{ShowOutput} The option \Option{tocfullflat} is similar to flat version of all TOCs, but there is even no box of same width for the numbers of all entries. This may e.g. look like: \begin{ShowOutput} \showtoc[{% \aliastoc{\tocstyleTOC}{toc}% \usetocstyle[toc]{standard}% \selecttocstyleoption{tocfullflat}% }]{toc}% \end{ShowOutput} Default is option \Option{tocgraduated}. %\iffalse \EndIndex{Option}{tocgraduated}\EndIndex{Option}{tocflat}% \EndIndex{Option}{tocfullflat}% %\fi % %\iffalse \begin{Description} \Option{tocbreaksstrict}\\ \Option{tocbreakscareless} \end{Description}% \BeginIndex{Option}{tocbreaksstrict}% \BeginIndex{Option}{tocbreakscareless}% % %<*dtx> %\fi \DescribeMacro{tocbreaksstrict} \DescribeMacro{tocbreakscareless} %\iffalse % %<*doc> %\fi Default option \Option{tocbreaksstrict} sets a lot of penalties before and after TOC entries to avoid page break between a TOC entry and it's parent. But sometimes you may like to allow more page breaks. You may use option \Option{tocbreakscareless} for this. %\iffalse \EndIndex{Option}{tocbreaksstrict}\EndIndex{Option}{tocbreakscareless}% %\fi % %\iffalse \begin{Description} \Option{toctextentriesindented}\\ \Option{toctextentriesleft} \end{Description}% \BeginIndex{Option}{toctextentriesindented}% \BeginIndex{Option}{toctextentriesleft}% % %<*dtx> %\fi \DescribeMacro{toctextentriesindented} \DescribeMacro{toctextentriesleft} %\iffalse % %<*doc> %\fi With default option \Option{toctextentriesleft} unnumbered TOC entries, e.g. from \KOMAScript{} command \Macro{addchap}, are indented only as wide as the number of numbered TOC entries of the same level are. But with option \Option{toctextentriesindented} these are indented as if they have an empty number. %\iffalse \EndIndex{Option}{toctextentriesindented}% \EndIndex{Option}{toctextentriesleft}% %\fi % \section{Using TOC Styles} \label{sec:tocstyle.usestyles} Package \Package{tocstyle} hat several predefined toc styles. Most users will never need to define their own toc style but only select one of the predefined and maybe configure it by one of the options described at the previsous section. %\iffalse \begin{Description} \Macro{usetocstyle}\OParameter{TOC}\Parameter{style} \end{Description}% \BeginIndex{Macro}{usetocstyle}% % %<*dtx> %\fi \DescribeMacro{\usetocstyle} %\iffalse % %<*doc> %\fi You may set the style of one or all TOCs. If you want to set the style of all TOCs, you'd simply say \Macro{usetocstyle}\Parameter{style}. This will set all settings of the given style to all TOCs. Individual settings will overwrite this generall setting. If you use \Macro{usetocstyle}\OParameter{TOC}\Parameter{style}, only the style of the given TOC will be set. This will be done \emph{after} the general setting. Only individual settings of single features may overwrite the setting of the style. The \autoref{tab:tocstyle.styles} shows the predefined styles, that may be used as mandatory argument of \Macro{tocstyle}. The optional argument \PName{TOC} is the shortcut (file extension) of the TOC. Examples of known shortcuts are shown at \autoref{tab:tocstyle.shortcuts}. \begin{table} \centering \caption{Predefined TOC Styles} \label{tab:tocstyle.styles} \begin{desctabular} \pventry{standard}{A style similar to the standard classes. All width are predefined to the width of the standard classes, but may be overwritten by the general options (see \autoref{sec:tocstyle.options}). The depth -1 (part) and 0 (chapter) are set in bold face (\Macro{bfseries}). If no depth 0 was found at the TOC, depth 1 (section) will be set in bold face, too. All other depth will be set in normal font. Depth -1 (part) will be set using \Macro{large}. The font changes are valid for the page numbers, too.}% \pventry{KOMAlike}{A style similar to the \KOMAScript{} classes. This is almost the same like \PValue{standard}, but instead of bold face \Macro{usekomafont}\PParameter{disposition} will be used if \Macro{usekomafont} was defined and sans serif, bold face (\Macro{sffamily}\Macro{bfseries}) if not.}% \pventry{classic}{Like \PValue{KOMAlike} but all page numbers are set using normal font.}% \pventry{allwithdot}{Like \PValue{classic} but dots between entry text and page numbers are used at all depths.}% \pventry{noonewithdot}{Like \PValue{classic} but not dots between entry text and page numbers are used.}% \pventry{nopagecolumn}{Like \PValue{noonewithdot} but also the gap between text and page numbers is omited. This means, that the page numbers are set 1\,em after the text.}% \end{desctabular} \end{table} Note: Before you're setting a style the style of the TOCs are unspecified. This means that some entries may be set using \Package{tocstyle} others may not. \begin{table} \centering \caption{Known TOC Shortcuts} \label{tab:tocstyle.shortcuts} \begin{desctabular} \pventry{toc}{Table of contents of almost all known classes.} \pventry{lof}{List of figures of almost all known classes.} \pventry{lot}{List of tables of almost all known classes.} \pventry{lol}{List of listings of package \Package{listings}. Currently the usability of \Package{listings} with \Package{tocstyle} is not recomended. Maybe it works, maybe not. Maybe you should try \Macro{deactivatetocstyle[lol]}.} \end{desctabular} \end{table} %\iffalse \EndIndex{Macro}{usetocstyle}% %\fi % %\iffalse \begin{Description} \Macro{deactivatetocstyle}\OParameter{TOC}\\ \Macro{reactivatetocstyle}\OParameter{TOC} \end{Description}% \BeginIndex{Macro}{\deactivatetocstyle}\BeginIndex{Macro}{\reactivatetocstyle}% % %<*dtx> %\fi \DescribeMacro{\deactivatetocstyle}\DescribeMacro{\reactivatetocstyle} Both commands have one optional argument \PName{TOC}. %\iffalse % %<*doc> %\fi You may deactive the influence of \Package{tocstyle} for a TOC and reactivate it. If you use \Macro{deactivatetocstyle} without the optional argument or empty optional argument, the influence of \Package{tocstyle} for all TOCs will be deactivated and may reactivated only using \Macro{reactivatetocstyle} without the optional argument or empty optional argument too. After deactivation of \Package{tocstyle} for one TOC or all TOCs you may continue configuring TOCs. All these changes will be used after reactivation. %\iffalse \EndIndex{Macro}{\deactivatetocstyle}\EndIndex{Macro}{\reactivatetocstyle}% %\fi % \section{Setting-up Single Features} \label{sec:tocstyle.singlefeatures} At the previous section you've learned how to select a predefined TOC style. You were also told, that you may change one ore more features against the used predefined TOC style for one or all depth of one ore all TOCs. Now you will learn how to do this. %\iffalse \begin{Description} \Macro{settocfeature}% \OParameter{TOC}\OParameter{depth}\Parameter{feature}\Parameter{commands}\\ \Macro{settocstylefeature}% \OParameter{depth}\Parameter{feature}\Parameter{commands} \end{Description}% \BeginIndex{Macro}{settocfeature}\BeginIndex{Macro}{settocstylefeature}% % %<*dtx> %\fi \DescribeMacro{\settocfeature} \DescribeMacro{\settocstylefeature} %\iffalse % %<*doc> %\fi These commands are used to set a single feature eiher of all depth of all TOCs (\Macro{settocfeature} \Parameter{feature} \Parameter{command} or \Macro{settocstylefeature} \Parameter{feature} \Parameter{commands}), or of all depth of a single TOC (\Macro{settocfeature} \OParameter{TOC} \Parameter{feature} \Parameter{commands}), or of a single depth of all TOCs (\Macro{settocstylefeature} \OParameter{depth} \Parameter{feature} \Parameter{commands}), or of a single depth of a single TOC (\Macro{settocfeature} \OParameter{TOC} \OParameter{depth} \Parameter{feature} \Parameter{commands}). Parameter \PName{commands} is a list of commands. In most cases these must not be commands, that need an argument. So you should e.g. not use \Macro{textbf} but \Macro{bfseries} to switch to bold face. Parameter \PName{feature} is the feature, that may be configured with parameter \PName{commands}. All known features are show at \autoref{tab:tocstyle.features}. \begin{table} \centering \caption{Features that May Be Set} \label{tab:tocstyle.features} \begin{desctabular} \pventry{dothook}{will be executed before any dot of the dot line}% \pventry{entryhook}{hook before the entry will be set}% \pventry{entryvskip}{initial vertical skip amount (if not set 0pt plus .2pt will be used)}% \pventry{leaders}{commands for fillin the gap between entry text and page number (if not set the default leaders command with dots will be used)}% \pventry{pagenumberbox}{the box command for setting the page number (if not set the default box of with \Macro{@pnumwidth} will be used); note, that this has to be a command with exactly one argument}% \pventry{pagenumberhook}{hook before the page number will be set at the page number box}% \pventry{parfillskip}{add this amount to the default value of \Macro{parfillskip} after setting up all lengths}% \pventry{raggedhook}{the only allowed values here are \Macro{raggedright} or nothing}% \pventry{spaceafternumber}{amount of minimum space after the entry number, if the needed width will be calculated automaticly}% \end{desctabular} \end{table} The order of used commands for a feature is \begin{enumerate} \item commands for all depths of all TOCs, \item commands for all depth of a single TOC, \item commands for a single depth of all TOCs, \item commands for a single depth of a single TOC, \end{enumerate} and settings of \Macro{usetocstyle} may be overwritten by \Macro{settocfeature} und \Macro{settocstylefeature}. %\iffalse \EndIndex{Macro}{settocfeature}\EndIndex{Macro}{settocstylefeature}% %\fi % \section{Defining New TOC Styles} \label{sec:tocstyle.define} Now you know how to select a prefedined TOC style and how to change single features. But wouldn't it be nice to define your own TOC style? %\iffalse \begin{Description} \Macro{newtocstyle}\OParameter{parent style}\OParameter{exclude features}% \Parameter{new style}% \Parameter{\Macro{settocstylefeature}-commands} \end{Description}% \BeginIndex{Macro}{\newtocstyle}% % %<*dtx> %\fi \DescribeMacro{\newtocstyle} You may do this using \Macro{newtocstyle}\OParameter{parent style} \OParameter{exclude features} \Parameter{style name} \Parameter{\Macro{settocstylefeature}-commands}. %\iffalse % %<*doc> %\fi If you used the optional argument \PName{parent style} all features of the parent style will be part of the new style, before overwriting them with the features of the \PName{\Macro{settocstylefeature}-commands}. You should not use any other commands at the last argument. But at \Macro{newtocstyle} the command \Macro{settocfeature} becomes an alias for \Macro{settocstylefeature} to avoid to much mistakes. The second optional argument is a comma seperated list of feature names. If it is used, these features of the parent style (and all ancestors of the parent) will not be part of the new style. %\iffalse \EndIndex{Macro}{\newtocstyle}% %\fi %\iffalse \begin{Description} \Macro{aliastoc}\Parameter{original-TOC}\Parameter{alias-TOC} \end{Description}% \BeginIndex{Macro}{\aliastoc}% You % %<*dtx> %\fi \DescribeMacro{\aliastoc} Using \Macro{aliastoc}\Parameter{original-TOC}\Parameter{alias-TOC} you %\iffalse % %<*doc> %\fi may define an alias for a TOC. The first argument is the original TOC for that the second argument should be the alias. An alias-TOC will be processed with all settings, that were done for the original-TOC. Internally this command is used as default for the optional, first argument of \Macro{showtoc}.% %\iffalse \EndIndex{Macro}{\aliastoc} %\fi \section{Processing a TOC} \label{sec:tocstyle.processing} While \LaTeX{} inputs a toc file it processes the commands of the TOC. These commands mainly produce the entries of the toc. Some commands are only available or valid while a TOC is processed. But be carefull: Some of these are read-only commands. Changing such a read-only command may result in various errors! %\iffalse \begin{Description} \Macro{@starttoc}\Parameter{TOC}\\ \Macro{showtoc}\OParameter{preprocession}\Parameter{TOC} \end{Description}% \BeginIndex{Macro}{\@starttoc}% \BeginIndex{Macro}{\showtoc}% % %<*dtx> %\fi \DescribeMacro{\@starttoc}% \DescribeMacro{\showtoc}% %\iffalse % %<*doc> %\fi The internal comand \Macro{@startoc} is defined by the \LaTeX{} kernel. It is used by package and class authors to build commands like \Macro{tableofcontents} or \Macro{listoffigures}. Without using it you will not get a toc file. \Package{tocstyle} redefines it, to add pre- and post-processing commands. The original definition found by \Package{tocstyle} will be used inside the redefinition. \Macro{showtoc}% %\iffalse % %<*dtx> %\fi \OParameter{preprocession}\Parameter{TOC}% %\iffalse % %<*doc> %\fi \ is an addition of \texttt{tocstyle}. Using it will procude a copy of TOC and process this copy. The copy will be done just after creating the original TOC. The copy will be an alias for the original file. The extension of the copy is the generated alias if \PName{TOC}. You may generate the alias using \Macro{aliastoc} at the optional argument of \Macro{showtoc}. The default for this optional argument will be \Macro{aliastoc}\Macro{tocstyleTOC}\Macro{tocstyleAliasTOC} and the default alias \Macro{tocstyleAliasTOC} will be \Macro{tocstyleTOC} extended by a number. %\iffalse \begin{example} %\fi The first TOC example at \autoref{sec:tocstyle.options} was made using \begin{lstcode} \showtoc[{% \aliastoc{\tocstyleTOC}{toc}% \usetocstyle[toc]{standard}% \settocfeature[toc]{raggedhook}{\raggedright}% \selecttocstyleoption{tocgraduated}% }]{toc} \end{lstcode} If you want to show a copy of the table of contents, that shows only depth~1 of the headlines you may simply use: \begin{lstcode} \showtoc[{% \expandafter\value{tocdepth}=1\relax \aliastoc{\tocstyleTOC}{toc}% }]{toc} \end{lstcode} or \begin{lstcode} \newcounter{savedtocdepth} \setcounter{savedtocdepth}{\value{tocdepth}} \setcounter{tocdepth}{1} \showtoc{toc} \setcounter{tocdepth}{\value{savedtocdepth}} \end{lstcode} %\iffalse \end{example}% \EndIndex{Macro}{\showtoc} %\fi %\iffalse \begin{Description} \Macro{tocstyleTOC}\\ \Macro{tocstyleAliasTOC} \end{Description}% \BeginIndex{Macro}{\tocstyleTOC}% \BeginIndex{Macro}{\tocstyleAliasTOC}% % %<*dtx> %\fi \DescribeMacro{\tocstyleTOC}% \DescribeMacro{\tocstyleAliasTOC}% %\iffalse % %<*doc> %\fi These are read-only macros. While processing a TOC using \Macro{@starttoc} or \Macro{showtoc}, \Macro{tocstyleAliasTOC} is the shortcut, that is valid for the features and \Macro{tocstyleTOC} is valid for the file extension to be used.% %\iffalse \EndIndex{Macro}{\tocstyleAliasTOC}% \EndIndex{Macro}{\tocstyleTOC} %\fi %\iffalse \begin{Description} \Macro{tocstyledepth} \end{Description}% \BeginIndex{Macro}{\tocstyledepth}% % %<*dtx> %\fi \DescribeMacro{\tocstyledepth} %\iffalse % %<*doc> %\fi This is a read-only macro. While processing a single toc entry with \Macro{@dottedtocline} this is the depth (first argument of \Macro{@dottedtocline}) of this entry. Most users will never need this, but it is often used internaly. Because of this \emph{you should never change it!}% %\iffalse \EndIndex{Macro}{\tocstyledepth} %\fi %\iffalse \begin{Description} \Macro{iftochasdepth}\Parameter{TOC}\Parameter{depth}\Parameter{true}% \Parameter{false} \end{Description} \BeginIndex{Macro}{\iftochasdepth}% You % %<*dtx> %\fi \DescribeMacro{\iftochasdepth} Using \Macro{iftochasdepth}\Parameter{TOC}\Parameter{depth}\Parameter{true}% \Parameter{false} you %\iffalse % %<*doc> %\fi may test, if an entry of a given depth was already output to a TOC. If so the commands of argument \PName{true} will be processed. If not so the commands of argument \PName{false} will be processed.% %\iffalse \EndIndex{Macro}{\iftochasdepth} %\fi \section{Configuration file} \label{sec:tocstyle.cfg} There's another feature for new toc styles. If there's a file \File{tocstyle.cfg} it will be loaded at the end of the package. This is usefull to define your own toc styles. % %\iffalse % %\fi % % \StopEventually{% % \clearpage % \appendix % \addtocontents{toc}{% % \value{tocdepth}=\protect\appendixtocdepth\relax} % \section{Examples for the Different TOC Styles} % Here you will find the table of contents of this document set in the % different TOC styles. All are set with option \Option{tocindentauto}. %^^A The appendix will be omitted. % \subsection{Graduated Versions} % First of all all graduated versions of the table of contents % \selecttocstyleoption{tocgraduated}% % \subsubsection{\PValue{standard} with Option \Option{tocgraduated}} % \usetocstyle[toc]{standard} % \showtoc{toc}\clearpage % \subsubsection{\PValue{KOMAlike} with Option \Option{tocgraduated}} % \usetocstyle[toc]{KOMAlike} % \showtoc{toc}\clearpage % \subsubsection{\PValue{classic} with Option \Option{tocgraduated}} % \usetocstyle[toc]{classic} % \showtoc{toc}\clearpage % \subsubsection{\PValue{allwithdot} with Option \Option{tocgraduated}} % \usetocstyle[toc]{allwithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{noonewithdot} with Option \Option{tocgraduated}} % \usetocstyle[toc]{noonewithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{nopagecolumn} with Option \Option{tocgraduated}} % \usetocstyle[toc]{nopagecolumn} % \showtoc{toc}\clearpage % \subsection{Flat Versions} % Now, all flat versions of the table of contents % \selecttocstyleoption{tocflat}% % \subsubsection{\PValue{standard} with Option \Option{tocflat}} % \usetocstyle[toc]{standard} % \showtoc{toc}\clearpage % \subsubsection{\PValue{KOMAlike} with Option \Option{tocflat}} % \usetocstyle[toc]{KOMAlike} % \showtoc{toc}\clearpage % \subsubsection{\PValue{classic} with Option \Option{tocflat}} % \usetocstyle[toc]{classic} % \showtoc{toc}\clearpage % \subsubsection{\PValue{allwithdot} with Option \Option{tocflat}} % \usetocstyle[toc]{allwithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{noonewithdot} with Option % \Option{tocflat}} % \usetocstyle[toc]{noonewithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{nopagecolumn} with Option % \Option{tocflat}} % \usetocstyle[toc]{nopagecolumn} % \showtoc{toc}\clearpage % \subsection{Fullflat Versions} % Now, all full-flat versions of the table of contents % \selecttocstyleoption{tocfullflat}% % \subsubsection{\PValue{standard} with Option \Option{tocfullflat}} % \usetocstyle[toc]{standard} % \showtoc{toc}\clearpage % \subsubsection{\PValue{KOMAlike} with Option \Option{tocfullflat}} % \usetocstyle[toc]{KOMAlike} % \showtoc{toc}\clearpage % \subsubsection{\PValue{classic} with Option \Option{tocfullflat}} % \usetocstyle[toc]{classic} % \showtoc{toc}\clearpage % \subsubsection{\PValue{allwithdot} with Option \Option{tocfullflat}} % \usetocstyle[toc]{allwithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{noonewithdot} with Option % \Option{tocfullflat}} % \usetocstyle[toc]{noonewithdot} % \showtoc{toc}\clearpage % \subsubsection{\PValue{nopagecolumn} with Option % \Option{tocfullflat}} % \usetocstyle[toc]{nopagecolumn} % \showtoc{toc}\clearpage % \PrintIndex\PrintChanges} % % \section{Implementation} % % \iffalse %<*package> % \fi % % \begin{macrocode} \PackageWarningNoLine{tocstyle}{% THIS IS A DEPRECATED ALPHA VERSION!\MessageBreak USAGE OF THIS VERSION IS ON YOUR OWN RISK!\MessageBreak EVERYTHING MAY HAPPEN!\MessageBreak THE PACKAGE IS FROZEN WITH ALL IT'S BUGS!\MessageBreak THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE!\MessageBreak Maybe it would be better, not to load this package% } % \end{macrocode} % % \subsection{Option} % % Options change general behaviour of TOCs. % % \begin{macro}{\selecttocstyleoption} % \begin{macrocode} \newif\if@tocstyle@penalties \newif\iftocstyle@autolength \newif\iftocstyle@indentnotnumbered \newcount\tocstyle@indentstyle\tocstyle@indentstyle=\z@ \newcommand*{\selecttocstyleoption}[1]{% \begingroup \edef\@tempa{#1}% \edef\@tempb{tocbreaksstrict}% \ifx\@tempa\@tempb\aftergroup\@tocstyle@penaltiestrue\else \edef\@tempb{tocbreakscareless}% \ifx\@tempa\@tempb\aftergroup\@tocstyle@penaltiesfalse\else \edef\@tempb{tocindentauto} \ifx\@tempa\@tempb\aftergroup\tocstyle@autolengthtrue\else \edef\@tempb{tocindentmanual}% \ifx\@tempa\@tempb\aftergroup\tocstyle@autolengthfalse\else \edef\@tempb{tocgraduated}% \ifx\@tempa\@tempb \aftergroup\tocstyle@indentstyle\aftergroup\z@ \else \edef\@tempb{tocflat}% \ifx\@tempa\@tempb \aftergroup\tocstyle@indentstyle\aftergroup\@ne \aftergroup\relax \else \edef\@tempb{tocfullflat}% \ifx\@tempa\@tempb \aftergroup\tocstyle@indentstyle\aftergroup\tw@ \aftergroup\relax \else \edef\@tempb{toctextentriesindented}% \ifx\@tempa\@tempb\aftergroup\tocstyle@indentnotnumberedtrue \else \edef\@tempb{toctextentriesleft}% \ifx\@tempa\@tempb \aftergroup\tocstyle@indentnotnumberedfalse \else \PackageError{tocstyle}{unknown option `#1'}{% You've told me to select toc style option `#1',\MessageBreak but tocstyle doesn't know an option named `#1'}% \fi \fi \fi \fi \fi \fi \fi \fi \fi \endgroup } % \end{macrocode} % \end{macro} % % \begin{option}{chapter} % \changes{v0.2d}{2009/11/11}{New} % \begin{option}{nochapter} % \changes{v0.2d}{2009/11/11}{New} % \begin{macro}{\iftochaschapter} % \changes{v0.2d}{2009/11/11}{New} % Do we have \cs{chapter} and \cs{l@chapter}? % \begin{macrocode} \newif\iftochaschapter\tochaschapterfalse \ifcsname l@chapter\endcsname \ifcsname chapter\endcsname \tochaschaptertrue \fi \fi % \end{macrocode} % \end{macro} % \end{option} % \end{option} % % \begin{option}{tocbreaksstrict} % \begin{option}{tocbreakscareless} % Switch on extended pernalties. % \begin{macrocode} \DeclareOption{tocbreaksstrict}{\selecttocstyleoption\CurrentOption} \DeclareOption{tocbreakscareless}{\selecttocstyleoption\CurrentOption} % \end{macrocode} % \end{option} % \end{option} % % \begin{option}{tocindentauto} % \begin{option}{tocindentmanual} % \begin{macrocode} \DeclareOption{tocindentauto}{\selecttocstyleoption\CurrentOption} \DeclareOption{tocindentmanual}{\selecttocstyleoption\CurrentOption} % \end{macrocode} % \end{option} % \end{option} % % \begin{option}{toctextentriesindented} % \begin{option}{toctextentriesleft} % \begin{macrocode} \DeclareOption{toctextentriesindented}{\selecttocstyleoption\CurrentOption} \DeclareOption{toctextentriesleft}{\selecttocstyleoption\CurrentOption} % \end{macrocode} % \end{option} % \end{option} % % \begin{option}{tocgraduated} % \begin{option}{tocflat} % \begin{option}{tocfullflat} % \begin{macrocode} \DeclareOption{tocgraduated}{\selecttocstyleoption\CurrentOption} \DeclareOption{tocflat}{\selecttocstyleoption\CurrentOption} \DeclareOption{tocfullflat}{\selecttocstyleoption\CurrentOption} % \end{macrocode} % \end{option} % \end{option} % \end{option} % % Defaults and others: % \begin{macrocode} \ExecuteOptions{tocbreaksstrict,tocindentauto,tocgraduated,% toctextentriesleft} \ProcessOptions\relax % \end{macrocode} % % \begin{macrocode} \ifcsname if@tocleft\endcsname \expandafter\let\csname if@tempswa\expandafter\endcsname \csname if@tocleft\endcsname \else \@tempswafalse \fi \if@tempswa \PackageWarningNoLine{tocstyle}{% You should not use class option `toc=flat'!\MessageBreak This may result in errors or unexpected results.\MessageBreak I'll try to deactivate `toc=flat', now.\MessageBreak You may use package options `tocflat' and\MessageBreak `tocindentauto' instead of `toc=flat'}% \csname @tocleftfalse\endcsname \fi % \end{macrocode} % % % \subsection{Body} % % There are two parts at \Package{tocstyle}: % \begin{itemize} % \item redefining internal \LaTeX{} kernel macros, % \item defining new macros and redefining class macros. % \end{itemize} % Redefining \LaTeX{} kernel macros may not be switched of. But redefining % class macros will only be on demand. % % \subsubsection{Redefining \LaTeX{} Kernel Macros} % % Some \LaTeX{} kernel macros must be redefined to add the new % functionality. Before redefining them, we test against the definition at % kernel 2005/12/01 % % \begin{macro}{\@starttoc} % \begin{macro}{\tocstyle@saved@@starttoc} % The original definition will be extended by defaults for \cs{parskip}, % \cs{parindent} and % \cs{parfillskip} and storage of the shortcut of the % current TOC. % \begin{macrocode} \newcommand*\tocstyle@saved@starttoc{} \let\tocstyle@saved@starttoc\@starttoc \renewcommand*{\@starttoc}[1]{% \tocstyle@pre@starttoc{#1}% \tocstyle@saved@starttoc{#1}% \tocstyle@post@starttoc{#1}% } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tocstyle@saved@dottedtocline} % For saving the unchanged definition (at \cs{begin{document}}): % \begin{macrocode} \newcommand*{\tocstyle@saved@dottedtocline}{} % \end{macrocode} % \end{macro} % \begin{macro}{\tocstyle@dottedtocline} % \changes{v0.2j}{2019/10/09}{newer \LaTeX{} uses two \cs{kern}}%^^A % Implement new definition and redefine: %^^A ------ Help me to find the \renecommand*{\@dottedtocline} ---------------- % \begin{macrocode} \newcommand*{\tocstyle@dottedtocline}[5]{% \let\numberline\tocstyle@numberline \ifnum #1>\c@tocdepth \else % \end{macrocode} % Penalty feature: no page break between higher and lower depths. % \begin{macrocode} \if@tocstyle@penalties \begingroup \@tempcnta 20010 \advance \@tempcnta by -#1 \ifnum \@tempcnta>\lastpenalty \aftergroup\penalty\aftergroup\@lowpenalty \fi \endgroup \fi % \end{macrocode} % Activation of all features for this TOC and depth: % \begin{macrocode} \edef\tocstyledepth{#1}% \tocstyle@activate@features % \end{macrocode} % Similar to kernel command but if feature \texttt{entryvskip} was set use % \cs{addvspace}: % \begin{macrocode} \ifx\tocstyle@feature@entryvskip\relax \vskip \z@ \@plus.2\p@ \else \addvspace{\tocstyle@feature@entryvskip}% \fi {% % \end{macrocode} % Preinitialization of lengths and skips and then call a hook % \begin{macrocode} \parskip \z@ \parindent \z@ \leftskip \z@ \rightskip \z@ \tocstyle@feature@raggedhook % \end{macrocode} % Set number indent to \cs{@tempdimb} and text indent to \cs{@tempdima}. % \begin{macrocode} \@tempdima #3\relax \@tempdimb #2\relax % \typeout{number indent by \string\l@... (\tocstyleTOC, \tocstyledepth): \space\the\@tempdimb}% % \typeout{text indent by \string\l@... (\tocstyleTOC, \tocstyledepth): \space\the\@tempdima}% % \end{macrocode} % \changes{v0.2d}{2009/11/09}{fix: use of max-values} % Calc auto lengths. Use max. of last run of parents if available. % \begin{macrocode} \ifnum #1>\z@\relax \@tempcnta #1\relax \advance\@tempcnta \m@ne \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname \@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname \advance\@tempdimb \csname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname \fi \fi \fi % \typeout{number indent by parent (\tocstyleTOC, \tocstyledepth): \space\the\@tempdimb}% \ifcsname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname \ifdim \@tempdimb> \csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname\relax \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname{\the\@tempdimb}% \fi \else \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname{\the\@tempdimb}% \fi \iftocstyle@autolength \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname \@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname \relax \fi \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname \@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname \relax \fi % \typeout{text indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdima}% % \typeout{number indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}% \else \@tempdimb #2\relax % \typeout{number indent explicite (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}% \fi \ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname \ifdim \@tempdima> \csname tocstyle@unumwidth@\tocstyleTOC @\endcsname\relax \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC @\endcsname{\the\@tempdima}% \fi \else \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC @\endcsname{\the\@tempdima}% \fi \ifcase\tocstyle@indentstyle\relax\else \@tempdimb \z@ \ifcsname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname \@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname \relax \fi % \typeout{text noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdima}% % \typeout{number noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}% \fi % \end{macrocode} % Advance instead of set, because of the hook above: % \begin{macrocode} \advance\parindent \@tempdimb\@afterindenttrue \advance\leftskip \parindent \advance\rightskip \@tocrmarg \parfillskip -\rightskip \ifx\tocstyle@feature@parfillskip\relax\else \advance\parfillskip \tocstyle@feature@parfillskip\relax \fi \interlinepenalty\@M \leavevmode \advance\leftskip \@tempdima \null\nobreak % \end{macrocode} % \cs{hskip}\cs{-leftskip} optional moved to \cs{numberline} % \begin{macrocode} \iftocstyle@indentnotnumbered\else \hskip -\leftskip \fi % \end{macrocode} % Change at start of the entry % \begin{macrocode} \tocstyle@feature@entryhook % \end{macrocode} % Similar to kernel command but if feature \texttt{leaders} was set use % this instead of the default leaders. And if feature \texttt{dothook} was set % (default is \cs{normalfont}) use this at the default leaders. % \begin{macrocode} {#4}\nobreak \ifx\tocstyle@feature@leaders\relax \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}% \mkern \@dotsep mu$}\hfill \else \tocstyle@feature@leaders \fi \nobreak \ifx\tocstyle@feature@pagenumberbox\relax \hb@xt@\@pnumwidth{\hfil\tocstyle@feature@pagenumberhook #5% \kern-\p@\kern\p@}% \else \tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5% \kern-\p@\kern\p@}% \fi \par }% % \end{macrocode} % Last change is, another penalty change: % \begin{macrocode} \if@tocstyle@penalties \bgroup \@tempcnta 20009 \advance\@tempcnta by -#1 \edef\reserved@a{\egroup\penalty\the\@tempcnta\relax}% \reserved@a \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\tocstyle@saved@numberline} % \begin{macro}{\tocstyle@numberline} % Define a new \cs{numberline}, that will do all the job after % \cs{begin{document}} and one to save the original definition. %^^A----------------------- \renewcommand*\numberline ------------------------ % \begin{macrocode} \newcommand*{\tocstyle@saved@numberline}{} \newcommand*{\tocstyle@numberline}[1]{% \begingroup \ifx\tocstyle@feature@spaceafternumber\relax \settowidth\@tempdima{\tocstyle@@numberline{#1}\enskip}% \else \settowidth\@tempdima{\tocstyle@@numberline{#1}}% \advance \@tempdima \tocstyle@feature@spaceafternumber\relax \fi \ifcsname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname \ifdim \@tempdima > \csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname\relax \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname{\the\@tempdima}% \fi \else \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname{\the\@tempdima}% \fi \endgroup \iftocstyle@indentnotnumbered \hskip -\leftskip \fi \ifcase \tocstyle@indentstyle \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}% \or \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}% \else \ifx\tocstyle@feature@spaceafternumber\relax \hbox{\tocstyle@@numberline{#1}\enskip}% \else \hbox{\tocstyle@@numberline{#1}\hskip \tocstyle@feature@spaceafternumber\relax}% \fi \fi } % \end{macrocode} % \begin{macro}{\tocstyle@@numberline} % Do the main work! % \begin{macrocode} \newcommand*{\tocstyle@@numberline}[1]{% #1\csname autodot\endcsname } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{Redefining Class Macros} % % \begin{macro}{\l@part} % \changes{v0.2d}{2009/11/11}{part level is always -1} % \begin{macro}{\l@chapter} % \begin{macro}{\l@section} % \begin{macro}{\l@subsection} % \begin{macro}{\l@subsubsection} % \begin{macro}{\l@paragraph} % \begin{macro}{\l@subparagraph} % \begin{macro}{\l@table} % \begin{macro}{\l@figure} % Try to redefine the toc commands at startup. % \changes{v0.2f}{2016/03/22}{recognize all subs of part, chapter, % section and paragraph}%^^A % \changes{v0.2g}{2016/03/23}{warning for usage of not recommended package % combinations}%^^A % \changes{v0.2h}{2016/04/24}{lokal \cs{normalcolor} auf \cs{relax} % setzen}%^^A % \changes{v0.2h}{2016/04/24}{lokal \cs{color} auf \cs{@gobble} setzen}%^^A % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{tocbasic}{% \@ifpackagelater{tocbasic}{2016/03/01}{% \PackageWarningNoLine{tocstyle}{% Usage of `tocstyle' with new `tocbasic' detected.\MessageBreak This is not an error! You can do this.\MessageBreak Nevertheless, you should note, combining `tocstyle'\MessageBreak with this version of `tocbasic' will break several\MessageBreak features of `tocbasic'. You should use `tocstyle'\MessageBreak features instead of `tocbasic' attributes for all\MessageBreak entry changes you want.\MessageBreak You may also get additional warnings because of\MessageBreak redefined `\string\numberline'. Ignore them}% }{}% }{}% \@ifpackageloaded{etoc}{% \PackageWarningNoLine{tocstyle}{% Usage of `tocstyle' with `etoc' detected.\MessageBreak I suggest to use either `tocstyle' or `etoc'\MessageBreak but not both of them together}% }{}% \@ifpackageloaded{titletoc}{% \PackageWarningNoLine{tocstyle}{% Usage of `tocstyle' with `titletoc' detected.\MessageBreak I suggest to use either `tocstyle' or `titletoc'\MessageBreak but not both of them together. I expect even\MessageBreak error messages because of this combination}% }{}% \def\tocstyle@test@level{-1}% \def\tocstyle@test@levelname{part}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% \ifnum\tocstyle@test@level<\z@ \def\tocstyle@test@level{0}% \fi \def\tocstyle@test@levelname{chapter}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% \ifnum\tocstyle@test@level<\@ne \def\tocstyle@test@level{1}% \fi \def\tocstyle@test@levelname{section}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% \def\tocstyle@test@levelname{paragraph}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% \def\tocstyle@test@level{1}% \def\tocstyle@test@levelname{table}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% \def\tocstyle@test@level{1}% \def\tocstyle@test@levelname{figure}% \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{% \setbox\@tempboxa\vbox{\hsize\maxdimen \let\normalcolor\relax \let\color\@gobble \edef\reserved@a{% \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{% \noexpand\tocstyle@l@define{\tocstyle@test@levelname}% {\tocstyle@test@level}% }{}% }% \reserved@a }% \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}% \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}% }% % \end{macrocode} % \begin{macro}{\@dottedtocline} % \changes{v0.2j}{2019/10/09}{newer \LaTeX{} uses two \cs{kern}}%^^A % This will be used even for undotted toc lines. First check the definition, % then redefine. % \begin{macrocode} \def\@tempa#1#2#3#4#5{% \ifnum #1>\c@tocdepth \else \vskip \z@ \@plus.2\p@ {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent #2\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima #3\relax \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip {#4}\nobreak \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill \nobreak \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5}% \par}% \fi}% \ifx\@dottedtocline\@tempa\else \def\@tempa#1#2#3#4#5{% \ifnum #1>\c@tocdepth \else \vskip \z@ \@plus.2\p@ {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent #2\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima #3\relax \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip {#4}\nobreak \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill \nobreak \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5\kern-\p@\kern\p@}% \par}% \fi}% \ifx\@dottedtocline\@tempa\else \tocstyle@macrochangewarning\@dottedtocline \fi \fi \let\tocstyle@saved@dottedtocline\@dottedtocline % \end{macrocode} % \end{macro} % \begin{macro}{\numberline} % This macro needed to be redefined to calculate the with of the numbers. % First of all: check the definition. This is a bit more difficult, because % of respecting \KOMAScript: % \begin{macrocode} \def\@tempa#1{\hb@xt@\@tempdima{#1\autodot\hfil}}% \ifx\numberline\@tempa\else \def\@tempa#1{\hb@xt@\@tempdima{#1\hfil}}% \ifx\numberline@tempa\else \tocstyle@macrochangewarning\numberline \fi \fi \let\tocstyle@saved@numberline\numberline } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tocstyle@macrochangewarning} % \begin{macrocode} \newcommand*{\tocstyle@macrochangewarning}[1]{% \PackageWarningNoLine{tocstyle}{% unexpected \string#1\space definition!\MessageBreak You are either using an unknown LaTeX kernel\MessageBreak version, an unknown class or package, that redefines\MessageBreak \string#1, or a \string#1\space redefinition\MessageBreak at the document preamble.\MessageBreak Because of this you may get unexpected results!\MessageBreak Maybe it would be better not to use package tocstyle}% \PackageInfo{tocstyle}{Unexpected definition is:\MessageBreak \meaning#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\tocstyle@l@define} % \begin{macro}{\tocstyle@activate@all@l} % \begin{macrocode} \newcommand*{\tocstyle@activate@all@l}{} \newcommand*{\tocstyle@l@define}[2]{% \advance\leftskip-\@tempdima \edef\@tempa{% \noexpand\global\noexpand\let \expandafter\noexpand\csname tocstyle@saved@l@#1\endcsname \expandafter\noexpand\csname l@#1\endcsname \noexpand\gdef \expandafter\noexpand\csname tocstyle@l@#1\endcsname{% \noexpand\@dottedtocline{#2}{\the\leftskip}{\the\@tempdima}}% \noexpand\g@addto@macro\noexpand\tocstyle@activate@all@l{% \noexpand\let\expandafter\noexpand\csname l@#1\endcsname \expandafter\noexpand\csname tocstyle@l@#1\endcsname }% }% \PackageInfo{tocstyle}{prepare \expandafter\string \csname l@#1\endcsname\space for redefinition}% \@tempa } % \end{macrocode} % \end{macro} % \end{macro} % % \subsubsection{New Macros} % % \begin{macro}{\showtoc} % \begin{macrocode} \newcommand*{\showtoc}[2][\aliastoc\tocstyleTOC\tocstyleAliasTOC]{% \ifcsname tocstyle@copyname@#2\endcsname \@tempcnta \csname tocstyle@copyname@#2\endcsname\relax \advance\@tempcnta \@ne \expandafter\xdef\csname tocstyle@copyname@#2\endcsname{\the\@tempcnta}% \else \expandafter\xdef\csname tocstyle@copyname@#2\endcsname{1}% \fi \ifx\@dofilelist\relax\let\@dofilelist\@empty\fi \edef\@tempa{\noexpand\g@addto@macro\noexpand\@dofilelist{% \noexpand\tocstyle@copy@toc{#2}{\csname tocstyle@copyname@#2\endcsname}}% }\@tempa% \begingroup \edef\tocstyleAliasTOC{#2}% \edef\tocstyleTOC{#2\csname tocstyle@copyname@#2\endcsname}% #1 \tocstyle@pre@starttoc{#2\csname tocstyle@copyname@#2\endcsname}% \makeatletter \@input{\jobname.#2\csname tocstyle@copyname@#2\endcsname}% \@nobreakfalse \tocstyle@post@starttoc{#2\csname tocstyle@copyname@#2\endcsname}% \endgroup } % \end{macrocode} % \begin{macro}{\tocstyle@copy@toc} % \begin{macrocode} \newcommand*{\tocstyle@copy@toc}[2]{% \if@filesw \begingroup \endlinechar=\m@ne % \end{macrocode} % While \LaTeX{} does not close the files, we have to do it know. % \begin{macrocode} \immediate\closeout\csname tf@#1\endcsname \immediate\openin\@inputcheck \jobname.#1 \immediate\openout\@partaux \jobname.#1#2 \loop\unless\ifeof\@inputcheck \immediate\readline\@inputcheck to \@tempa \immediate\write\@partaux{\@tempa}% \repeat \immediate\closeout\@partaux \immediate\closein\@inputcheck \endgroup \fi } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\aliastoc} % Internal use not the real TOC shortcut but another one. % \begin{macrocode} \newcommand*{\aliastoc}[2]{% \expandafter\edef\csname tocstyle@alias@TOC@#1\endcsname{#2}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\tocstyle@pre@starttoc} % \begin{macro}{\tocstyle@post@starttoc} % Commands before and after the original \cs{@starttoc}. % \begin{macrocode} \newcommand*{\tocstyle@pre@starttoc}[1]{% \begingroup \expandafter\ifx\csname tocstyle@deactivated@\endcsname\relax \expandafter\ifx\csname tocstyle@deactivated@#1\endcsname\relax\relax \tocstyle@activetrue \else \tocstyle@activefalse \fi \else \tocstyle@activefalse \fi \iftocstyle@active \let\@dottedtocline\tocstyle@dottedtocline \parskip \z@ \parindent \z@ \parfillskip \z@\@plus 1fil \ifcsname tocstyle@alias@TOC@#1\endcsname \edef\tocstyleAliasTOC{\csname tocstyle@alias@TOC@#1\endcsname}% \else \edef\tocstyleAliasTOC{#1}% \fi \edef\tocstyleTOC{#1}% \tocstyle@activate@all@l \fi } \newcommand*{\tocstyle@post@starttoc}[1]{% \iftocstyle@active \if@filesw \ifcsname tocstyle@unumwidth@#1@\endcsname \protected@write\@auxout{}{% \protect\tocstyle@set@width{unum}{#1}{}{% \csname tocstyle@unumwidth@#1@\endcsname}% }% \fi \expandafter\let\expandafter\@tempa \csname tocstyle@depthlist@#1\endcsname \ifx\@tempa\relax\else \expandafter\@for \expandafter\@tempa\expandafter:\expandafter=\@tempa \do {% \ifcsname tocstyle@numwidth@#1@\@tempa\endcsname \protected@write\@auxout{}{% \protect\tocstyle@set@width{num}{#1}{\@tempa}{% \csname tocstyle@numwidth@#1@\@tempa\endcsname}% }% \fi \ifcsname tocstyle@skipwidth@#1@\@tempa\endcsname \protected@write\@auxout{}{% \protect\tocstyle@set@width{skip}{#1}{\@tempa}{% \csname tocstyle@skipwidth@#1@\@tempa\endcsname}% }% \fi }% \fi \fi \fi \endgroup } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tocstyle@set@width} % \changes{v0.2d}{2009/11/11}{improve handling of standard classes}%^^A % \changes{v0.2h}{2016/03/25}{use after definition in \texttt{aux}-file}%^^A % Some classes do not use \cs{numberline}. This may result in negativ widths % (esp. negativ skips). Following special handling of negativ values improves % the toc handling of the standard classes. Nevertheless indentation of not % numbered entries does not work with such classes! % \begin{macrocode} \newcommand*{\tocstyle@set@width}[4]{% \iftocstyle@indentnotnumbered \ifdim #4<\z@ \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{% \dimexpr #4/2\relax}% \else \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#4}% \fi \else \ifdim #4<\z@ \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{\z@}% \else \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#4}% \fi \fi } \AtBeginDocument{% \if@filesw \immediate\write\@auxout{% \string\providecommand*\string\tocstyle@set@width[4]{}% }% \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\tocstyleTOC} % \begin{macro}{\tocstyleAliasTOC} % Shortcut of the current processed TOC. Empty outside of TOCs. % \begin{macrocode} \newcommand*{\tocstyleTOC}{} \newcommand*{\tocstyleAliasTOC}{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tocstyledepth} % Current depth of the current processed TOC entry. % \begin{macrocode} \newcommand*{\tocstyledepth}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\deactivatetocstyle}% % \begin{macro}{\reactivatetocstyle}% % You may (de)activate all influence of tocstyle either for one or all TOCs. % \begin{macrocode} \newif\iftocstyle@active \newcommand*{\deactivatetocstyle}[1][]{% \expandafter\let\csname tocstyle@deactivated@#1\endcsname\@empty} \newcommand*{\reactivatetocstyle}[1][]{% \expandafter\let\csname tocstyle@deactivated@#1\endcsname\relax} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\settocfeature} % \begin{macro}{\@settocfeature} % \begin{macro}{\@@@settocfeature} % The primary command to set the features of a depth of a TOC. % \begin{macrocode} \newcommand*{\@settocfeature}[1][]{% \kernel@ifnextchar[ {\@@settocfeature[{#1}]}{\@@settocfeature[{#1}][]} } \def\@@settocfeature[#1][#2]#3#4{% % \typeout{exclude: \tocstyle@feature@excludelist}% \@expandtwoargs\in@{,#3,}{,\tocstyle@feature@excludelist,}% \ifin@\else \expandafter\ifcsname tocstyle@feature@#3\endcsname \@namedef{tocstyle@feature@#3@#1@#2}{#4}% \begingroup \expandafter\let\expandafter\@tempa \csname tocstyle@commandlist@#1\endcsname \@expandtwoargs\in@{,tocstyle@feature@#3@#1@#2,}{,\@tempa,}% \ifin@\let\@tempa\endgroup\else \edef\@tempa{\endgroup \noexpand\expandafter\noexpand\ifx \noexpand\csname tocstyle@commandlist@#1\noexpand\endcsname\relax \noexpand\expandafter\noexpand\expandafter\noexpand\expandafter \noexpand\def \noexpand\else \noexpand\expandafter\noexpand\expandafter\noexpand\expandafter \noexpand\l@addto@macro \noexpand\fi \noexpand\csname tocstyle@commandlist@#1\noexpand\endcsname% {tocstyle@feature@#3@#1@#2,}}% \fi \@tempa \else \PackageError{tocstyle}{unkown feature `#3'}{% You've told me to set up toc style feature `#3',\MessageBreak but I don't know this feature.\MessageBreak See the tocstyle manual for all known feature.\MessageBreak }% \fi \fi } \newcommand*{\settocfeature}{} \let\settocfeature\@settocfeature % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\l@addto@macro} % Something like \cs{g@addto@macro} but only with local effect. While other % packages or classes may also define this, \cs{providecommand} will be used. % \begin{macrocode} \providecommand{\l@addto@macro}[2]{% \edef#1{\unexpanded\expandafter{#1#2}}% }% % \end{macrocode} % \end{macro} % % \begin{macro}{\settocstylefeature} % \begin{macro}{\@settocstylefeature} % Same as above without TOC argument. % \begin{macrocode} \newcommand*{\@settocstylefeature}{% \kernel@ifnextchar[ {\@settocfeature[]}{\@settocfeature[][]}% } \newcommand*{\settocstylefeature}{} \let\settocstylefeature\@settocstylefeature % \end{macrocode} % \end{macro} % \end{macro} % % Different commands will be defined: % \begin{macro}{\tocstyle@feature@!@@} % Global feature (all TOCs all depths). % \end{macro} % \begin{macro}{\tocstyle@feature@@!@!@} % All depth feature for one TOC. % \end{macro} % \begin{macro}{\tocstyle@feature@@!@@!} % All TOCs feature for one depth. % \end{macro} % \begin{macro}{\tocstyle@feature@@!@!@!} % One depth of one TOC feature. % \end{macro} % % \begin{macro}{\tocstyle@activate@features} % Activates the features % \begin{macrocode} \newcommand*{\tocstyle@activate@features}{% \expandafter\ifx\csname tocstyle@depthlist@\tocstyleTOC\endcsname\relax \expandafter\xdef\csname tocstyle@depthlist@\tocstyleTOC\endcsname{% \tocstyledepth}% \else \expandafter\let\expandafter\@tempa \csname tocstyle@depthlist@\tocstyleTOC\endcsname \@expandtwoargs\in@{,\tocstyledepth,}{,\@tempa,}% \ifin@\else \expandafter\xdef\csname tocstyle@depthlist@\tocstyleTOC\endcsname{% \csname tocstyle@depthlist@\tocstyleTOC\endcsname,\tocstyledepth}% \fi \fi \expandafter\@for \expandafter\@tempa \expandafter:\expandafter=\tocstyle@featurelist \do {% \@ifundefined{tocstyle@feature@\@tempa @\tocstyleAliasTOC @\tocstyledepth}{% \@ifundefined{tocstyle@feature@\@tempa @@\tocstyledepth}{% \@ifundefined{tocstyle@feature@\@tempa @\tocstyleAliasTOC @}{% \@ifundefined{tocstyle@feature@\@tempa @@}{% \expandafter\let\csname tocstyle@feature@\@tempa\endcsname\relax }{% \expandafter\let\csname tocstyle@feature@\@tempa \expandafter\endcsname \csname tocstyle@feature@\@tempa @@\endcsname }% }{% \expandafter\let\csname tocstyle@feature@\@tempa \expandafter\endcsname \csname tocstyle@feature@\@tempa @\tocstyleAliasTOC @\endcsname }% }{% \expandafter\let\csname tocstyle@feature@\@tempa \expandafter\endcsname \csname tocstyle@feature@\@tempa @@\tocstyledepth\endcsname }% }{% \expandafter\let\csname tocstyle@feature@\@tempa \expandafter\endcsname \csname tocstyle@feature@\@tempa @\tocstyleAliasTOC @\tocstyledepth\endcsname }% }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\newtocstyle} % Defining a new TOC style. First optional argument is a TOC style, that % will be activated before the new definitions. Note that all new % definitions will overwirte the parent's definitions. So a new TOC style, % that defines all features doesn't need a parent. % \begin{macrocode} \newcommand*{\newtocstyle}{% \kernel@ifnextchar [{\@newtocstyle}{\@newtocstyle[]}} \newcommand*{\@newtocstyle}{} \def\@newtocstyle[#1]{% \kernel@ifnextchar [{\@@newtocstyle[{#1}]}{\@newtocstyle[{#1}][]}} \newcommand*{\@@newtocstyle}{} \def\@@newtocstyle[#1][#2]#3#4{% \@ifundefined{tocstyle@style@#3}{% \@ifundefined{tocstyle@style@#1}{% \ifx \relax#1\relax\else \PackageError{tocstyle}{unknown parent TOC style `#1'}{% You've told me to inheritate parent TOC style `#1',\MessageBreak but there's no TOC style `#1' defined.}% \fi \expandafter\def\csname tocstyle@style@#3\endcsname{#4}% }{% \expandafter\def\csname tocstyle@style@#3\endcsname{% \edef\reserved@a{% \noexpand\l@addto@macro\noexpand\tocstyle@feature@excludelist{#2}% \noexpand\@usetocstyle{#1}% \noexpand\def\noexpand\tocstyle@feature@excludelist{% \tocstyle@feature@excludelist}% }\reserved@a #4% }% }% }{% \PackageError{tocstyle}{TOC style `#3' already defined}{% You've tried to define a new TOC style `#3',\MessageBreak but there's already a TOC style named `#3'.}% }% } \newcommand*{\tocstyle@feature@excludelist}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\usetocstyle} % \begin{macro}{\@usetocstyle} % \changes{v0.2a}{2008/02/14}{extended for deprecated TOC styles} % Use the predefined TOC style. You may define % |\tocstyle@deprecated@style@foo| to mark TOC style |foo| to be % deprecated. If |\tocstyle@deprecated@style@foo| is |\@empty| TOC style % |deprecated@foo| will be used instead almost silently. Otherwise TOC % style |\tocstyle@deprecated@style@foo| will be used instead and the user % will be told about this change. % \begin{macrocode} \newcommand*{\usetocstyle}[2][]{% \@ifundefined{tocstyle@deprecated@style@#2}{% \@ifundefined{tocstyle@style@#2}{% \PackageError{tocstyle}{unknown TOC style `#2'}{% You've told me to use TOC style `#2',\MessageBreak but there's no TOC style `#2' defined.}% }{% \def\settocfeature{% \kernel@ifnextchar[ %] {\@@settocfeature[{#1}]}{\@@settocfeature[{#1}][]}% }% \let\settocstylefeature\settocfeature % \end{macrocode} % Deactivate all known features for this TOC % \begin{macrocode} \expandafter\ifx\csname tocstyle@commandlist@#1\endcsname\relax \else \expandafter\expandafter\expandafter\@for \expandafter\expandafter\expandafter\@tempa \expandafter\expandafter\expandafter:% \expandafter\expandafter\expandafter=% \csname tocstyle@commandlist@#1\endcsname \do{% \expandafter\let\csname \@tempa\endcsname\relax }% % \end{macrocode} % So there are no more known features for this TOC. % \begin{macrocode} \expandafter\let\csname tocstyle@commandlist@#1\endcsname\relax \fi % \end{macrocode} % Activate all known features for this style and TOC % \begin{macrocode} \@usetocstyle{#2}% \let\settocfeature\@settocfeature \let\settocstylefeature\@settocstylefeature }% }{% \expandafter\ifx\csname tocstyle@deprecated@style@#2\endcsname\@empty \PackageWarning{tocstyle}{% deprecated TOC style `#2'!\MessageBreak You should not longer use this style,\MessageBreak because it will be removed soon.\MessageBreak You should select another TOC style}% \usetocstyle[{#1}]{deprecated@#2}% \else \PackageWarning{tocstyle}{% deprecated TOC style `#2'!\MessageBreak You should use TOC style '\csname tocstyle@deprecated@style@#2\endcsname'\MessageBreak instead of `#2'}% \fi }% } \newcommand*{\@usetocstyle}[1]{% \csname tocstyle@style@#1\endcsname } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tocstyle@featurelist} % Comma seperated list of all known features % \begin{macrocode} \newcommand*{\tocstyle@featurelist}{% pagenumberhook,entryhook,dothook,entryvskip,leaders,raggedhook,% spaceafternumber,parfillskip,pagenumberbox,% } % \end{macrocode} % \end{macro} % % \begin{macro}{\tocstyle@feature@pagenumberhook} % \begin{macro}{\tocstyle@feature@pagenumberhook} % \begin{macro}{\tocstyle@feature@entryhook} % \begin{macro}{\tocstyle@feature@dothook} % \begin{macro}{\tocstyle@feature@entryvskip} % \begin{macro}{\tocstyle@feature@leaders} % \begin{macro}{\tocstyle@feature@parfillskip} % \begin{macro}{\tocstyle@feature@raggedhook} % \begin{macro}{\tocstyle@feature@spaceafternumber} % \begin{macrocode} \newcommand*{\tocstyle@feature@pagenumberhook}{} \let\tocstyle@feature@pagenumberhook\relax \newcommand*{\tocstyle@feature@pagenumberbox}{} \let\tocstyle@feature@pagenumberbox\relax \newcommand*{\tocstye@feature@entryhook}{} \let\tocstyle@feature@entryhook\relax \newcommand*{\tocstye@feature@dothook}{} \let\tocstyle@feature@dothook\relax \newcommand*{\tocstye@feature@entryvskip}{} \let\tocstyle@feature@entryvskip\relax \newcommand*{\tocstye@feature@leaders}{} \let\tocstyle@feature@leaders\relax \newcommand*{\tocstye@feature@parfillskip}{} \let\tocstyle@feature@parfillskip\relax \newcommand*{\tocstye@feature@raggedhook}{} \let\tocstyle@feature@raggedhook\relax \newcommand*{\tocstye@feature@spaceafternumber}{} \let\tocstyle@feature@spaceafternumber\relax % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\iftochasdepth} % Uses \Macro{tocstyle@depthlist@}\meta{TOC} to test, if the TOC has the depth % already. % \begin{macrocode} \newcommand*{\iftochasdepth}[2]{% \begingroup \expandafter\let\expandafter\@tempa\csname tocstyle@depthlist@#1\endcsname \ifx\@tempa\relax \aftergroup\@secondoftwo \else \@expandtwoargs\in@{,#2,}{,\@tempa}% \expandafter\aftergroup\ifin@ \@firstoftwo \else \@secondoftwo \fi \fi \endgroup } % \end{macrocode} % \end{macro} % % \subsubsection{Defining Some TOC Styles} % \changes{v0.2e}{2013/08/11}{usage of new font elements of \KOMAScript\space % at \texttt{KOMAlike}} % % \begin{macro}{\ext@toc} % \changes{v0.2i}{2017/02/23}{use indirect extensions} % From version 0.2i the indirect extension for the auxiliary file of the % table of contents is used like the KOMA-Script classes do. % \begin{macrocode} \providecommand*{\ext@toc}{toc} % \end{macrocode} % \end{macro} % % \begin{macrocode} \newtocstyle{standard}{% \settocfeature{dothook}{\normalfont}% \settocfeature[-1]{entryhook}{\bfseries}% \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}% \settocfeature[-1]{leaders}{\hfill}% \settocfeature[0]{entryvskip}{1em\@plus\p@}% \settocfeature[0]{leaders}{\hfill}% \settocfeature[0]{entryhook}{\bfseries} \iftochaschapter\else \settocfeature[1]{entryvskip}{1em\@plus\p@}% \settocfeature[1]{leaders}{\hfill}% \settocfeature[1]{entryhook}{% \ifx\tocstyleAliasTOC\ext@toc\bfseries\fi }% \fi } \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname KOMAClassName\endcsname\relax \newtocstyle{KOMAlike}{% \settocfeature{dothook}{\normalfont}% \settocfeature[-1]{entryhook}{\sffamily\bfseries}% \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}% \settocfeature[-1]{leaders}{\hfill}% \settocfeature[-1]{pagenumberhook}{\sffamily\bfseries}% \settocfeature[0]{entryvskip}{1em\@plus\p@}% \settocfeature[0]{leaders}{\hfill}% \settocfeature[0]{entryhook}{\sffamily\bfseries} \settocfeature[0]{pagenumberhook}{\sffamily\bfseries}% \iftochaschapter\else \settocfeature[1]{entryvskip}{1em\@plus\p@}% \settocfeature[1]{leaders}{\hfill}% \settocfeature[1]{entryhook}{% \ifx\tocstyleAliasTOC\ext@toc\sffamily\bfseries\fi }% \settocfeature[1]{pagenumberhook}{% \ifx\tocstyleAliasTOC\ext@toc\sffamily\bfseries\fi }% \fi } \else \newtocstyle{KOMAlike}{% \settocfeature{dothook}{\normalfont}% \settocfeature[-1]{entryhook}{\usekomafont{partentry}}% \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}% \settocfeature[-1]{leaders}{\hfill}% \settocfeature[-1]{pagenumberhook}{\usekomafont{partentrypagenumber}}% \settocfeature[0]{entryvskip}{1em\@plus\p@}% \settocfeature[0]{leaders}{\hfill}% \settocfeature[0]{entryhook}{\usekomafont{chapterentry}}% \settocfeature[0]{pagenumberhook}{\usekomafont{chapterentrypagenumber}}% \iftochaschapter\else \settocfeature[1]{entryvskip}{1em\@plus\p@}% \settocfeature[1]{leaders}{\hfill}% \settocfeature[1]{entryhook}{% \begingroup \ifx\tocstyleAliasTOC\ext@toc \def\@tempa{\endgroup\usekomafont{sectionentry}}% \else \let\@tempa\endgroup \fi \@tempa }% \settocfeature[1]{pagenumberhook}{% \begingroup \ifx\tocstyleAliasTOC\ext@toc \def\@tempa{\endgroup\usekomafont{sectionentrypagenumber}}% \else \let\@tempa\endgroup \fi \@tempa }% \fi } \fi \newcommand*{\tocstyle@deprecated@style@KOMAScript}{KOMAlike}% \newtocstyle[KOMAlike]{classic}{% \settocfeature[-1]{pagenumberhook}{\normalfont\normalcolor}% \settocfeature[0]{pagenumberhook}{\normalfont\normalcolor}% \iftochaschapter\else \settocfeature[1]{pagenumberhook}{\normalfont\normalcolor}% \fi \settocfeature{pagenumberhook}{\normalfont\normalcolor}% \settocfeature{raggedhook}{\raggedright}% } \newtocstyle[classic][leaders]{allwithdot}{} \newtocstyle[allwithdot]{noonewithdot}{% \settocfeature{leaders}{\hfill}% } \newtocstyle[classic][leaders]{nopagecolumn}{% \settocfeature{leaders}{\quad}% \settocfeature{parfillskip}{\z@ plus 1fil}% \settocfeature{pagenumberbox}{\hbox}% } % \end{macrocode} % % \subsubsection{Defining Some TOC Styles} % % Loading a optional configuration file. % \begin{macrocode} \InputIfFileExists{tocstyle.cfg}{% \PackageInfo{tocstyle}{using tocstyle.cfg}% }{% \PackageInfo{tocstyle}{no tocstyle.cfg found}% } % \end{macrocode} % % \iffalse % % \fi % % \Finale % \endinput % % end of file `tocstyle-obsolete.dtx' %%% Local Variables: %%% mode: doctex %%% TeX-master: t %%% End: