From 48a58042e3df67ff44357fc279ef5ed103843908 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 6 Apr 2013 23:08:33 +0000 Subject: etoc (6apr13) git-svn-id: svn://tug.org/texlive/trunk@29697 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/etoc/etoc.sty | 231 ++++++++++++++++++------------ 1 file changed, 136 insertions(+), 95 deletions(-) (limited to 'Master/texmf-dist/tex/latex/etoc') diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index ad991703057..6296a45dde2 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} - [2013/03/01 v1.07e easily customizable TOCs (jfB)] + [2013/03/07 v1.07f Completely customisable TOCs (jfB)] %% %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012, 2013 by Jean-Francois Burnol @@ -56,6 +56,7 @@ \newif\ifEtoc@notactive \newcounter{etoc@tocid} \newif\ifEtoc@mustclosegroup +\def\etoc@{\etoc@} % Delimiter in \Etoc@getnb etc.. macros. This def added 1.07f \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} \def\Etoc@@minustwo@@{-\tw@} \let\Etoc@@minusone@@\m@ne @@ -283,97 +284,139 @@ \Etoc@next \@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}} \def\Etoc@lxyz #1#2{% - \@namedef{etoclink }{\leavevmode}% fall-back - \@namedef{etocpage }{\leavevmode #2}% fall-back - \Etoc@getthepage #2\etoc@ - \@namedef{etocname }{\leavevmode #1}% fall-back - \def\etocthename{#1}% - \Etoc@getnb #1\relax\relax\etoc@ + \@namedef {etoclink }{\leavevmode}% fall-back + \def\etocthelink {}% fall-back + \@namedef {etocname }{\leavevmode #1}% fall-back (perhaps linked) + \def\etocthename {#1}% (if link, will be removed later) + \def\etocthelinkedname {#1}% will probably get redefined + \@namedef {etocpage }{\leavevmode #2}% (perhaps linked) + \Etoc@getthepage #2\etoc@ % defines also \etocthelinkedpage (and \etoclink) + \Etoc@getnb #1\relax\relax\etoc@ % gets number *and* name, and \etoclink \ifEtoc@number\else \ifEtoc@part - \Etoc@getit #1\hspace\relax\etoc@ + \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts \fi \fi} -\def\Etoc@getnb #1{\let\Etoc@next\Etoc@getnb@nohyp +\def\Etoc@getthepage #1{% + \let\Etoc@next\Etoc@getthepage@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getnb@hyp + \let\Etoc@next\Etoc@getthepage@hyp \fi\fi - \Etoc@next #1} -\def\Etoc@getit #1{\let\Etoc@next\Etoc@getit@nohyp + \Etoc@next #1% +} +\def\Etoc@getthepage@nohyp #1\etoc@ {% + \def\etocthepage {#1}% + \def\etocthelinkedpage {#1}% +} +\def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@ {% + \@namedef{etoclink } ##1{\leavevmode #1{#2}{#3}{##1}#5}% + \edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% + \def\etocthepage {#4}% + \toks@ {#4}% + \edef\etocthelinkedpage {\noexpand\hyperlink {#3}{\the\toks@}}% +} +\def\Etoc@getnb #1{% + \let\Etoc@next\Etoc@getnb@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getit@hyp + \let\Etoc@next\Etoc@getnb@hyp \fi\fi - \Etoc@next #1} -\def\Etoc@getthepage #1{\let\Etoc@next\Etoc@getthepage@nohyp + \Etoc@next #1% +} +\def\Etoc@getit #1{% + \let\Etoc@next\Etoc@getit@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getthepage@hyp + \let\Etoc@next\Etoc@getit@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@{% - \def\Etoc@getname ##1\relax\relax\etoc@{% - \@namedef{etocname }{\leavevmode ##1}% - \def\etocthename{##1}% + \Etoc@next #1% +} +\def\Etoc@getnb@nohyp #1#2#3\etoc@ {% + \def\Etoc@getname ##1\relax\relax\etoc@ {% + \@namedef {etocname }{\leavevmode ##1}% + \def\etocthename {##1}% + \def\etocthelinkedname {##1}% }% \ifx #1\numberline - \@namedef{etocnumber }{\leavevmode #2}% - \def\etocthenumber{#2}% + \@namedef {etocnumber }{\leavevmode #2}% + \def\etocthenumber {#2}% + \def\etocthelinkednumber {#2}% \Etoc@numbertrue \Etoc@getname #3\etoc@ - \else - \@namedef{etocnumber }{\leavevmode}% - \def\etocthenumber{}% + \else % then \etocthename and \etocthelinkedname already defined + \@namedef {etocnumber }{\leavevmode}% + \def\etocthenumber {}% + \def\etocthelinkednumber {}% \Etoc@numberfalse \fi } -\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@{% - \@namedef{etoclink }##1{#1{#2}{#3}{##1}#5}% - \def\Etoc@getname ##1\relax\relax\etoc@{% - \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5}% - \def\etocthename{##1}% - }% - \def\Etoc@getnbr ##1##2##3\etoc@{% - \ifx ##1\numberline - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5}% - \def\etocthenumber{##2}% - \Etoc@numbertrue - \Etoc@getname ##3\etoc@ - \else - \@namedef{etocnumber }{\leavevmode}% - \def\etocthenumber{}% - \Etoc@numberfalse - \def\etocthename{#4}% - \fi}% +\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% + \def\Etoc@getname ##1\relax\relax\etoc@ {% + \@namedef {etocname }{\leavevmode #1{#2}{#3}{##1}#5}% + \def\etocthename {##1}% + \toks@ {##1}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% + }% + \def\Etoc@getnbr ##1##2##3\etoc@ {% + \ifx ##1\numberline + \@namedef {etocnumber }{\leavevmode #1{#2}{#3}{##2}#5}% + \def\etocthenumber {##2}% + \toks@ {##2}% + \edef\etocthelinkednumber {\noexpand\hyperlink {#3}{\the\toks@}}% + \Etoc@numbertrue + \Etoc@getname ##3\etoc@ + \else + \@namedef {etocnumber }{\leavevmode}% + \def\etocthenumber {}% + \def\etocthelinkednumber {}% + \Etoc@numberfalse + \def\etocthename {#4}% + \toks@ {#4}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% + \fi + }% + \@namedef {etoclink }##1{\leavevmode #1{#2}{#3}{##1}#5}% + \edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% \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}% - \def\etocthename{##1}% +\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% + \def\Etoc@getname ##1\hspace\relax\etoc@ {% + \@namedef {etocname }{\leavevmode ##1}% + \def\etocthename {##1}% + \def\etocthelinkedname {##1}% }% \ifx\relax#2\else - \@namedef{etocnumber }{\leavevmode #1}% - \def\etocthenumber{#1}% + \@namedef {etocnumber }{\leavevmode #1}% + \def\etocthenumber {#1}% + \def\etocthelinkednumber {#1}% \Etoc@numbertrue \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}% - \def\etocthename{##1}% +\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}% + \def\etocthename {##1}% + \toks@ {##1}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% }% - \def\Etoc@getnbr ##1\hspace##2##3\etoc@{% + \def\Etoc@getnbr ##1\hspace##2##3\etoc@ {% \ifx\relax##2\else - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5}% - \def\etocthenumber{##1}% + \@namedef {etocnumber }{\leavevmode #1{#2}{#3}{##1}#5}% + \def\etocthenumber {##1}% + \toks@ {##1}% + \edef\etocthelinkednumber {\noexpand\hyperlink {#3}{\the\toks@}}% \Etoc@numbertrue \Etoc@getname ##3\etoc@ - \fi}% - \Etoc@getnbr #4\hspace\relax\etoc@} + \fi + }% + \Etoc@getnbr #4\hspace\relax\etoc@ +} +\newcommand*\etocthename {} +\newcommand*\etocthenumber {} +\newcommand*\etocthepage {} +\newcommand*\etocthelinkedname {} +\newcommand*\etocthelinkednumber {} +\newcommand*\etocthelinkedpage {} +\newcommand*\etocthelink {} \DeclareRobustCommand*{\etocname} {} \DeclareRobustCommand*{\etocnumber}{} \DeclareRobustCommand*{\etocpage} {} @@ -496,14 +539,12 @@ \global\Etoc@notactivetrue \Etoc@tableofcontents}% \endgroup\ifEtoc@mustclosegroup\endgroup\fi} -\def\Etoc@getrefno #1#2\etoc@{#1} +\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}} +\def\Etoc@label#1{\label{#1}\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} +\@firstofone{\def\Etoc@again} {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \def\Etoc@t@bleofcontents{% \ifx\Etoc@nexttoken\label \def\Etoc@next{\expandafter\Etoc@label\@gobble}\else @@ -581,34 +622,34 @@ \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*\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} % modified in 1.07e -\newcommand*\etocseptwo{.5ex \@plus .1ex \@minus .1ex} -\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*\etocseptwo {.5ex \@plus .1ex \@minus .1ex} +\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} + {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}} +\newcommand*\etocabbrevpagename {p.~} +\newcommand*\etocpartname {\partname} +\newcommand*\etocbookname {Book} \def\etocdefaultlines{\Etoc@standardfalse %% `book' in memoir class: \etoc@setstyle{@minustwo} @@ -1074,7 +1115,7 @@ \newcommand*\etocstandardlines{\Etoc@standardtrue} \newcommand*\etoctoclines{\Etoc@standardfalse} % 1.07b \etocdefaultlines % for initialization -\etocstandardlines % removed silly AtBeginDocument temporarily added for 1.07 +\etocstandardlines \etocstandarddisplaystyle \endinput %% -- cgit v1.2.3