diff options
author | Karl Berry <karl@freefriends.org> | 2012-11-25 01:59:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-11-25 01:59:01 +0000 |
commit | feee7474e37064940217473cadf1ec3497cfc513 (patch) | |
tree | e0c725bfae4b06ecc8b8c4800a2317fcc2edec3a /Master/texmf-dist/tex/latex/etoc | |
parent | 6270a65bba8ebd2647c1e34ce161665c1d59cbb9 (diff) |
etoc (24nov12)
git-svn-id: svn://tug.org/texlive/trunk@28354 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etoc')
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 117 |
1 files changed, 66 insertions, 51 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index c269282b0e8..c54f5c95a62 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/23 v1.03 easily customizable TOCs (jfB)] + [2012/11/24 v1.04 easily customizable TOCs (jfB)] %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012 by Jean-Francois Burnol \NeedsTeXFormat{LaTeX2e} @@ -349,6 +349,13 @@ \endgroup} \AtBeginDocument{\Etoc@starttoc} \def\Etoc@toctoc{% + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iifalse + \global\Etoc@ifalse + \global\Etoc@false + \global\Etoc@jfalse \ifEtoc@standard \Etoc@Lazarus \etocsetstyle{@minusone}{}{}{}{}% @@ -370,14 +377,7 @@ \ifEtoc@i \Etoc@end@one\fi \ifEtoc@ \Etoc@end@zero\fi \ifEtoc@j \Etoc@end@minusone\fi -\fi -\global\Etoc@vfalse -\global\Etoc@ivfalse -\global\Etoc@iiifalse -\global\Etoc@iifalse -\global\Etoc@ifalse -\global\Etoc@false -\global\Etoc@jfalse} +\fi} \def\etoc@@startlocaltoc#1#2{% \let\Etoc@next\relax \ifEtoc@localtoc @@ -405,27 +405,10 @@ \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@localtoctrue - \Etoc@localtableofcontents{\Etoc@getref{#1}}} +\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@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@localtoc - \def\Etoc@next{\Etoc@localtableofcontents{\c@etoc@tocid}}% - \else - \ifx\Etoc@nexttoken\ref - \def\Etoc@next{\expandafter\Etoc@ref\@gobble}% - \else - \def\Etoc@next{\begingroup\Etoc@tableofcontents - \ifEtoc@mustclosegroup\expandafter\endgroup\fi - \endgroup\Etoc@mustclosegroupfalse}% - \fi - \fi\fi\fi\Etoc@next} \long\def\Etoc@localtableofcontents#1{% \edef\Etoc@tmp{#1}% \ifnum\Etoc@tmp<\@ne @@ -440,26 +423,49 @@ \Etoc@localtoctrue \let\Etoc@localtop\m@ne \Etoc@stoptocfalse - \Etoc@notactivetrue + \global\Etoc@notactivetrue \Etoc@tableofcontents \endgroup}% - \ifEtoc@mustclosegroup\expandafter\endgroup\fi - \Etoc@mustclosegroupfalse} -\def\tableofcontents{\par\refstepcounter{etoc@tocid}% + \ifEtoc@mustclosegroup\expandafter\endgroup\fi} +\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 + \def\Etoc@next{\Etoc@localtableofcontents{\c@etoc@tocid}}% + \else + \ifx\Etoc@nexttoken\ref + \def\Etoc@next{\expandafter\Etoc@ref\@gobble}% + \else + \def\Etoc@next{\Etoc@localtocfalse + \global\Etoc@notactivefalse + \begingroup\Etoc@tableofcontents + \ifEtoc@mustclosegroup\expandafter\endgroup\fi + \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@localtoctrue + \Etoc@startrue \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} - {\Etoc@localtocfalse + {\Etoc@starfalse \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}} \newcommand\etocsettocstyle[2]{% \long\def\Etoc@tableofcontents {\ifnum\c@tocdepth>-2\let\Etoc@@next\@firstofone\else \let\Etoc@@next\@gobble\fi -\Etoc@@next{#1\Etoc@toctoc - \Etoc@localtocfalse - \ifEtoc@notactive \expandafter\Etoc@toctoc\fi - #2}}} +\Etoc@@next{#1\Etoc@toctoc\let\Etoc@n@xt\relax + \ifEtoc@star\else + \ifEtoc@localtoc + \ifEtoc@notactive + \def\Etoc@n@xt{\Etoc@localtocfalse + \global\Etoc@notactivefalse + \Etoc@toctoc}% + \fi\fi\fi\Etoc@n@xt + #2}}} \newcommand\etocsetstyle[5]{% \long\expandafter\def \csname Etoc@begin@\csname Etoc@#1@\endcsname\endcsname {#2}% @@ -672,7 +678,8 @@ \Etoc@next{\end{multicols}}% \addvspace{\etocbelowtocskip}}} \newcommand\etocframedmphook{\relax} -\newcommand\etocframedbkgcolorcmd{\relax} +\newcommand\etocbkgcolorcmd{\relax} +\newcommand\Etoc@relax{\relax} \newbox\etoc@framed@titlebox \newbox\etoc@framed@contentsbox \newcommand\etocframedstyle[2][2]{% @@ -682,10 +689,16 @@ \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 - \hss{\etocframedbkgcolorcmd - \vrule\@width\wd\z@\@height\ht\z@\@depth\dp\z@}% - \hskip-\wd\z@ - \copy\z@\hss + \hss + \ifx\etocbkgcolorcmd\Etoc@relax\else + \sbox\tw@{\color{white}% + \vrule\@width\wd\z@\@height\ht\z@\@depth\dimen\z@}% + \ifdim\wd\z@<\linewidth \dp\tw@\z@\fi + \box\tw@ + \hskip-\wd\z@ + \fi + \copy\z@ + \hss \hskip-\linewidth \etoctoprulecolorcmd\leaders\etoctoprule\hss% \hskip\wd\z@ @@ -718,22 +731,24 @@ \egroup \vskip\etocinnerbottomsep \egroup + \ifx\etocbkgcolorcmd\Etoc@relax\else \vskip\ht\etoc@framed@titlebox \vskip\dp\etoc@framed@titlebox \hbox to \linewidth{\color@begingroup \etocleftrulecolorcmd\etocleftrule - \etocframedbkgcolorcmd + \etocbkgcolorcmd \leaders\vrule \@height\ht\etoc@framed@contentsbox \@depth\dp\etoc@framed@contentsbox \hss \etocrightrulecolorcmd\etocrightrule \color@endgroup} - \nointerlineskip - \vskip-\dp\etoc@framed@contentsbox - \vskip-\ht\etoc@framed@contentsbox - \vskip-\dp\etoc@framed@titlebox - \vskip-\ht\etoc@framed@titlebox + \nointerlineskip + \vskip-\dp\etoc@framed@contentsbox + \vskip-\ht\etoc@framed@contentsbox + \vskip-\dp\etoc@framed@titlebox + \vskip-\ht\etoc@framed@titlebox + \fi \box\etoc@framed@titlebox\nointerlineskip \hbox to \linewidth{\color@begingroup {\etocleftrulecolorcmd\etocleftrule}% @@ -775,11 +790,11 @@ \fi \Etoc@mustclosegrouptrue \Etoc@next} -\def\etocmulticol{\@ifstar{\global\Etoc@startrue\etoc@multicoltoc} +\def\etocmulticol{\@ifstar{\Etoc@startrue\etoc@multicoltoc} {\Etoc@starfalse\etoc@multicoltoc}} -\def\etocruled{\@ifstar{\global\Etoc@startrue\etoc@ruledtoc} +\def\etocruled{\@ifstar{\Etoc@startrue\etoc@ruledtoc} {\Etoc@starfalse\etoc@ruledtoc}} -\def\etocframed{\@ifstar{\global\Etoc@startrue\etoc@framedtoc} +\def\etocframed{\@ifstar{\Etoc@startrue\etoc@framedtoc} {\Etoc@starfalse\etoc@framedtoc}} \etocetoclines \etocmulticolstyle{\etocstandardheading\contentsname} |