summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-11-30 23:32:59 +0000
committerKarl Berry <karl@freefriends.org>2012-11-30 23:32:59 +0000
commit76def1765b0dafeba9f05e03b8ae3d89bf3b234d (patch)
tree87e4ec527e00930053fb3eea6e3ad7f3429c2bc2 /Master/texmf-dist/tex
parent1940e85fb00c285d08ff92d6f58559f87aba6cd6 (diff)
etoc (30nov12)
git-svn-id: svn://tug.org/texlive/trunk@28397 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/etoc/etoc.sty476
1 files changed, 334 insertions, 142 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty
index c54f5c95a62..0fbedff0f51 100644
--- a/Master/texmf-dist/tex/latex/etoc/etoc.sty
+++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
\ProvidesPackage{etoc}
- [2012/11/24 v1.04 easily customizable TOCs (jfB)]
+ [2012/11/28 v1.05 easily customizable TOCs (jfB)]
%% Package `etoc' by Jean-Francois Burnol
%% Copyright (C) 2012 by Jean-Francois Burnol
\NeedsTeXFormat{LaTeX2e}
@@ -31,6 +31,7 @@
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
\newtoks\Etoc@toctoks
+\newif\ifEtoc@jj % book
\newif\ifEtoc@j % part
\newif\ifEtoc@ % chapter
\newif\ifEtoc@i % section
@@ -40,7 +41,7 @@
\newif\ifEtoc@v % subparagraph
\newif\ifEtoc@number
\newif\ifEtoc@hyperref
-\newif\ifEtoc@star
+\newif\ifEtoc@tocwithid
\newif\ifEtoc@standard
\newif\ifEtoc@part
\newif\ifEtoc@localtoc
@@ -49,15 +50,18 @@
\newif\ifEtoc@notactive
\newcounter{etoc@tocid}
\newif\ifEtoc@mustclosegroup
+\@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}}
+\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m@ne
\chardef\Etoc@@zero@@\z@
\chardef\Etoc@@one@@\@ne
\chardef\Etoc@@two@@\tw@
\chardef\Etoc@@three@@\thr@@
-\chardef\Etoc@@four@@4\relax
-\chardef\Etoc@@five@@5\relax
-\chardef\Etoc@@six@@6\relax
-\let\Etoc@localtop\m@ne
+\chardef\Etoc@@four@@ 4
+\chardef\Etoc@@five@@ 5
+\chardef\Etoc@@six@@ 6
+\let\Etoc@localtop\Etoc@@minustwo@@
+\def\Etoc@@minustwo@{minustwo}
\def\Etoc@@minusone@{minusone}
\def\Etoc@@zero@{zero}
\def\Etoc@@one@{one}
@@ -77,13 +81,14 @@
\Etoc@Lazarus@eltb#2}}
\def\etocsetlevel#1#2{%
\let\Etoc@next\@firstofone
- \ifcase#2\or\or\or\or\or\else\ifnum#2=\m@ne\else
+ \ifcase#2\or\or\or\or\or
+ \else\ifnum#2=\m@ne\else\ifnum#2=-\tw@\else
\PackageWarning{etoc}
{unexpected value `#2' in \string\etocsetlevel.^^J%
- Should be -1, 0, 1, 2, 3, 4 or 5. Set to -1}%
+ Should be -2,-1, 0, 1, 2, 3, 4 or 5. Set to -1}%
\expandafter\def\csname Etoc@#1@\endcsname{minusone}%
\expandafter\let\csname Etoc@#1@@\endcsname\m@ne
- \let\Etoc@next\@gobble\fi\fi
+ \let\Etoc@next\@gobble\fi\fi\fi
\if@noskipsec
\else
\expandafter\expandafter\expandafter
@@ -114,9 +119,15 @@
\expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@five@@
\expandafter\def \csname Etoc@#1@\endcsname{five}%
\else
+ \ifnum#2=\m@ne
\expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minusone@@
\expandafter\def \csname Etoc@#1@\endcsname{minusone}%
+ \else
+ \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@
+ \expandafter\def \csname Etoc@#1@\endcsname{minustwo}%
+ \fi
\fi}}
+\etocsetlevel{book}{-2}
\etocsetlevel{part}{-1}
\etocsetlevel{chapter}{0}
\etocsetlevel{section}{1}
@@ -172,6 +183,7 @@
\or
\global\Etoc@vtrue
\else
+ \ifnum#1=\m@ne
\global\Etoc@vfalse
\global\Etoc@ivfalse
\global\Etoc@iiifalse
@@ -179,6 +191,16 @@
\global\Etoc@ifalse
\global\Etoc@false
\global\Etoc@jtrue
+ \else
+ \global\Etoc@vfalse
+ \global\Etoc@ivfalse
+ \global\Etoc@iiifalse
+ \global\Etoc@iifalse
+ \global\Etoc@ifalse
+ \global\Etoc@false
+ \global\Etoc@jfalse
+ \global\Etoc@jjtrue
+ \fi
\fi}
\def\Etoc@etoccontentsline#1{%
\global\expandafter\let\expandafter\Etoc@tmp\csname Etoc@#1@@\endcsname
@@ -247,6 +269,7 @@
\gdef\Etoc@contents{\Etoc@contents@five}%
\gdef\Etoc@prefix{\Etoc@prefix@five}%
\else
+ \ifnum\Etoc@tmp=\m@ne
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \Etoc@end@four\fi
\ifEtoc@iii \Etoc@end@three\fi
@@ -257,6 +280,18 @@
\global\Etoc@parttrue
\gdef\Etoc@contents{\Etoc@contents@minusone}%
\gdef\Etoc@prefix{\Etoc@prefix@minusone}%
+ \else
+ \ifEtoc@v \Etoc@end@five\fi
+ \ifEtoc@iv \Etoc@end@four\fi
+ \ifEtoc@iii \Etoc@end@three\fi
+ \ifEtoc@ii \Etoc@end@two\fi
+ \ifEtoc@i \Etoc@end@one\fi
+ \ifEtoc@ \Etoc@end@zero\fi
+ \ifEtoc@j \Etoc@end@minusone\fi
+ \ifEtoc@jj \else \def\Etoc@next{\Etoc@begin@minustwo}\fi
+ \gdef\Etoc@contents{\Etoc@contents@minustwo}%
+ \gdef\Etoc@prefix{\Etoc@prefix@minustwo}%
+ \fi
\fi
\Etoc@setflags{\Etoc@tmp}%
\fi\fi
@@ -298,7 +333,7 @@
\Etoc@getname #3\etoc@\fi}
\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@{%
\def\Etoc@getname ##1\hspace\relax\etoc@{%
- \global\@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5}\xspace}%
+ \global\@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}}%
\def\Etoc@getnbr ##1\hspace##2##3\etoc@{%
\ifx\relax##2\else
\global\@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5\xspace}%
@@ -329,7 +364,6 @@
\def\Etoc@starttoc{%
\begingroup
\makeatletter
-\chardef\ET@endline\endlinechar
\@ifpackageloaded{hyperref}
{\ifx\hyper@last\@undefined
\ltx@ifpackageloaded {parskip}{\parskip \z@ }{}%
@@ -343,10 +377,9 @@
\Etoc@readtoc\Etoc@tf
\closein\Etoc@tf}
{\typeout{No file \jobname .toc.}}}%
-\endlinechar\ET@endline
\if@filesw \newwrite \tf@toc \immediate
\openout \tf@toc \jobname .toc\relax \fi
-\endgroup}
+\@nobreakfalse \endgroup}
\AtBeginDocument{\Etoc@starttoc}
\def\Etoc@toctoc{%
\global\Etoc@vfalse
@@ -356,17 +389,22 @@
\global\Etoc@ifalse
\global\Etoc@false
\global\Etoc@jfalse
+ \global\Etoc@jjfalse
\ifEtoc@standard
\Etoc@Lazarus
-\etocsetstyle{@minusone}{}{}{}{}%
-\etocsetstyle{@zero}{}{}{}{}%
-\etocsetstyle{@one}{}{}{}{}%
-\etocsetstyle{@two}{}{}{}{}%
-\etocsetstyle{@three}{}{}{}{}%
-\etocsetstyle{@four}{}{}{}{}%
-\etocsetstyle{@five}{}{}{}{}%
+\etoc@setstyle{@minustwo}{}{}{}{}%
+\etoc@setstyle{@minusone}{}{}{}{}%
+\etoc@setstyle{@zero}{}{}{}{}%
+\etoc@setstyle{@one}{}{}{}{}%
+\etoc@setstyle{@two}{}{}{}{}%
+\etoc@setstyle{@three}{}{}{}{}%
+\etoc@setstyle{@four}{}{}{}{}%
+\etoc@setstyle{@five}{}{}{}{}%
\else
\let\numberline\@gobble
+\let\booknumberline\numberline
+\let\partnumberline\numberline
+\let\chapternumberline\numberline
\fi
\the\Etoc@toctoks
\ifEtoc@notactive\else
@@ -377,12 +415,14 @@
\ifEtoc@i \Etoc@end@one\fi
\ifEtoc@ \Etoc@end@zero\fi
\ifEtoc@j \Etoc@end@minusone\fi
+ \ifEtoc@jj \Etoc@end@minustwo\fi
\fi}
\def\etoc@@startlocaltoc#1#2{%
\let\Etoc@next\relax
\ifEtoc@localtoc
\ifEtoc@notactive
\ifnum #1=#2\relax
+ \ifEtoc@jj \global\let\Etoc@localtop\Etoc@@minusone@@ \fi
\ifEtoc@j \global\let\Etoc@localtop\Etoc@@zero@@ \fi
\ifEtoc@ \global\let\Etoc@localtop\Etoc@@one@@ \fi
\ifEtoc@i \global\let\Etoc@localtop\Etoc@@two@@ \fi
@@ -397,18 +437,12 @@
\global\Etoc@iifalse
\global\Etoc@ifalse
\global\Etoc@false
- \global\Etoc@jfalse}%
+ \global\Etoc@jfalse
+ \global\Etoc@jjfalse}%
\fi
\fi\fi
\Etoc@next}
\def\etoc@startlocaltoc#1{\etoc@@startlocaltoc{#1}{\c@etoc@tocid}}
-\def\Etoc@getrefno #1#2\etoc@{#1}
-\def\Etoc@getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter
- \Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}}
-\def\Etoc@ref#1{\Etoc@localtableofcontents{\Etoc@getref{#1}}}
-\def\Etoc@label#1{\label{#1}\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
-{\def\1{\Etoc@again}\expandafter
-\gdef\1 {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}}
\long\def\Etoc@localtableofcontents#1{%
\edef\Etoc@tmp{#1}%
\ifnum\Etoc@tmp<\@ne
@@ -421,18 +455,27 @@
\edef\etoc@startlocaltoc##1{%
\noexpand\etoc@@startlocaltoc{##1}{#1}}
\Etoc@localtoctrue
- \let\Etoc@localtop\m@ne
- \Etoc@stoptocfalse
+ \let\Etoc@localtop\Etoc@@minustwo@@
+ \global\Etoc@stoptocfalse
\global\Etoc@notactivetrue
\Etoc@tableofcontents
\endgroup}%
\ifEtoc@mustclosegroup\expandafter\endgroup\fi}
+\def\Etoc@getrefno #1#2\etoc@{#1}
+\def\Etoc@getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter
+ \Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}}
+\def\Etoc@ref#1{\Etoc@localtableofcontents{\Etoc@getref{#1}}}
+\def\Etoc@label#1{\label{#1}\ifEtoc@tocwithid\else\addtocontents{toc}
+ {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}\fi
+ \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
+{\def\1{\Etoc@again}\expandafter
+\gdef\1 {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}}
\def\Etoc@t@bleofcontents{%
\ifx\Etoc@nexttoken\label
\def\Etoc@next{\expandafter\Etoc@label\@gobble}\else
\ifx\Etoc@nexttoken\@sptoken
\let\Etoc@next\Etoc@again\else
- \ifEtoc@star
+ \ifEtoc@tocwithid
\def\Etoc@next{\Etoc@localtableofcontents{\c@etoc@tocid}}%
\else
\ifx\Etoc@nexttoken\ref
@@ -445,20 +488,30 @@
\endgroup}%
\fi
\fi\fi\fi\Etoc@next}
-\def\tableofcontents{\par
- \refstepcounter{etoc@tocid}%
- \@ifstar {\addtocontents{toc}
- {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}%
- \Etoc@startrue
- \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
- {\Etoc@starfalse
- \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}}
+\newcommand\etocaftertitlehook{}
+\def\table@fcontents{\par
+ \refstepcounter{etoc@tocid}%
+ \Etoc@tocwithidfalse
+ \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
+\def\localtable@fcontents{\par
+ \refstepcounter{etoc@tocid}%
+ \addtocontents{toc}
+ {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}%
+ \Etoc@tocwithidtrue
+ \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
+\def\tableofcontents{\@ifstar
+ {\let\Etoc@aftertitlehook\relax\table@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
+\def\localtableofcontents{\@ifstar
+ {\let\Etoc@aftertitlehook\relax\localtable@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
\newcommand\etocsettocstyle[2]{%
\long\def\Etoc@tableofcontents
-{\ifnum\c@tocdepth>-2\let\Etoc@@next\@firstofone\else
+{\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else
\let\Etoc@@next\@gobble\fi
-\Etoc@@next{#1\Etoc@toctoc\let\Etoc@n@xt\relax
- \ifEtoc@star\else
+\Etoc@@next{#1\Etoc@aftertitlehook
+ \Etoc@toctoc\let\Etoc@n@xt\relax
+ \ifEtoc@tocwithid\else
\ifEtoc@localtoc
\ifEtoc@notactive
\def\Etoc@n@xt{\Etoc@localtocfalse
@@ -466,7 +519,12 @@
\Etoc@toctoc}%
\fi\fi\fi\Etoc@n@xt
#2}}}
-\newcommand\etocsetstyle[5]{%
+\newcommand\etocextendtocstyle[2]{%
+\toks0=\expandafter{\Etoc@tableofcontents #2}%
+\toks2={#1}%
+\long\edef\Etoc@tableofcontents{\the\toks2 \the\toks0}}
+\newcommand\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
+\long\def\etoc@setstyle#1#2#3#4#5{%
\long\expandafter\def
\csname Etoc@begin@\csname Etoc@#1@\endcsname\endcsname {#2}%
\long\expandafter\def
@@ -475,43 +533,62 @@
\csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname {#4}%
\long\expandafter\def
\csname Etoc@end@\csname Etoc@#1@\endcsname\endcsname {#5}}
-\def\etocstandardlines{\Etoc@standardtrue}
+\newcommand\etocfontminustwo{\normalfont \LARGE \bfseries}
\newcommand\etocfontminusone{\normalfont \large \bfseries}
-\newcommand\etocfontzero{\normalfont \normalsize \bfseries}
+\newcommand\etocfontzero{\normalfont \large \bfseries}
\newcommand\etocfontone{\normalfont \normalsize \bfseries}
\newcommand\etocfonttwo{\normalfont \normalsize}
\newcommand\etocfontthree{\normalfont \footnotesize}
\newcommand\etocfontfour{\normalfont \footnotesize}
\newcommand\etocfontfive{\normalfont \footnotesize}
+\newcommand\etocsepminustwo{4ex \@plus .5ex \@minus .5ex}
\newcommand\etocsepminusone{4ex \@plus .5ex \@minus .5ex}
\newcommand\etocsepzero{2.5ex \@plus .4ex \@minus .4ex}
\newcommand\etocsepone{1.5ex \@plus .3ex \@minus .3ex}
\newcommand\etocseptwo{1ex \@plus .15ex \@minus .15ex}
\newcommand\etocsepthree{.25ex \@plus .05ex \@minus .05ex}
+\newcommand\etocbaselinespreadminustwo{1}
\newcommand\etocbaselinespreadminusone{1}
\newcommand\etocbaselinespreadzero{1}
\newcommand\etocbaselinespreadone{1}
\newcommand\etocbaselinespreadtwo{1}
\newcommand\etocbaselinespreadthree{.9}
-\newcommand\etocminusonelrmargins{1em}
+\newcommand\etocminustwoleftmargin{1.5em plus 0.5fil}
+\newcommand\etocminustworightmargin{1.5em plus -0.5fil}
+\newcommand\etocminusoneleftmargin{1em}
+\newcommand\etocminusonerightmargin{1em}
\newcommand\etoctoclineleaders
-{\hbox{\normalfont\normalsize\hbox to 2ex {\hss.\hss}}}
+ {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}}
\newcommand\etocabbrevpagename{p.~}
-\def\etocetoclines{\Etoc@standardfalse
-\etocsetstyle{@minusone}{\addpenalty\@highpenalty}{}
+\newcommand\etocpartname{\partname}
+\newcommand\etocbookname{Book}
+\def\etoctoclines{\Etoc@standardfalse
+\etoc@setstyle{@minustwo}{\etocskipfirstprefix}{\pagebreak[3]}
+{\begingroup \etocfontminustwo
+ \addvspace{\etocsepminustwo}%
+ \parindent \z@
+ \leftskip \etocminustwoleftmargin
+ \rightskip \etocminustworightmargin
+ \parfillskip \@flushglue
+ \vbox{\etocifnumbered{\etocbookname~\etocnumber:~}{}\etocname
+ \baselineskip\etocbaselinespreadminustwo\baselineskip\par}%
+ \addvspace{\etocsepminusone}\nobreak
+\endgroup}
+{}%
+\etoc@setstyle{@minusone}{\etocskipfirstprefix}{\pagebreak[3]}
{\begingroup \etocfontminusone
\addvspace{\etocsepminusone}%
\parindent \z@
- \leftskip \etocminusonelrmargins
- \rightskip \etocminusonelrmargins
+ \leftskip \etocminusoneleftmargin
+ \rightskip \etocminusonerightmargin
\parfillskip \@flushglue
- \vbox{\etocifnumbered{\etocnumber.~}{}\etocname
+ \vbox{\etocpartname\etocifnumbered{ \etocnumber.~}{ }\etocname
\baselineskip\etocbaselinespreadminusone\baselineskip\par}%
\addvspace{\etocsepzero}\nobreak
\endgroup}
-{\addpenalty\@secpenalty}%
-\etocsetstyle{@zero}
-{\addpenalty\@highpenalty}{}
+{}%
+\etoc@setstyle{@zero}
+{\addpenalty\@highpenalty\etocskipfirstprefix}{\pagebreak[2]}
{\begingroup
\etocfontzero
\addvspace{\etocsepzero}%
@@ -521,9 +598,8 @@
\addvspace{\etocsepone}\addpenalty\@itempenalty
\endgroup}
{\addpenalty\@secpenalty}%
-\etocsetstyle{@one}
-{\addpenalty\@medpenalty}
-{}
+\etoc@setstyle{@one}
+{\addpenalty\@medpenalty\etocskipfirstprefix}{\pagebreak[1]}
{\begingroup\etocfontone
\addvspace{\etocsepone}%
\parindent \z@ \parfillskip \z@
@@ -534,8 +610,8 @@
\setbox\z@=\etoctoclineleaders
\advance\dimen\z@\wd\z@
\etocifnumbered
-{\setbox\tw@\hbox{\etocfonttwo\etocnumber, \etocabbrevpagename\etocpage}}
-{\setbox\tw@\hbox{\etocfonttwo\etocabbrevpagename\etocpage}}%
+{\setbox\tw@\hbox{\etocnumber, \etocabbrevpagename\etocpage}}
+{\setbox\tw@\hbox{\etocabbrevpagename\etocpage}}%
\advance\dimen\z@\wd\tw@
\ifdim\dimen\z@ < \linewidth
\vbox{\etocname\nobreak
@@ -550,9 +626,9 @@
\addvspace{\etocseptwo}\addpenalty\@itempenalty
\endgroup}
{\addpenalty\@secpenalty}%
-\etocsetstyle{@two}
-{\addpenalty\@medpenalty}
-{}
+\etoc@setstyle{@two}
+{\addpenalty\@medpenalty\etocskipfirstprefix}
+{\pagebreak[1]}
{\begingroup\etocfonttwo
\addvspace{\etocseptwo}%
\parindent \z@ \parfillskip \z@
@@ -579,51 +655,29 @@
\addvspace{\etocsepthree}\addpenalty\@itempenalty
\endgroup}
{\addpenalty\@secpenalty}%
-\etocsetstyle{@three}
-{\nobreak
+\etoc@setstyle{@three}
+{\nopagebreak
\etocfontthree
\addvspace{\etocsepthree}%
\nointerlineskip\noindent
\etocskipfirstprefix}
{\allowbreak\,--\,}
-{\etocname}
-{\unskip.\hfil\begingroup
+{\etocname\unskip} % \xspace in \etocname
+{.\hfil\begingroup
\baselineskip\etocbaselinespreadthree\baselineskip
\par\endgroup
\addpenalty{-\@highpenalty}}%
-\etocsetstyle{@four}{}{}{}{}%
-\etocsetstyle{@five}{}{}{}{}%
+\etoc@setstyle{@four}{}{}{}{}%
+\etoc@setstyle{@five}{}{}{}{}%
}
-\newcommand\etocmarkboth[1][\contentsname]{%
- \@mkboth {\MakeUppercase #1}
- {\MakeUppercase #1}}
-\def\etoc@article@tochead#1{\section *{#1\@mkboth
- {\MakeUppercase{#1}}
- {\MakeUppercase{#1}}}}
-\def\etoc@article@tochead@nomarks#1{\section *{#1}}
-\def\etoc@book@tochead#1{\chapter *{#1\@mkboth
- {\MakeUppercase{#1}}
- {\MakeUppercase{#1}}}}
-\def\etoc@book@tochead@nomarks#1{\chapter *{#1}}
-\let\etoc@standard@tochead\etoc@article@tochead
-\let\etoc@standard@tochead@nomarks\etoc@article@tochead@nomarks
-\@ifclassloaded{book}{%
-\let\etoc@standard@tochead\etoc@book@tochead
-\let\etoc@standard@tochead@nomarks\etoc@book@tochead@nomarks}{}
-\@ifclassloaded{report}{%
-\let\etoc@standard@tochead\etoc@book@tochead
-\let\etoc@standard@tochead@nomarks\etoc@book@tochead@nomarks}{}
-\newcommand\etocstandardheading[1]{%
-\etoc@standard@tochead{#1}}
-\newcommand\etocstandardheadingnomarks[1]{%
-\etoc@standard@tochead@nomarks{#1}}
\newcommand\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
\newcommand\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
\newcommand\etoccolumnsep{2em}
\newcommand\etocmulticolsep{0ex}
\newcommand\etocmulticolpretolerance{-1}
\newcommand\etocmulticoltolerance{200}
-\newcommand\etocmulticolstyle[2][2]{%
+\newcommand\etocdefaultnbcol{2}
+\newcommand\etocmulticolstyle[2][\etocdefaultnbcol]{%
\etocsettocstyle
{\addvspace{\etocabovetocskip}%
\ifnum #1>\@ne\let\Etoc@next\@firstoftwo
@@ -634,8 +688,9 @@
\setlength{\columnsep}{\etoccolumnsep}%
\setlength{\multicolsep}{\etocmulticolsep}%
\begin{multicols}{#1}[#2\addvspace{\etocsepminusone}]}
- {#2\addvspace{\etocsepminusone}\pretolerance\etocmulticolpretolerance
- \tolerance\etocmulticoltolerance}}
+ {#2\addvspace{\etocsepminusone}%
+ \pretolerance\etocmulticolpretolerance
+ \tolerance\etocmulticoltolerance}}
{\ifnum #1>\@ne\let\Etoc@next\@firstofone
\else \let\Etoc@next\@gobble\fi
\Etoc@next{\end{multicols}}%
@@ -653,13 +708,13 @@
\newcommand\etocleftrulecolorcmd{\relax}
\newcommand\etocrightrulecolorcmd{\relax}
\newcommand\etoc@ruledheading[1]{%
- \hbox to \linewidth{\color@begingroup
+ \hb@xt@\linewidth{\color@begingroup
\hss #1\hss\hskip-\linewidth
\etoctoprulecolorcmd\leaders\etoctoprule\hfil
\phantom{#1}%
\leaders\etoctoprule\hss\color@endgroup}%
\nointerlineskip\vskip\etocinnertopsep}
-\newcommand\etocruledstyle[2][2]{%
+\newcommand\etocruledstyle[2][\etocdefaultnbcol]{%
\etocsettocstyle
{\addvspace{\etocabovetocskip}%
\ifnum #1>\@ne\let\Etoc@next\@firstoftwo
@@ -682,13 +737,13 @@
\newcommand\Etoc@relax{\relax}
\newbox\etoc@framed@titlebox
\newbox\etoc@framed@contentsbox
-\newcommand\etocframedstyle[2][2]{%
+\newcommand\etocframedstyle[2][\etocdefaultnbcol]{%
\etocsettocstyle{%
\addvspace{\etocabovetocskip}%
- \setbox\z@\hbox{#2}%
+ \sbox\z@{#2}%
\dimen\z@\dp\z@
\ifdim\wd\z@<\linewidth \dp\z@\z@ \else \dimen\z@\z@ \fi
- \setbox\etoc@framed@titlebox=\hbox to \linewidth{\color@begingroup
+ \setbox\etoc@framed@titlebox=\hb@xt@\linewidth{\color@begingroup
\hss
\ifx\etocbkgcolorcmd\Etoc@relax\else
\sbox\tw@{\color{white}%
@@ -727,14 +782,15 @@
{\ifnum #1>\@ne\let\Etoc@next\@firstofone
\else \let\Etoc@next\@gobble\fi
\Etoc@next{\end{multicols}\unskip}%
- \end{minipage}%<- indispensable (horizontal mode here)
+ \end{minipage}%
\egroup
\vskip\etocinnerbottomsep
\egroup
+ \vbox{\hsize\linewidth
\ifx\etocbkgcolorcmd\Etoc@relax\else
- \vskip\ht\etoc@framed@titlebox
- \vskip\dp\etoc@framed@titlebox
- \hbox to \linewidth{\color@begingroup
+ \kern\ht\etoc@framed@titlebox
+ \kern\dp\etoc@framed@titlebox
+ \hb@xt@\linewidth{\color@begingroup
\etocleftrulecolorcmd\etocleftrule
\etocbkgcolorcmd
\leaders\vrule
@@ -750,54 +806,190 @@
\vskip-\ht\etoc@framed@titlebox
\fi
\box\etoc@framed@titlebox\nointerlineskip
- \hbox to \linewidth{\color@begingroup
+ \hb@xt@\linewidth{\color@begingroup
{\etocleftrulecolorcmd\etocleftrule}%
\hss\box\etoc@framed@contentsbox\hss
\etocrightrulecolorcmd\etocrightrule\color@endgroup}
\nointerlineskip
\vskip\ht\etoc@framed@contentsbox
\vskip\dp\etoc@framed@contentsbox
- \hbox to \linewidth{\color@begingroup\etocbottomrulecolorcmd
- \leaders\etocbottomrule\hss\color@endgroup}
+ \hb@xt@\linewidth{\color@begingroup\etocbottomrulecolorcmd
+ \leaders\etocbottomrule\hss\color@endgroup}}
\addvspace{\etocbelowtocskip}}}
-\newcommand\etoc@multicoltoc[2][2]{%
-\begingroup
+\newcommand\etoc@multicoltoc[2][\etocdefaultnbcol]{%
\etocmulticolstyle[#1]{#2}%
- \ifEtoc@star
- \def\Etoc@next{\tableofcontents*}%
- \else
- \def\Etoc@next{\tableofcontents}%
- \fi
-\Etoc@mustclosegrouptrue
-\Etoc@next}
-\newcommand\etoc@ruledtoc[2][2]{%
-\begingroup
+\tableofcontents}
+\newcommand\etoc@multicoltoci[2][\etocdefaultnbcol]{%
+\etocmulticolstyle[#1]{#2}%
+\tableofcontents*}
+\newcommand\etoc@local@multicoltoc[2][\etocdefaultnbcol]{%
+\etocmulticolstyle[#1]{#2}%
+\localtableofcontents}
+\newcommand\etoc@local@multicoltoci[2][\etocdefaultnbcol]{%
+\etocmulticolstyle[#1]{#2}%
+\localtableofcontents*}
+\newcommand\etoc@ruledtoc[2][\etocdefaultnbcol]{%
\etocruledstyle[#1]{#2}%
- \ifEtoc@star
- \def\Etoc@next{\tableofcontents*}%
- \else
- \def\Etoc@next{\tableofcontents}%
- \fi
-\Etoc@mustclosegrouptrue
-\Etoc@next}
-\newcommand\etoc@framedtoc[2][2]{%
-\begingroup
+\tableofcontents}
+\newcommand\etoc@ruledtoci[2][\etocdefaultnbcol]{%
+\etocruledstyle[#1]{#2}%
+\tableofcontents*}
+\newcommand\etoc@local@ruledtoc[2][\etocdefaultnbcol]{%
+\etocruledstyle[#1]{#2}%
+\localtableofcontents}
+\newcommand\etoc@local@ruledtoci[2][\etocdefaultnbcol]{%
+\etocruledstyle[#1]{#2}%
+\localtableofcontents*}
+\newcommand\etoc@framedtoc[2][\etocdefaultnbcol]{%
\etocframedstyle[#1]{#2}%
- \ifEtoc@star
- \def\Etoc@next{\tableofcontents*}%
- \else
- \def\Etoc@next{\tableofcontents}%
- \fi
-\Etoc@mustclosegrouptrue
-\Etoc@next}
-\def\etocmulticol{\@ifstar{\Etoc@startrue\etoc@multicoltoc}
-{\Etoc@starfalse\etoc@multicoltoc}}
-\def\etocruled{\@ifstar{\Etoc@startrue\etoc@ruledtoc}
-{\Etoc@starfalse\etoc@ruledtoc}}
-\def\etocframed{\@ifstar{\Etoc@startrue\etoc@framedtoc}
-{\Etoc@starfalse\etoc@framedtoc}}
-\etocetoclines
-\etocmulticolstyle{\etocstandardheading\contentsname}
+\tableofcontents}
+\newcommand\etoc@framedtoci[2][\etocdefaultnbcol]{%
+\etocframedstyle[#1]{#2}%
+\tableofcontents*}
+\newcommand\etoc@local@framedtoc[2][\etocdefaultnbcol]{%
+\etocframedstyle[#1]{#2}%
+\localtableofcontents}
+\newcommand\etoc@local@framedtoci[2][\etocdefaultnbcol]{%
+\etocframedstyle[#1]{#2}%
+\localtableofcontents*}
+\newcommand\etocmulticol{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@multicoltoci}
+ {\etoc@multicoltoc}}
+\newcommand\etocruled{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@ruledtoci}
+ {\etoc@ruledtoc}}
+\newcommand\etocframed{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@framedtoci}
+ {\etoc@framedtoc}}
+\newcommand\localetocmulticol{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@local@multicoltoci}
+ {\etoc@local@multicoltoc}}
+\newcommand\localetocruled{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@local@ruledtoci}
+ {\etoc@local@ruledtoc}}
+\newcommand\localetocframed{\begingroup
+ \Etoc@mustclosegrouptrue
+ \@ifstar
+ {\etoc@local@framedtoci}
+ {\etoc@local@framedtoc}}
+\newcommand\etocarticlestyle{%
+ \etocsettocstyle
+ {\section *{\contentsname
+ \@mkboth {\MakeUppercase \contentsname}
+ {\MakeUppercase \contentsname}}}
+ {}}
+\newcommand\etocarticlestylenomarks{%
+ \etocsettocstyle
+ {\section *{\contentsname}}
+ {}}
+\newcommand\etocbookstyle{%
+ \etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \chapter *{\contentsname
+ \@mkboth {\MakeUppercase \contentsname}
+ {\MakeUppercase \contentsname}}}
+ {\if@restonecol \twocolumn \fi}}
+\newcommand\etocbookstylenomarks{%
+ \etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \chapter *{\contentsname}}
+ {\if@restonecol \twocolumn \fi}}
+\let\etocreportstyle\etocbookstyle
+\let\etocreportstylenomarks\etocbookstylenomarks
+\newcommand\etocmemoirtoctotocfmt[2]{%
+ \renewcommand\etocaftertitlehook{\ifmem@em@starred@listof \else
+ \phantomsection \addcontentsline {toc}{#1}{#2}\fi}}
+\newcommand\etocmemoirstyle{%
+ \etocsettocstyle
+ {\ensureonecol \par \begingroup \@nameuse {@tocmaketitle}
+ \Etoc@aftertitlehook\let\Etoc@aftertitlehook\relax
+ \parskip \cftparskip \@nameuse {cfttocbeforelisthook}}
+ {\@nameuse {cfttocafterlisthook}\endgroup \restorefromonecol}}
+\newcommand\etocscrartclstyle{%
+ \etocsettocstyle
+ {\let\if@dynlist\if@tocleft
+ \iftocfeature {toc}{onecolumn}
+ {\iftocfeature {toc}{leveldown}
+ {}
+ {\if@twocolumn \aftergroup \twocolumn \onecolumn \fi }}
+ {}%
+ \tocbasic@listhead {\listoftocname}%
+ \begingroup \expandafter \expandafter \expandafter
+ \endgroup \expandafter
+ \ifx
+ \csname microtypesetup\endcsname \relax
+ \else
+ \iftocfeature {toc}{noprotrusion}{}
+ {\microtypesetup {protrusion=false}%
+ \PackageInfo {tocbasic}%
+ {character protrusion at toc deactivated}}%
+ \fi
+ \setlength {\parskip }{\z@ }%
+ \setlength {\parindent }{\z@ }%
+ \setlength {\parfillskip }{\z@ \@plus 1fil}%
+ \csname tocbasic@@before@hook\endcsname
+ \csname tb@toc@before@hook\endcsname}
+ {\csname tb@toc@after@hook\endcsname
+ \csname tocbasic@@after@hook\endcsname}}
+\let\etocscrbookstyle\etocscrartclstyle
+\let\etocscrreprtstyle\etocscrartclstyle
+\newcommand\etocnakedtocdisplaystyle{\etocsettocstyle{}{}}
+\newcommand\etocstandarddisplaystyle{\etocarticlestyle}
+\newcommand\etocmarkboth[1]{%
+ \@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
+\newcommand\etocmarkbothnouc[1]{\@mkboth{#1}{#1}}
+\newcommand\etoctocstyle[3][section]{\etocmulticolstyle[#2]%
+ {\csname #1\endcsname *{#3}}}
+\newcommand\etoctocstylewithmarks[4][section]{\etocmulticolstyle[#2]%
+ {\csname #1\endcsname *{#3\etocmarkboth{#4}}}}
+\newcommand\etoctocstylewithmarksnouc[4][section]{\etocmulticolstyle[#2]%
+ {\csname #1\endcsname *{#3\etocmarkbothnouc{#4}}}}
+\def\Etoc@redefetocstyle#1{%
+ \renewcommand\etoctocstylewithmarks[4][#1]
+ {\etocmulticolstyle[##2]%
+ {\csname ##1\endcsname *{##3\etocmarkboth{##4}}}}
+ \renewcommand\etoctocstylewithmarksnouc[4][#1]
+ {\etocmulticolstyle[##2]%
+ {\csname ##1\endcsname *{##3\etocmarkbothnouc{##4}}}}
+ \renewcommand\etoctocstyle[3][#1]{%
+ \etocmulticolstyle[##2]{\csname ##1\endcsname *{##3}}}}
+\@ifclassloaded{scrartcl}
+ {\renewcommand\etocstandarddisplaystyle{\etocscrartclstyle}}{}
+\@ifclassloaded{book}
+ {\renewcommand\etocfontone{\normalfont\normalsize}
+ \renewcommand\etocstandarddisplaystyle{\etocbookstyle}
+ \Etoc@redefetocstyle{chapter}}{}
+\@ifclassloaded{report}
+ {\renewcommand\etocfontone{\normalfont\normalsize}
+ \renewcommand\etocstandarddisplaystyle{\etocreportstyle}
+ \Etoc@redefetocstyle{chapter}}{}
+\@ifclassloaded{scrbook}
+ {\renewcommand\etocfontone{\normalfont\normalsize}
+ \renewcommand\etocstandarddisplaystyle{\etocscrbookstyle}
+ \Etoc@redefetocstyle{chapter}}{}
+\@ifclassloaded{scrreprt}
+ {\renewcommand\etocfontone{\normalfont\normalsize}
+ \renewcommand\etocstandarddisplaystyle{\etocscrreprtstyle}
+ \Etoc@redefetocstyle{chapter}}{}
+\@ifclassloaded{memoir}
+ {\renewcommand\etocfontone{\normalfont\normalsize}
+ \etocmemoirtoctotocfmt{chapter}{\contentsname}%
+ \renewcommand\etocstandarddisplaystyle{\etocmemoirstyle}
+ \Etoc@redefetocstyle{chapter}}{}
+\newcommand\etocstandardlines{\Etoc@standardtrue}
+\etoctoclines
+\etocstandardlines
+\etocstandarddisplaystyle
\endinput
%%
%% End of file `etoc.sty'.