diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/tocstyle.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/tocstyle.dtx | 1931 |
1 files changed, 1931 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx b/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx new file mode 100644 index 00000000000..d42327d2899 --- /dev/null +++ b/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx @@ -0,0 +1,1931 @@ +% \CheckSum{1629} +% \iffalse meta-comment +% ====================================================================== +% tocstyle.dtx +% Copyright (c) Markus Kohm, 2007 +% +% This file is part of the LaTeX2e KOMA-Script bundle. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3b of the license. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3b or later is part of all distributions of LaTeX +% version 2005/12/01 and of this work. +% +% This work has the LPPL maintenance status "author-maintained". +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% The KOMA-Script bundle consists of all files listed in manifest.txt. +% The work `tocstyle' consists of the files `tocstyle.dtx' and +% `scrlogo.dtx'. +% +% If you're missing the installation batch file `tocstyle.ins', try +% tex tocstyle.dtx +% to unpack all files. +% The package documentation may be produced repeating +% latex tocstyle.dtx +% at least three times. +% ---------------------------------------------------------------------- +% tocstyle.dtx +% Copyright (c) Markus Kohm, 2007 +% +% Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets. +% +% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, +% Version 1.3b. +% Die neuste Version dieser Lizenz ist +% http://www.latex-project.org/lppl.txt +% und Version 1.3b ist Teil aller Verteilungen von LaTeX +% Version 2005/12/01 und dieses Werks. +% +% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained" +% (allein durch den Autor verwaltet). +% +% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm. +% +% Das KOMA-Script-Paket besteht aus allen Dateien, die in manifest.txt +% genannt sind. +% Das Werk `tocstyle' besteht aus den Dateien `tocstyle.dtx' und +% `scrlogo.dtx'. +% +% Falls Sie die Installations-Batch-Datei `tocstyle.ins' vermissen, +% probieren Sie einfach einmal +% tex tocstyle.dtx +% um alle Dateien auszupacken. Zur englischen Anleitung siehe den +% englischen Kommentar oben. +% ====================================================================== +% \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: tocstyle.dtx +%<*dtx> +% \fi +\def\LaTeXformat{LaTeX2e} +\let\ifbeta=\iffalse +\ifx\fmtname\LaTeXformat\else +% \iffalse +%</dtx> +%<*insfile> +% \fi +\def\batchfile{tocstyle.dtx} +\input docstrip.tex +\ifToplevel{% + \Msg{**********************************************************************} + \Msg{*} + \Msg{* KOMA-Script presents tocstyle} + \Msg{* a package to define, configure and several different styles for} + \Msg{* table of contents, list of floats and comparables.} + \Msg{*} + \Msg{* This is `\batchfile', a batchfile to unpack the package tocstyle,} + \Msg{* the documentation of the package, and an archive of all these files.} + \Msg{*} + \Msg{**********************************************************************} + \keepsilent + \askforoverwritefalse +} + +\preamble + +Copyright (c) 2007 by Markus Kohm <komascript(at)gmx.info> + +Copyright (c) 1994-2007 +Markus Kohm and any individual authors listed elsewhere in this file. + +This file was generated from file(s) of the KOMA-Script bundle. +--------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, version 1.3b of the license. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3b or later is part of all distributions of LaTeX +version 2005/12/01 or later and of this work. + +This work has the LPPL maintenance status "author-maintained". + +The Current Maintainer and author of this work is Markus Kohm. + +This file may only be distributed together with the file +`tocstyle.dtx' and `scrlogo.dtx'. You may however distribute the files +`tocstyle.dtx' and `scrlogo.dtx' without this file. + +If this file is a beta version, you are not allowed to distribute it. + +English and German manuals are part of KOMA-Script bundle. +---------------------------------------------------------- + +The english manual is at `tocstyle.dtx', too. + +The KOMA-Script bundle (but not this file) was based upon the LaTeX2.09 +Script family created by Frank Neukam 1993 and the LaTeX2e standard +classes created by The LaTeX3 Project 1994-1996. + +THIS IS AN ALPHA VERSION! +USAGE OF THIS VERSION IS ON YOUR OWN RISK! +EVERYTHING MAY HAPPEN! +EVERYTHING MAY CHANGE IN FUTURE! +THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE! + +\endpreamble + +\generate{\usepreamble\defaultpreamble + \file{tocstyle.sty}{% + \ifbeta\from{scrbeta.dtx}{package,tocstyle}\fi + \from{tocstyle.dtx}{package,trace,tocstyle}% + \from{scrlogo.dtx}{logo}% + }% +} + +\ifToplevel{% + \generate{\usepreamble\defaultpreamble + \file{tocstyle.ins}{% + \from{tocstyle.dtx}{insfile}% + }% + \file{tocstyle.tex}{% + \from{tocstyle.dtx}{doc}% + }% + \file{tocstyle.drv}{% + \from{tocstyle.dtx}{driver}% + }% + }% +} + +\ifToplevel{% + \Msg{**********************************************************************} + \Msg{*} + \ifbeta + \Msg{* THIS IS A BETA VERSION. YOU SHOULD NOT INSTALL OR USE IT!} + \Msg{* THERE MAY BE A LOT OF BUGS AT THIS VERSION!} + \Msg{* PLEASE INSTALL THE RELEASE YOU MAY FIND AT CTAN!} + \else + \Msg{* To finish the installation you have to copy the file `tocstyle.sty'} + \Msg{* to folder `tex/latex/tocstyle/' of one of your TEXMF trees.} + \Msg{* You should also produce the documentation using} + \Msg{*\space\space latex tocstyle.dtx} + \Msg{* and copy it to folder `doc/latex/tocstyle/' of one of your} + \Msg{* TEXMF trees.} + \Msg{*} + \Msg{* See the manual of your TeX distribution for more informations about} + \Msg{* package installation.} + \fi + \Msg{*} + \Msg{**********************************************************************} +} +% \iffalse +%</insfile> +%<*dtx> +% \fi + \def\ProvidesFile{\csname fi\endcsname\csname endinput\endcsname} +\fi +\ProvidesFile{tocstyle.dtx} +% \iffalse +%</dtx> +%<package|driver>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<package>\ProvidesPackage{tocstyle} +%<driver>\ProvidesFile{tocstyle.drv} +%<doc>\ProvidesFile{tocstyle.tex} +%<*dtx|package|driver|doc> + [2007/12/21 v0.2alpha LaTeX2e KOMA-Script package (versatile toc styles)] +%</dtx|package|driver|doc> +%<*driver> +\documentclass{scrdoc} +\usepackage[ngerman,english]{babel} +\usepackage{tocstyle} +\usetocstyle[toc]{nopagecolumn} +\CodelineIndex +\RecordChanges +\GetFileInfo{tocstyle.dtx} +\title{The \KOMAScript{} package \texttt{tocstyle}% + \footnote{This is version \fileversion\ of file \texttt{\filename}.}} +\date{\filedate} +\author{Markus Kohm} + +\newenvironment{Explain}{\par}{\par} +\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} +%</driver> +% \fi +% +% \selectlanguage{english} +% +% \changes{v0.1}{2007/06/23}{start of new package} +% +%\iffalse +%<doc>\chapter{Other Styles for Table of Contents and Lists of Floats} +%<doc>\labelbase{tocstyle} +%<doc>\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} will fill the gap. If it conflicts with another package, +you simply may decide not to use it. +%\iffalse +%</doc> +%\fi +% \end{abstract} +% +% \def\appendixtocdepth{\value{tocdepth}} +% \tableofcontents +% \def\appendixtocdepth{2} +% +%\iffalse +%<*doc> +%\fi +% +\section{How It Works} +\label{sec:tocstyle.howitworks} + +\begin{Explain} + 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. +\end{Explain} + +\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} +%</doc> +%<*dtx> +%\fi +\DescribeMacro{tocindentauto} +\DescribeMacro{tocindentmanual} +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{tocgraduated} +\DescribeMacro{tocflat} +\DescribeMacro{tocfullflat} +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{tocbreaksstrict} +\DescribeMacro{tocbreakscareless} +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{toctextentriesindented} +\DescribeMacro{toctextentriesleft} +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{\usetocstyle} +%\iffalse +%</dtx> +%<*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{KOMAScript}{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{KOMAScript} 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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{\deactivatetocstyle}\DescribeMacro{\reactivatetocstyle} +Both commands have one optional argument \PName{TOC}. +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*dtx> +%\fi +\DescribeMacro{\settocfeature} +\DescribeMacro{\settocstylefeature} +%\iffalse +%</dtx> +%<*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}% +%</doc> +%<*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 +%</dtx> +%<*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 \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 +\BeginIndex{Macro}{\newtocstyle}% +%\fi +% +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 +%</doc> +%\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{KOMAScript} with Option \Option{tocgraduated}} +% \usetocstyle[toc]{KOMAScript} +% \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{KOMAScript} with Option \Option{tocflat}} +% \usetocstyle[toc]{KOMAScript} +% \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{KOMAScript} with Option \Option{tocfullflat}} +% \usetocstyle[toc]{KOMAScript} +% \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 AN ALPHA VERSION!\MessageBreak + USAGE OF THIS VERSION IS ON YOUR OWN RISK!\MessageBreak + EVERYTHING MAY HAPPEN!\MessageBreak + EVERYTHING MAY CHANGE IN FUTURE!\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}{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 + \if@tocleft + \PackageWarningNoLine{tocstyle}{% + You should not use class option `tocleft'!\MessageBreak + This may result in errors or unexpected results.\MessageBreak + I'll try to deactivate `tocleft', now.\MessageBreak + You may use options `tocflat' and\MessageBreak + `tocindentauto' instead of `tocleft'}% + \csname @tocleftfalse\endcsname + \fi +\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} +% 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 +%<trace> \typeout{m (\tocstyleTOC, \tocstyledepth): \the\@tempdima}% +% \end{macrocode} +% Calc auto lengths +% \begin{macrocode} + \ifnum #1>\z@\relax + \@tempcnta #1\relax \advance\@tempcnta \m@ne + \ifcsname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname + \ifcsname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname + \@tempdimb + \csname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname + \advance\@tempdimb + \csname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname + \fi + \fi + \fi +%<trace> \typeout{C (\tocstyleTOC, \tocstyledepth): \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 +%<trace> \typeout{a (\tocstyleTOC, \tocstyledepth): \the\@tempdima}% +%<trace> \typeout{A (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}% + \else + \@tempdimb #2\relax +%<trace> \typeout{M (\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 +%<trace> \typeout{s (\tocstyleTOC, \tocstyledepth): \the\@tempdima}% +%<trace> \typeout{S (\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}% + \else + \tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5}% + \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} +% \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. +% \begin{macrocode} +\AtBeginDocument{% + \ifcsname l@part\endcsname + \ifcsname l@chapter\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@part{\tocstyle@l@define{part}{-1}}{}}% + \else + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@part{\tocstyle@l@define{part}{0}}{}}% + \fi + \fi + \ifcsname l@chapter\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@chapter{\tocstyle@l@define{chapter}{0}}{}}% + \fi + \ifcsname l@section\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@section{\tocstyle@l@define{section}{1}}{}}% + \fi + \ifcsname l@subsection\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@subsection{\tocstyle@l@define{subsection}{2}}{}}% + \fi + \ifcsname l@subsubsection\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@subsubsection{\tocstyle@l@define{subsubsection}{3}}{}}% + \fi + \ifcsname l@paragraph\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@paragraph{\tocstyle@l@define{paragraph}{4}}{}}% + \fi + \ifcsname l@subparagraph\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@subparagraph{\tocstyle@l@define{subparagraph}{5}}{}}% + \fi + \ifcsname l@table\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@table{\tocstyle@l@define{table}{1}}{}}% + \fi + \ifcsname l@figure\endcsname + \setbox\@tempboxa\vbox{\hsize\maxdimen + \l@figure{\tocstyle@l@define{figure}{1}}{}}% + \fi +% \end{macrocode} +% \begin{macro}{\@dottedtocline} +% 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 + \tocstyle@macrochangewarning\@dottedtocline + \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 +% While \LaTeX{} does not close the files, we have to do it know. + \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} +% \begin{macrocode} +\newcommand*{\tocstyle@set@width}[4]{% + \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#4}% +} +% \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][]{% + \@ifnextchar[ {\@@settocfeature[{#1}]}{\@@settocfeature[{#1}][]} +} +\def\@@settocfeature[#1][#2]#3#4{% +%<trace> \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}{% + \@ifnextchar[ {\@settocfeature[]}{\@settocfeature[][]}% +} +\newcommand*{\settocstylefeature}{} +\let\settocstylefeature\@settocstylefeature +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Different commands will be defined: +% \begin{macro}{\tocstyle@feature@<feature>@@} +% Global feature (all TOCs all depths). +% \end{macro} +% \begin{macro}{\tocstyle@feature@<feature>@<TOC>@} +% All depth feature for one TOC. +% \end{macro} +% \begin{macro}{\tocstyle@feature@<feature>@@<depth>} +% All TOCs feature for one depth. +% \end{macro} +% \begin{macro}{\tocstyle@feature@<feature>@<TOC>@<depth>} +% 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}{% + \@ifnextchar [{\@newtocstyle}{\@newtocstyle[]}} +\newcommand*{\@newtocstyle}{} +\def\@newtocstyle[#1]{% + \@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} +% Use the predefined TOC style. +% \begin{macrocode} +\newcommand*{\usetocstyle}[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{% + \@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 + }% +} +\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} +% +% \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}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\bfseries\fi + \endgroup + }% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname l@chapter\endcsname\relax + \settocfeature[1]{entryvskip}{1em\@plus\p@}% + \settocfeature[1]{leaders}{\hfill}% + \settocfeature[1]{entryhook}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\bfseries\fi + \endgroup + }% + \fi +} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname sectfont\endcsname\relax + \newtocstyle{KOMAScript}{% + \settocfeature{dothook}{\normalfont}% + \settocfeature[-1]{entryhook}{\sffamily\bfseries}% + \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}% + \settocfeature[0]{entryvskip}{1em\@plus\p@}% + \settocfeature[0]{leaders}{\hfill}% + \settocfeature[0]{entryhook}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\sffamily\bfseries\fi + \endgroup + }% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname l@chapter\endcsname\relax + \settocfeature[1]{entryvskip}{1em\@plus\p@}% + \settocfeature[1]{leaders}{\hfill}% + \settocfeature[1]{entryhook}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\sffamily\bfseries\fi + \endgroup + }% + \fi + } +\else + \newtocstyle{KOMAScript}{% + \settocfeature{dothook}{\normalfont}% + \settocfeature[-1]{entryhook}{\sectfont}% + \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}% + \settocfeature[0]{entryvskip}{1em\@plus\p@}% + \settocfeature[0]{leaders}{\hfill}% + \settocfeature[0]{entryhook}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\sectfont\fi + \endgroup + }% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname l@chapter\endcsname\relax + \settocfeature[1]{entryvskip}{1em\@plus\p@}% + \settocfeature[1]{leaders}{\hfill}% + \settocfeature[1]{entryhook}{% + \begingroup + \edef\@tempa{toc}% + \ifx\tocstyleAliasTOC\@tempa\aftergroup\sectfont\fi + \endgroup + }% + \fi + } +\fi +\newtocstyle[KOMAScript]{classic}{% + \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 +%</package> +% \fi +% +% \Finale +% +\endinput +% +% end of file `tocstyle.dtx' +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: |