From c3e9c063ce3006193da17016faabd349005f3d2e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Oct 2013 22:47:11 +0000 Subject: etoc (17oct13) git-svn-id: svn://tug.org/texlive/trunk@31932 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/etoc/etoc.sty | 100 +++++++++++++++++------------- 1 file changed, 57 insertions(+), 43 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index a84b3be14fc..b14c7e82397 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} - [2013/10/13 v1.07g Completely customisable TOCs (jfB)] + [2013/10/16 v1.07h Completely customisable TOCs (jfB)] %% %% Package: etoc -%% Version: 2013/10/13 v1.07g +%% Version: 2013/10/16 v1.07h %% Copyright (C) 2012-2013 by Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e} @@ -61,22 +61,22 @@ \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} \def\Etoc@@minustwo@@{-\tw@} \let\Etoc@@minusone@@\m@ne -\let\Etoc@@zero@@ \z@ -\let\Etoc@@one@@ \@ne -\let\Etoc@@two@@ \tw@ -\let\Etoc@@three@@ \thr@@ +\let\Etoc@@zero@@ \z@ +\let\Etoc@@one@@ \@ne +\let\Etoc@@two@@ \tw@ +\let\Etoc@@three@@ \thr@@ \chardef\Etoc@@four@@ 4 \chardef\Etoc@@five@@ 5 -\chardef\Etoc@@six@@ 6 +\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} -\def\Etoc@@two@{two} -\def\Etoc@@three@{three} -\def\Etoc@@four@{four} -\def\Etoc@@five@{five} +\def\Etoc@@zero@ {zero} +\def\Etoc@@one@ {one} +\def\Etoc@@two@ {two} +\def\Etoc@@three@ {three} +\def\Etoc@@four@ {four} +\def\Etoc@@five@ {five} \expandafter\def\csname Etoc@-3@@\endcsname {-\thr@@} \expandafter\let\csname Etoc@-2@@\endcsname \Etoc@@minustwo@@ \expandafter\let\csname Etoc@-1@@\endcsname \Etoc@@minusone@@ @@ -89,7 +89,7 @@ \expandafter\let\csname Etoc@6@@\endcsname \Etoc@@six@@ \let\Etoc@all@@ \Etoc@@five@@ \let\Etoc@none@@ \Etoc@minf -\def\Etoc@levellist{} +\let\Etoc@levellist\@empty \def\Etoc@newlevel#1{% \def\Etoc@levellist@elt{\noexpand\Etoc@levellist@elt\noexpand}% \edef\Etoc@levellist{\Etoc@levellist\Etoc@levellist@elt#1}} @@ -123,16 +123,12 @@ \ifnum#2=-\tw@ \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@ \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@ - \else - \ifnum#2=-\thr@@ - \expandafter\let \csname Etoc@#1@@\expandafter\endcsname - \csname Etoc@-3@@\endcsname \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\fi} +\fi\fi\fi} \etocsetlevel{book}{-2} \etocsetlevel{part}{-1} \etocsetlevel{chapter}{0} @@ -302,7 +298,7 @@ \@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}} \def\Etoc@lxyz #1#2{% \@namedef {etoclink }{\leavevmode}% fall-back - \def\etocthelink {}% fall-back + \let\etocthelink \@empty % 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 @@ -360,8 +356,8 @@ \Etoc@getname #3\etoc@ \else % then \etocthename and \etocthelinkedname already defined \@namedef {etocnumber }{\leavevmode}% - \def\etocthenumber {}% - \def\etocthelinkednumber {}% + \let\etocthenumber \@empty + \let\etocthelinkednumber \@empty \Etoc@numberfalse \fi } @@ -382,8 +378,8 @@ \Etoc@getname ##3\etoc@ \else \@namedef {etocnumber }{\leavevmode}% - \def\etocthenumber {}% - \def\etocthelinkednumber {}% + \let\etocthenumber \@empty + \let\etocthelinkednumber \@empty \Etoc@numberfalse \def\etocthename {#4}% \toks@ {#4}% @@ -544,7 +540,6 @@ \ifnum\Etoc@tmp<\@ne \PackageWarning{etoc} {Unknown toc id: run LaTeX to get references right}% -%%\leavevmode --unknown etoc ref: run latex again--\par (REMOVED IN 1.07g) \let\Etoc@next\@gobble\else\let\Etoc@next\@firstofone\fi \Etoc@next {\edef\etoc@startlocaltoc##1{% @@ -555,6 +550,7 @@ \global\Etoc@notactivetrue \Etoc@tableofcontents}% \endgroup\ifEtoc@mustclosegroup\endgroup\fi + \Etoc@aftertochook % 1.07h \etocaftertochook % 1.07g } \def\Etoc@getrefno #1#2\etoc@ {#1} @@ -579,6 +575,7 @@ \Etoc@tableofcontents \endgroup \ifEtoc@mustclosegroup\endgroup\fi + \Etoc@aftertochook % 1.07h \etocaftertochook % 1.07g }% \fi @@ -656,7 +653,6 @@ \def\etocsepminusone {4ex \@plus .5ex \@minus .5ex} \def\etocsepzero {2.5ex \@plus .4ex \@minus .4ex} \def\etocsepone {1.5ex \@plus .3ex \@minus .3ex} -%%\newcommand*\etocseptwo{1ex \@plus .15ex \@minus .15ex} % modified in 1.07e \def\etocseptwo {.5ex \@plus .1ex \@minus .1ex} \def\etocsepthree {.25ex \@plus .05ex \@minus .05ex} \def\etocbaselinespreadminustwo {1} @@ -1136,30 +1132,45 @@ \addcontentsline {toc}{#1}{#2}} \DeclareRobustCommand*{\etoctoccontentsline} {\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}} +\def\Etoc@settocdepth {\etoc@settocdepth }% for 1.07g->h, to be removed later. \def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth } \def\Etoc@resettocdepth {\global\c@tocdepth\c@etoc@tocdepth } -\def\etocobeytoctocdepth - {\def\Etoc@settocdepth {\afterassignment\Etoc@@settocdepth\global\c@tocdepth}} -\def\Etoc@@settocdepth {\ifnum\c@tocdepth>\c@etoc@tocdepth - \global\c@tocdepth\c@etoc@tocdepth\fi } -\def\etocignoretoctocdepth {\let\Etoc@settocdepth\count@ } +\def\etocobeytoctocdepth {\def\etoc@settocdepth + {\afterassignment\Etoc@@nottoodeep \global\c@tocdepth}} +\def\Etoc@@nottoodeep {\ifnum\c@tocdepth>\c@etoc@tocdepth + \global\c@tocdepth\c@etoc@tocdepth\fi } +\def\etocignoretoctocdepth {\let\etoc@settocdepth\count@ } \def\etocsettocdepth {\futurelet\Etoc@nexttoken\Etoc@set@tocdepth } \def\Etoc@set@tocdepth {\ifx\Etoc@nexttoken\bgroup \expandafter\Etoc@set@tocdepth@ - \else\expandafter\Etoc@set@toctocdepth@ + \else\expandafter\Etoc@set@toctocdepth \fi } \def\Etoc@set@tocdepth@ #1{\@ifundefined {Etoc@#1@@} {\PackageWarning{etoc} {Unknown sectioning unit #1, \protect\etocsettocdepth\space ignored}} {\global\c@tocdepth\csname Etoc@#1@@\endcsname}% } -\def\Etoc@set@toctocdepth@ #1#{\Etoc@set@toctocdepth@@ }% -\def\Etoc@set@toctocdepth@@ #1{% - \@ifundefined{Etoc@#1@@} +\def\Etoc@set@toctocdepth #1#{\Etoc@set@toctocdepth@ } +\def\Etoc@set@toctocdepth@ #1{% + \@ifundefined{Etoc@#1@@}% {\PackageWarning{etoc} - {Unknown sectioning unit #1, \protect\etocsettocdepth.toc ignored}} + {Unknown sectioning depth #1, \protect\etocsettocdepth.toc ignored}}% {\addtocontents {toc} - {\protect\Etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}% + {\protect\etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}% +} +\def\etocdepthtag #1#{\Etoc@depthtag } % \etocdepthtag.toc {name} +\def\Etoc@depthtag #1{\addtocontents {toc}{\protect\etoc@depthtag {#1}}} +\def\etocignoredepthtags {\let\etoc@depthtag \@gobble } +\def\etocobeydepthtags {\let\etoc@depthtag \Etoc@depthtag@ } +\def\Etoc@depthtag@ #1{\@ifundefined{Etoc@depthof@#1}% + {}% ignore in silence if tag has no associated depth + {\afterassignment\Etoc@@nottoodeep + \global\c@tocdepth\csname Etoc@depthof@#1\endcsname}% +} +\def\etocsettagdepth #1#2{\@ifundefined{Etoc@#2@@}% + {\PackageWarning{etoc} + {Unknown sectioning depth #2, \protect\etocsettagdepth\space ignored}}% + {\@namedef{Etoc@depthof@#1}{\@nameuse{Etoc@#2@@}}}% } \def\Etoc@tocvsec@err #1{\PackageError {etoc} {the command \protect#1\space is incompatible with etoc} @@ -1182,9 +1193,6 @@ \protect\etocsettocdepth.toc as a replacement^^J for the tocvsec2 toc-related commands}}{}% }% -\addtocontents {toc}{\protect\@ifundefined{etocsetstyle}% - {\let\protect\Etoc@settocdepth\count@ - \let\protect\etoc@startlocaltoc\protect\@gobble }{}}% \def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }% \def\invisiblelocaltableofcontents {\etocsetnexttocdepth {-3}\localtableofcontents }% @@ -1192,17 +1200,23 @@ \@ifundefined{Etoc@#1@@} {\PackageWarning{etoc} {Unknown sectioning unit #1, \protect\etocsetnextocdepth\space ignored}} - {\edef\etocaftertochook {\global\c@tocdepth\the\c@tocdepth\space - \let\noexpand\etocaftertochook\noexpand\@empty }% + {\edef\Etoc@aftertochook {\global\c@tocdepth\the\c@tocdepth\space + \let\noexpand\Etoc@aftertochook\noexpand\@empty }% \global\c@tocdepth\csname Etoc@#1@@\endcsname}% }% +\addtocontents {toc}{\protect\@ifundefined{etoctocstyle}% + {\let\protect\etoc@startlocaltoc\protect\@gobble + \let\protect\etoc@settocdepth\count@ + \let\protect\etoc@depthtag\protect\@gobble }{}}% \def\etocstandardlines {\Etoc@standardtrue} \def\etoctoclines {\Etoc@standardfalse} \etocdefaultlines \etocstandardlines \etocstandarddisplaystyle \etocobeytoctocdepth -\let\etocaftertochook\@empty +\etocobeydepthtags +\let\Etoc@aftertochook\@empty % private for \etocsetnexttocdepth +\let\etocaftertochook \@empty % public for end user. \endinput %% %% End of file `etoc.sty'. -- cgit v1.2.3