summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/tocstyle.dtx')
-rw-r--r--Master/texmf-dist/source/latex/koma-script/tocstyle.dtx102
1 files changed, 67 insertions, 35 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx b/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx
index 4c38e84a1a6..c124a02b825 100644
--- a/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx
+++ b/Master/texmf-dist/source/latex/koma-script/tocstyle.dtx
@@ -1,8 +1,8 @@
-% \CheckSum{1662}
+% \CheckSum{1667}
% \iffalse meta-comment
% ======================================================================
% tocstyle.dtx
-% Copyright (c) Markus Kohm, 2007-2009
+% Copyright (c) Markus Kohm, 2007-2010
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
@@ -29,7 +29,7 @@
% at least three times.
% ----------------------------------------------------------------------
% tocstyle.dtx
-% Copyright (c) Markus Kohm, 2007-2009
+% Copyright (c) Markus Kohm, 2007-2010
%
% Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets.
%
@@ -104,7 +104,7 @@
\preamble
-Copyright (c) 2007-2009 by Markus Kohm <komascript(at)gmx.info>
+Copyright (c) 2007-2010 by Markus Kohm <komascript(at)gmx.info>
Copyright (c) 1994-2007
Markus Kohm and any individual authors listed elsewhere in this file.
@@ -203,7 +203,7 @@ THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE!
%<driver>\ProvidesFile{tocstyle.drv}
%<doc>\ProvidesFile{tocstyle.tex}
%<*dtx|package|driver|doc>
- [2008/10/20 v0.2c-alpha LaTeX2e KOMA-Script package (versatile toc styles)]
+ [2009/11/09 v0.2d-alpha LaTeX2e KOMA-Script package (versatile toc styles)]
%</dtx|package|driver|doc>
%<*driver>
\documentclass{scrdoc}
@@ -1068,6 +1068,25 @@ usefull to define your own toc styles.
% \end{macrocode}
% \end{macro}
%
+% \begin{option}{chapter}
+% \changes{v3.05}{2009/11/11}{New}
+% \begin{option}{nochapter}
+% \changes{v3.05}{2009/11/11}{New}
+% \begin{macro}{\iftochaschapter}
+% \changes{v3.05}{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.
@@ -1212,27 +1231,29 @@ usefull to define your own toc styles.
% \begin{macrocode}
\parskip \z@ \parindent \z@ \leftskip \z@ \rightskip \z@
\tocstyle@feature@raggedhook
-% \end{macrocode}
+% \end{macrocode}
% Set number indent to \cs{@tempdimb} and text indent to \cs{@tempdima}.
-% \begin{macrocode}
+% \begin{macrocode}
\@tempdima #3\relax
\@tempdimb #2\relax
-%<trace> \typeout{m (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
-% \end{macrocode}
-% Calc auto lengths
+%<trace> \typeout{number indent by \string\l@... (\tocstyleTOC, \tocstyledepth): \space\the\@tempdimb}%
+%<trace> \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@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
- \ifcsname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\@tempdimb
- \csname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \csname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\advance\@tempdimb
- \csname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \csname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname
\fi
\fi
\fi
-%<trace> \typeout{C (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+%<trace> \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
@@ -1252,11 +1273,11 @@ usefull to define your own toc styles.
\@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
\relax
\fi
-%<trace> \typeout{a (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
-%<trace> \typeout{A (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+%<trace> \typeout{text indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+%<trace> \typeout{number indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\else
\@tempdimb #2\relax
-%<trace> \typeout{M (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+%<trace> \typeout{number indent explicite (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\fi
\ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname
\ifdim \@tempdima>
@@ -1274,10 +1295,10 @@ usefull to define your own toc styles.
\@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
\relax
\fi
-%<trace> \typeout{s (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
-%<trace> \typeout{S (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+%<trace> \typeout{text noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+%<trace> \typeout{number noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
\fi
-% \end{macrocode}
+% \end{macrocode}
% Advance instead of set, because of the hook above:
% \begin{macrocode}
\advance\parindent \@tempdimb\@afterindenttrue
@@ -1393,6 +1414,7 @@ usefull to define your own toc styles.
% \subsubsection{Redefining Class Macros}
%
% \begin{macro}{\l@part}
+% \changes{v2.4}{2009/11/11}{part level is always -1}
% \begin{macro}{\l@chapter}
% \begin{macro}{\l@section}
% \begin{macro}{\l@subsection}
@@ -1405,13 +1427,8 @@ usefull to define your own toc styles.
% \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
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@part{\tocstyle@l@define{part}{-1}}{}}%
\fi
\ifcsname l@chapter\endcsname
\setbox\@tempboxa\vbox{\hsize\maxdimen
@@ -1670,9 +1687,27 @@ usefull to define your own toc styles.
% \end{macro}
%
% \begin{macro}{tocstyle@set@width}
+% \changes{v3.05}{2009/11/11}{improve handling of standard classes}
+% 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]{%
- \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#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
}
% \end{macrocode}
% \end{macro}
@@ -2040,8 +2075,7 @@ usefull to define your own toc styles.
\ifx\tocstyleAliasTOC\@tempa\aftergroup\bfseries\fi
\endgroup
}%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname l@chapter\endcsname\relax
+ \iftochaschapter\else
\settocfeature[1]{entryvskip}{1em\@plus\p@}%
\settocfeature[1]{leaders}{\hfill}%
\settocfeature[1]{entryhook}{%
@@ -2067,8 +2101,7 @@ usefull to define your own toc styles.
\ifx\tocstyleAliasTOC\@tempa\aftergroup\sffamily\bfseries\fi
\endgroup
}%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname l@chapter\endcsname\relax
+ \iftochaschapter\else
\settocfeature[1]{entryvskip}{1em\@plus\p@}%
\settocfeature[1]{leaders}{\hfill}%
\settocfeature[1]{entryhook}{%
@@ -2093,8 +2126,7 @@ usefull to define your own toc styles.
\ifx\tocstyleAliasTOC\@tempa\aftergroup\sectfont\fi
\endgroup
}%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname l@chapter\endcsname\relax
+ \iftochaschapter\else
\settocfeature[1]{entryvskip}{1em\@plus\p@}%
\settocfeature[1]{leaders}{\hfill}%
\settocfeature[1]{entryhook}{%