diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-29 23:34:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-29 23:34:40 +0000 |
commit | 00db22e467544f6ebde833dc8fbb53ec70367306 (patch) | |
tree | 0bb96b3d97afb68e7c737c703e09d0818317bb59 /Master/texmf-dist/tex/latex/etoc/etoc.sty | |
parent | 5b6c07d1cfaefd42af46b1560695a8de0f6eeb79 (diff) |
etoc (29jan13)
git-svn-id: svn://tug.org/texlive/trunk@28984 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etoc/etoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 563 |
1 files changed, 315 insertions, 248 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 837487b6d2f..b17bd0c9730 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -22,10 +22,10 @@ %% in the same archive or directory.) %% \ProvidesPackage{etoc} - [2012/12/07 v1.06 easily customizable TOCs (jfB)] + [2013/01/29 v1.07 easily customizable TOCs (jfB)] %% %% Package `etoc' by Jean-Francois Burnol -%% Copyright (C) 2012 by Jean-Francois Burnol +%% Copyright (C) 2012, 2013 by Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{multicol} @@ -33,6 +33,8 @@ \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax \newtoks\Etoc@toctoks +\def\Etoc@par{\par} +\newcommand*{\etocnopar}{\def\Etoc@par{}} \newif\ifEtoc@jj % book \newif\ifEtoc@j % part \newif\ifEtoc@ % chapter @@ -56,10 +58,10 @@ \@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@@zero@@ 0 +\let\Etoc@@one@@ \@ne +\let\Etoc@@two@@ \tw@ +\let\Etoc@@three@@ \thr@@ \chardef\Etoc@@four@@ 4 \chardef\Etoc@@five@@ 5 \chardef\Etoc@@six@@ 6 @@ -77,44 +79,41 @@ \def\Etoc@levellist@elt{\noexpand\Etoc@levellist@elt\noexpand}% \edef\Etoc@levellist{\Etoc@levellist\Etoc@levellist@elt#1}} \def\etocsetlevel#1#2{% - \let\Etoc@next\@firstofone - \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 -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\fi \expandafter\Etoc@newlevel\csname l@#1\endcsname - \Etoc@next - {\ifcase#2\relax + \ifcase#2\relax \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@zero@@ - \expandafter\def \csname Etoc@#1@\endcsname{zero}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@zero@ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@one@@ - \expandafter\def \csname Etoc@#1@\endcsname{one}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@one@ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@two@@ - \expandafter\def \csname Etoc@#1@\endcsname{two}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@two@ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@three@@ - \expandafter\def \csname Etoc@#1@\endcsname{three}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@three@ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@four@@ - \expandafter\def \csname Etoc@#1@\endcsname{four}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@four@ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@five@@ - \expandafter\def \csname Etoc@#1@\endcsname{five}% + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@five@ + \or + \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@six@@ \else - \ifnum#2=\m@ne + \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@@minusone@ + \else + \ifnum#2=-\tw@ \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@ - \expandafter\def \csname Etoc@#1@\endcsname{minustwo}% - \fi - \fi}} + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@ + \else + \PackageWarning{etoc} + {unexpected value `#2' in \string\etocsetlevel.^^J% + Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}% + \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@ +\fi\fi\fi} \etocsetlevel{book}{-2} \etocsetlevel{part}{-1} \etocsetlevel{chapter}{0} @@ -123,21 +122,6 @@ \etocsetlevel{subsubsection}{3} \etocsetlevel{paragraph}{4} \etocsetlevel{subparagraph}{5} -\AtBeginDocument{% -\@ifpackageloaded{hyperref} -{\Etoc@hyperreftrue -\def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}} -{\Etoc@hyperreffalse -\def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}}} - \def\Etoc@swa#1{% - \Etoc@et@hop - {\Etoc@savedcontentsline{#1}} - {\Etoc@prefix\Etoc@contents}} - \def\Etoc@swb#1{% - \Etoc@et@hop - {\Etoc@savedcontentsline{#1}} - {\Etoc@contents}} -\let\etocskipfirstprefix\@thirdofthree \def\Etoc@setflags #1{% \ifcase #1\relax \global\Etoc@vfalse @@ -186,6 +170,20 @@ \global\Etoc@jjtrue \fi \fi} +\AtBeginDocument{% +\@ifpackageloaded{hyperref}{\Etoc@hyperreftrue + \def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}} + {\Etoc@hyperreffalse + \def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}}} + \def\Etoc@swa#1{% + \Etoc@et@hop + {\Etoc@savedcontentsline{#1}} + {\Etoc@prefix\Etoc@contents}} + \def\Etoc@swb#1{% + \Etoc@et@hop + {\Etoc@savedcontentsline{#1}} + {\Etoc@contents}} +\let\etocskipfirstprefix\@thirdofthree \def\Etoc@etoccontentsline#1{% \global\expandafter\let\expandafter\Etoc@tmp\csname Etoc@#1@@\endcsname \Etoc@skipthisonefalse @@ -194,20 +192,24 @@ \else \def\Etoc@next{\expandafter\@gobble\@gobblefour}% \fi - \ifEtoc@localtoc - \let\Etoc@prenext\relax - \ifEtoc@stoptoc + \ifnum\Etoc@tmp=\Etoc@@six@@ + \Etoc@skipthisonetrue + \else + \ifEtoc@localtoc + \let\Etoc@prenext\relax + \ifEtoc@stoptoc \Etoc@skipthisonetrue - \fi - \ifnum\Etoc@tmp<\Etoc@localtop + \fi + \ifnum\Etoc@tmp<\Etoc@localtop \def\Etoc@prenext{\global\Etoc@stoptoctrue}% \Etoc@skipthisonetrue - \fi - \ifEtoc@notactive + \fi + \ifEtoc@notactive \def\Etoc@prenext{\Etoc@setflags{\Etoc@tmp}}% \Etoc@skipthisonetrue - \fi - \Etoc@prenext + \fi + \Etoc@prenext + \fi \fi \ifnum\c@tocdepth<\Etoc@tmp\relax\else \ifEtoc@skipthisone\else @@ -275,62 +277,112 @@ \def\Etoc@prefix{\Etoc@prefix@minustwo}% \fi \fi - \ifnum\Etoc@tmp=\m@ne\Etoc@parttrue\else\Etoc@partfalse\fi - \Etoc@setflags{\Etoc@tmp}% + \ifnum\Etoc@tmp=\m@ne\Etoc@parttrue\else\Etoc@partfalse\fi + \Etoc@setflags{\Etoc@tmp}% \fi\fi \Etoc@next \@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}} -\def\Etoc@lxyz #1#2{\@namedef{etocname }{\leavevmode #1\xspace}% - \@namedef{etocpage }{\leavevmode #2\xspace}% +\def\Etoc@lxyz #1#2{% + \@namedef{etocpage }{\leavevmode #2\xspace}% + \Etoc@getthepage #2\etoc@ + \@namedef{etocname }{\leavevmode #1\xspace}% + \def\etocthename{#1}% \Etoc@getnb #1\relax\relax\etoc@ - \ifEtoc@number\else\ifEtoc@part - \Etoc@getit #1\hspace\relax\etoc@\fi\fi} + \ifEtoc@number\else + \ifEtoc@part + \Etoc@getit #1\hspace\relax\etoc@ + \fi + \fi} \def\Etoc@getnb #1{\let\Etoc@next\Etoc@getnb@nohyp -\ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getnb@hyp\fi\fi\Etoc@next #1} + \ifEtoc@hyperref\ifx #1\hyper@linkstart + \let\Etoc@next\Etoc@getnb@hyp + \fi\fi + \Etoc@next #1} \def\Etoc@getit #1{\let\Etoc@next\Etoc@getit@nohyp -\ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getit@hyp\fi\fi\Etoc@next #1} + \ifEtoc@hyperref\ifx #1\hyper@linkstart + \let\Etoc@next\Etoc@getit@hyp + \fi\fi + \Etoc@next #1} +\def\Etoc@getthepage #1{\let\Etoc@next\Etoc@getthepage@nohyp + \ifEtoc@hyperref\ifx #1\hyper@linkstart + \let\Etoc@next\Etoc@getthepage@hyp + \fi\fi + \Etoc@next #1} +\def\Etoc@getthepage@nohyp #1\etoc@{\def\etocthepage{#1}} +\def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@{% + \@namedef{etoclink }##1{#1{#2}{#3}{##1}#5}% + \def\etocthepage{#4}} \def\Etoc@getnb@nohyp #1#2#3\etoc@{% -\ifx #1\numberline -\@namedef{etocnumber }{\leavevmode #2\xspace}\Etoc@numbertrue -\else -\@namedef{etocnumber }{\leavevmode\xspace}\Etoc@numberfalse -\fi} + \def\Etoc@getname ##1\relax\relax\etoc@{% + \@namedef{etocname }{\leavevmode ##1\xspace}% + \def\etocthename{##1}% + }% + \ifx #1\numberline + \@namedef{etocnumber }{\leavevmode #2\xspace}% + \def\etocthenumber{#2}% + \Etoc@numbertrue + \Etoc@getname #3\etoc@ + \else + \@namedef{etocnumber }{\leavevmode\xspace}% + \def\etocthenumber{}% + \Etoc@numberfalse + \fi +} \def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@{% - \def\Etoc@getnbr ##1##2##3\etoc@{% - \ifx ##1\numberline - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5\xspace}% - \Etoc@numbertrue - \else - \@namedef{etocnumber }{\leavevmode\xspace}% - \Etoc@numberfalse - \fi}% - \Etoc@getnbr #4\relax\relax\etoc@} + \@namedef{etoclink }##1{#1{#2}{#3}{##1}#5}% + \def\Etoc@getname ##1\relax\relax\etoc@{% + \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}% + \def\etocthename{##1}% + }% + \def\Etoc@getnbr ##1##2##3\etoc@{% + \ifx ##1\numberline + \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5\xspace}% + \def\etocthenumber{##2}% + \Etoc@numbertrue + \Etoc@getname ##3\etoc@ + \else + \@namedef{etocnumber }{\leavevmode\xspace}% + \def\etocthenumber{}% + \Etoc@numberfalse + \def\etocthename{#4}% + \fi}% + \Etoc@getnbr #4\relax\relax\etoc@ +} \def\Etoc@getit@nohyp #1\hspace#2#3\etoc@{% \def\Etoc@getname ##1\hspace\relax\etoc@{% - \@namedef{etocname }{\leavevmode ##1\xspace}}% - \ifx \relax#2\else + \@namedef{etocname }{\leavevmode ##1\xspace}% + \def\etocthename{##1}% + }% + \ifx\relax#2\else \@namedef{etocnumber }{\leavevmode #1\xspace}% + \def\etocthenumber{#1}% \Etoc@numbertrue - \Etoc@getname #3\etoc@\fi} + \Etoc@getname #3\etoc@ + \fi +} \def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@{% \def\Etoc@getname ##1\hspace\relax\etoc@{% - \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}}% + \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}% + \def\etocthename{##1}% + }% \def\Etoc@getnbr ##1\hspace##2##3\etoc@{% - \ifx\relax##2\else - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5\xspace}% - \Etoc@numbertrue - \Etoc@getname ##3\etoc@\fi}% + \ifx\relax##2\else + \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5\xspace}% + \def\etocthenumber{##1}% + \Etoc@numbertrue + \Etoc@getname ##3\etoc@ + \fi}% \Etoc@getnbr #4\hspace\relax\etoc@} -\edef\etocpage{\noexpand\protect\expandafter\noexpand - \csname etocpage \endcsname} -\edef\etocname{\noexpand\protect\expandafter\noexpand - \csname etocname \endcsname} -\edef\etocnumber{\noexpand\protect\expandafter\noexpand - \csname etocnumber \endcsname} +\edef\etocpage{\noexpand\protect\expandafter + \noexpand\csname etocpage \endcsname} +\edef\etocname{\noexpand\protect\expandafter + \noexpand\csname etocname \endcsname} +\edef\etocnumber{\noexpand\protect\expandafter + \noexpand\csname etocnumber \endcsname} +\edef\etoclink{\noexpand\protect\expandafter + \noexpand\csname etoclink \endcsname} \@namedef{etocifnumbered }{\ifEtoc@number -\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \edef\etocifnumbered{\noexpand\protect\expandafter\noexpand \csname etocifnumbered \endcsname} \def\Etoc@readtoc#1{% @@ -375,21 +427,20 @@ \global\Etoc@jfalse \global\Etoc@jjfalse \ifEtoc@standard -\etoc@setstyle{@minustwo}{}{}{}{}% -\etoc@setstyle{@minusone}{}{}{}{}% -\etoc@setstyle{@zero}{}{}{}{}% -\etoc@setstyle{@one}{}{}{}{}% -\etoc@setstyle{@two}{}{}{}{}% -\etoc@setstyle{@three}{}{}{}{}% -\etoc@setstyle{@four}{}{}{}{}% -\etoc@setstyle{@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 -\def\Etoc@levellist@elt##1{\let##1\Etoc@lxyz}% -\Etoc@levellist -\let\numberline\@gobble -\let\booknumberline\numberline -\let\partnumberline\numberline -\let\chapternumberline\numberline + \def\Etoc@levellist@elt##1{\let##1\Etoc@lxyz}% + \Etoc@levellist + \let\booknumberline\numberline + \let\partnumberline\numberline + \let\chapternumberline\numberline \fi \the\Etoc@toctoks \ifEtoc@notactive\else @@ -428,7 +479,7 @@ \fi\fi \Etoc@next} \let\etoc@startlocaltoc\@gobble -\long\def\Etoc@localtableofcontents#1{% +\def\Etoc@localtableofcontents#1{% \edef\Etoc@tmp{#1}% \ifnum\Etoc@tmp<\@ne \PackageWarning{etoc} @@ -470,50 +521,52 @@ \ifEtoc@mustclosegroup\expandafter\endgroup\fi}% \fi \fi\fi\fi\Etoc@next} -\def\table@fcontents{\par +\def\table@fcontents{% \refstepcounter{etoc@tocid}% \Etoc@tocwithidfalse \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} -\def\localtable@fcontents{\par +\def\localtable@fcontents{% \refstepcounter{etoc@tocid}% \addtocontents{toc} {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}% \Etoc@tocwithidtrue \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} -\newcommand\etocaftertitlehook{} -\def\tableofcontents{\ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi +\newcommand*\etocaftertitlehook{} +\newcommand*\etocaftercontentshook{} +\renewcommand*\tableofcontents{% + \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi \global\Etoc@tocopenedforwritetrue - \begingroup + \Etoc@par\begingroup \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% \@ifstar - {\let\Etoc@aftertitlehook\relax\table@fcontents} + {\def\Etoc@aftertitlehook{}\table@fcontents} {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}} -\def\localtableofcontents{\ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi +\newcommand*\localtableofcontents{% + \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi \global\Etoc@tocopenedforwritetrue - \begingroup\@ifstar - {\let\Etoc@aftertitlehook\relax\localtable@fcontents} + \Etoc@par\begingroup\@ifstar + {\def\Etoc@aftertitlehook{}\localtable@fcontents} {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}} \newcommand\etocsettocstyle[2]{% -\long\def\Etoc@tableofcontents +\def\Etoc@tableofcontents {\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else \let\Etoc@@next\@gobble\fi \Etoc@@next{#1\Etoc@aftertitlehook \let\Etoc@savedcontentsline\contentsline \let\contentsline\Etoc@etoccontentsline - \Etoc@toctoc\let\Etoc@n@xt\relax - \ifEtoc@tocwithid\else - \ifEtoc@localtoc - \ifEtoc@notactive - \def\Etoc@n@xt{\Etoc@localtocfalse + \Etoc@toctoc + \let\Etoc@n@xt\relax + \ifEtoc@tocwithid\else + \ifEtoc@localtoc + \ifEtoc@notactive + \def\Etoc@n@xt{\Etoc@localtocfalse \global\Etoc@notactivefalse \Etoc@toctoc}% - \fi\fi\fi\Etoc@n@xt + \fi\fi\fi + \Etoc@n@xt + \etocaftercontentshook #2}}} -\newcommand\etocextendtocstyle[2]{% -\toks0=\expandafter{\Etoc@tableofcontents #2}% -\toks2={#1}% -\long\edef\Etoc@tableofcontents{\the\toks2 \the\toks0}} -\newcommand\etocsetstyle{\Etoc@standardfalse\etoc@setstyle} +\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}% @@ -523,33 +576,33 @@ \csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname {#4}% \long\expandafter\def \csname Etoc@end@\csname Etoc@#1@\endcsname\endcsname {#5}} -\newcommand\etocfontminustwo{\normalfont \LARGE \bfseries} -\newcommand\etocfontminusone{\normalfont \large \bfseries} -\newcommand\etocfontzero{\normalfont \large \bfseries} -\newcommand\etocfontone{\normalfont \normalsize \bfseries} -\newcommand\etocfonttwo{\normalfont \normalsize} -\newcommand\etocfontthree{\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\etocminustwoleftmargin{1.5em plus 0.5fil} -\newcommand\etocminustworightmargin{1.5em plus -0.5fil} -\newcommand\etocminusoneleftmargin{1em} -\newcommand\etocminusonerightmargin{1em} -\newcommand\etoctoclineleaders +\newcommand*\etocfontminustwo{\normalfont \LARGE \bfseries} +\newcommand*\etocfontminusone{\normalfont \large \bfseries} +\newcommand*\etocfontzero{\normalfont \large \bfseries} +\newcommand*\etocfontone{\normalfont \normalsize \bfseries} +\newcommand*\etocfonttwo{\normalfont \normalsize} +\newcommand*\etocfontthree{\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*\etocminustwoleftmargin{1.5em plus 0.5fil} +\newcommand*\etocminustworightmargin{1.5em plus -0.5fil} +\newcommand*\etocminusoneleftmargin{1em} +\newcommand*\etocminusonerightmargin{1em} +\newcommand*\etoctoclineleaders {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}} -\newcommand\etocabbrevpagename{p.~} -\newcommand\etocpartname{\partname} -\newcommand\etocbookname{Book} +\newcommand*\etocabbrevpagename{p.~} +\newcommand*\etocpartname{\partname} +\newcommand*\etocbookname{Book} \def\etoctoclines{\Etoc@standardfalse \etoc@setstyle{@minustwo}{\etocskipfirstprefix}{\pagebreak[3]} {\begingroup \etocfontminustwo @@ -658,16 +711,18 @@ \etoc@setstyle{@four}{}{}{}{}% \etoc@setstyle{@five}{}{}{}{}% } -\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\etocdefaultnbcol{2} +\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*\etocdefaultnbcol{2} +\newcommand*\etocinnertopsep{2ex} \newcommand\etocmulticolstyle[2][\etocdefaultnbcol]{% \etocsettocstyle - {\addvspace{\etocabovetocskip}% + {\let\etocoldpar\par + \addvspace{\etocabovetocskip}% \ifnum #1>\@ne\let\Etoc@next\@firstoftwo \else \let\Etoc@next\@secondoftwo\fi \Etoc@next{% @@ -675,34 +730,33 @@ \multicoltolerance\etocmulticoltolerance \setlength{\columnsep}{\etoccolumnsep}% \setlength{\multicolsep}{\etocmulticolsep}% - \begin{multicols}{#1}[#2\addvspace{\etocsepminusone}]} - {#2\addvspace{\etocsepminusone}% + \begin{multicols}{#1}[#2\etocoldpar\addvspace{\etocinnertopsep}]} + {#2\par\addvspace{\etocinnertopsep}% \pretolerance\etocmulticolpretolerance \tolerance\etocmulticoltolerance}} {\ifnum #1>\@ne\let\Etoc@next\@firstofone \else \let\Etoc@next\@gobble\fi \Etoc@next{\end{multicols}}% \addvspace{\etocbelowtocskip}}} -\newcommand\etocinnertopsep{2ex} -\newcommand\etocinnerbottomsep{3.5ex} -\newcommand\etocinnerleftsep{2em} -\newcommand\etocinnerrightsep{2em} -\newcommand\etoctoprule{\hrule} -\newcommand\etocleftrule{\vrule} -\newcommand\etocrightrule{\vrule} -\newcommand\etocbottomrule{\hrule} -\newcommand\etoctoprulecolorcmd{\relax} -\newcommand\etocbottomrulecolorcmd{\relax} -\newcommand\etocleftrulecolorcmd{\relax} -\newcommand\etocrightrulecolorcmd{\relax} -\newcommand\etoc@ruledheading[1]{% +\newcommand*\etocinnerbottomsep{3.5ex} +\newcommand*\etocinnerleftsep{2em} +\newcommand*\etocinnerrightsep{2em} +\newcommand*\etoctoprule{\hrule} +\newcommand*\etocleftrule{\vrule} +\newcommand*\etocrightrule{\vrule} +\newcommand*\etocbottomrule{\hrule} +\newcommand*\etoctoprulecolorcmd{\relax} +\newcommand*\etocbottomrulecolorcmd{\relax} +\newcommand*\etocleftrulecolorcmd{\relax} +\newcommand*\etocrightrulecolorcmd{\relax} +\def\etoc@ruledheading #1{% \hb@xt@\linewidth{\color@begingroup \hss #1\hss\hskip-\linewidth \etoctoprulecolorcmd\leaders\etoctoprule\hss \phantom{#1}% \leaders\etoctoprule\hss\color@endgroup}% - \nointerlineskip\vskip\etocinnertopsep} -\newcommand\etocruledstyle[2][\etocdefaultnbcol]{% + \nointerlineskip\vskip\etocinnertopsep} +\newcommand*\etocruledstyle[2][\etocdefaultnbcol]{% \etocsettocstyle {\addvspace{\etocabovetocskip}% \ifnum #1>\@ne\let\Etoc@next\@firstoftwo @@ -721,11 +775,11 @@ \Etoc@next{\end{multicols}}% \addvspace{\etocbelowtocskip}}} \newcommand\etocframedmphook{\relax} -\newcommand\etocbkgcolorcmd{\relax} -\newcommand\Etoc@relax{\relax} +\newcommand*\etocbkgcolorcmd{\relax} +\def\Etoc@relax{\relax} \newbox\etoc@framed@titlebox \newbox\etoc@framed@contentsbox -\newcommand\etocframedstyle[2][\etocdefaultnbcol]{% +\newcommand*\etocframedstyle[2][\etocdefaultnbcol]{% \etocsettocstyle{% \addvspace{\etocabovetocskip}% \sbox\z@{#2}% @@ -804,108 +858,107 @@ \leaders\etocbottomrule\hss\color@endgroup}} \addvspace{\etocbelowtocskip}}} \newcommand\etoc@multicoltoc[2][\etocdefaultnbcol]{% -\etocmulticolstyle[#1]{#2}% -\tableofcontents} + \etocmulticolstyle[#1]{#2}% + \tableofcontents} \newcommand\etoc@multicoltoci[2][\etocdefaultnbcol]{% -\etocmulticolstyle[#1]{#2}% -\tableofcontents*} + \etocmulticolstyle[#1]{#2}% + \tableofcontents*} \newcommand\etoc@local@multicoltoc[2][\etocdefaultnbcol]{% -\etocmulticolstyle[#1]{#2}% -\localtableofcontents} + \etocmulticolstyle[#1]{#2}% + \localtableofcontents} \newcommand\etoc@local@multicoltoci[2][\etocdefaultnbcol]{% -\etocmulticolstyle[#1]{#2}% -\localtableofcontents*} -\newcommand\etoc@ruledtoc[2][\etocdefaultnbcol]{% -\etocruledstyle[#1]{#2}% -\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}% -\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 + \etocmulticolstyle[#1]{#2}% + \localtableofcontents*} +\newcommand*\etoc@ruledtoc[2][\etocdefaultnbcol]{% + \etocruledstyle[#1]{#2}% + \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}% + \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*} +\def\etocmulticol{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@multicoltoci} {\etoc@multicoltoc}} -\newcommand\etocruled{\begingroup +\def\etocruled{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@ruledtoci} {\etoc@ruledtoc}} -\newcommand\etocframed{\begingroup +\def\etocframed{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@framedtoci} {\etoc@framedtoc}} -\newcommand\etoclocalmulticol{\begingroup +\def\etoclocalmulticol{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@multicoltoci} {\etoc@local@multicoltoc}} -\newcommand\etoclocalruled{\begingroup +\def\etoclocalruled{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@ruledtoci} {\etoc@local@ruledtoc}} -\newcommand\etoclocalframed{\begingroup +\def\etoclocalframed{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@framedtoci} {\etoc@local@framedtoc}} -\newcommand\etocarticlestyle{% +\def\etocarticlestyle{% \etocsettocstyle {\section *{\contentsname \@mkboth {\MakeUppercase \contentsname} {\MakeUppercase \contentsname}}} {}} -\newcommand\etocarticlestylenomarks{% +\def\etocarticlestylenomarks{% \etocsettocstyle {\section *{\contentsname}} {}} -\newcommand\etocbookstyle{% +\def\etocbookstyle{% \etocsettocstyle {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi \chapter *{\contentsname \@mkboth {\MakeUppercase \contentsname} {\MakeUppercase \contentsname}}} {\if@restonecol \twocolumn \fi}} -\newcommand\etocbookstylenomarks{% +\def\etocbookstylenomarks{% \etocsettocstyle {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi \chapter *{\contentsname}} {\if@restonecol \twocolumn \fi}} \let\etocreportstyle\etocbookstyle \let\etocreportstylenomarks\etocbookstylenomarks -\newcommand\Etoc@addcontentsline{} -\newcommand\etocmemoirtoctotocfmt[2]{% - \renewcommand\Etoc@addcontentsline{\addcontentsline {toc}{#1}{#2}}% - \renewcommand\etocaftertitlehook{% +\def\etocmemoirtoctotocfmt #1#2{% + \def\Etoc@addsuitablecontentsline{\addcontentsline {toc}{#1}{#2}}% + \renewcommand*\etocaftertitlehook{% \ifmem@em@starred@listof - \else\phantomsection\aftergroup\Etoc@addcontentsline\fi}} -\newcommand\etocmemoirstyle{% + \else\phantomsection\aftergroup\Etoc@addsuitablecontentsline\fi}} +\def\etocmemoirstyle{% \etocsettocstyle {\ensureonecol \par \begingroup \@nameuse {@tocmaketitle} \Etoc@aftertitlehook\let\Etoc@aftertitlehook\relax \parskip \cftparskip \@nameuse {cfttocbeforelisthook}} {\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}} -\newcommand\etocscrartclstyle{% +\def\etocscrartclstyle{% \etocsettocstyle {\let\if@dynlist\if@tocleft \iftocfeature {toc}{onecolumn} @@ -933,11 +986,10 @@ \csname tocbasic@@after@hook\endcsname}} \let\etocscrbookstyle\etocscrartclstyle \let\etocscrreprtstyle\etocscrartclstyle -\newcommand\etocnakedtocdisplaystyle{\etocsettocstyle{}{}} -\newcommand\etocstandarddisplaystyle{\etocarticlestyle} -\newcommand\etocmarkboth[1]{% +\newcommand*\etocstandarddisplaystyle{\etocarticlestyle} +\newcommand*\etocmarkboth[1]{% \@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}} -\newcommand\etocmarkbothnouc[1]{\@mkboth{#1}{#1}} +\newcommand*\etocmarkbothnouc[1]{\@mkboth{#1}{#1}} \newcommand\etoctocstyle[3][section]{\etocmulticolstyle[#2]% {\csname #1\endcsname *{#3}}} \newcommand\etoctocstylewithmarks[4][section]{\etocmulticolstyle[#2]% @@ -954,32 +1006,47 @@ \renewcommand\etoctocstyle[3][#1]{% \etocmulticolstyle[##2]{\csname ##1\endcsname *{##3}}}} \@ifclassloaded{scrartcl} - {\renewcommand\etocstandarddisplaystyle{\etocscrartclstyle}}{} + {\renewcommand*\etocstandarddisplaystyle{\etocscrartclstyle}}{} \@ifclassloaded{book} - {\renewcommand\etocfontone{\normalfont\normalsize} - \renewcommand\etocstandarddisplaystyle{\etocbookstyle} + {\renewcommand*\etocfontone{\normalfont\normalsize} + \renewcommand*\etocstandarddisplaystyle{\etocbookstyle} \Etoc@redefetocstyle{chapter}}{} \@ifclassloaded{report} - {\renewcommand\etocfontone{\normalfont\normalsize} - \renewcommand\etocstandarddisplaystyle{\etocreportstyle} + {\renewcommand*\etocfontone{\normalfont\normalsize} + \renewcommand*\etocstandarddisplaystyle{\etocreportstyle} \Etoc@redefetocstyle{chapter}}{} \@ifclassloaded{scrbook} - {\renewcommand\etocfontone{\normalfont\normalsize} - \renewcommand\etocstandarddisplaystyle{\etocscrbookstyle} + {\renewcommand*\etocfontone{\normalfont\normalsize} + \renewcommand*\etocstandarddisplaystyle{\etocscrbookstyle} \Etoc@redefetocstyle{chapter}}{} \@ifclassloaded{scrreprt} - {\renewcommand\etocfontone{\normalfont\normalsize} - \renewcommand\etocstandarddisplaystyle{\etocscrreprtstyle} + {\renewcommand*\etocfontone{\normalfont\normalsize} + \renewcommand*\etocstandarddisplaystyle{\etocscrreprtstyle} \Etoc@redefetocstyle{chapter}}{} \@ifclassloaded{memoir} - {\renewcommand\etocfontone{\normalfont\normalsize} + {\renewcommand*\etocfontone{\normalfont\normalsize} \etocmemoirtoctotocfmt{chapter}{\contentsname}% - \renewcommand\etocstandarddisplaystyle{\etocmemoirstyle} + \renewcommand*\etocstandarddisplaystyle{\etocmemoirstyle} \Etoc@redefetocstyle{chapter}}{} -\newcommand\etocstandardlines{\Etoc@standardtrue} +\newcommand*\etocstandardlines{\Etoc@standardtrue} +\def\Etoc@addtocontents #1#2% + {\ifEtoc@hyperref + \addtocontents {toc}{\protect\contentsline + {#1}{#2}% + {\thepage }{\@currentHref }}% + \else + \addtocontents {toc}{\protect\contentsline + {#1}{#2}{\thepage }}% + \fi} +\def\Etoc@addcontentsline@ #1#2#3% + {\@namedef{toclevel@#1}{#3}% + \addcontentsline {toc}{#1}{#2}} +\DeclareRobustCommand*{\etoctoccontentsline} + {\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}} \etoctoclines +\AtBeginDocument{ \etocstandardlines -\etocstandarddisplaystyle +\etocstandarddisplaystyle} \endinput %% %% End of file `etoc.sty'. |