diff options
author | Karl Berry <karl@freefriends.org> | 2012-12-02 02:11:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-12-02 02:11:18 +0000 |
commit | 23916347932fe1f7bae3f1f8c84b8f1cfcfcfa4c (patch) | |
tree | 46aa39857fc2db6e5cb335d724e70552e05d0299 /Master/texmf-dist/source/latex/etoc | |
parent | f301971c765ec63fcf2461d3c69cd73792f2f3a2 (diff) |
etoc (1dec12)
git-svn-id: svn://tug.org/texlive/trunk@28411 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/etoc')
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.dtx | 140 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.ins | 3 |
2 files changed, 82 insertions, 61 deletions
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index 43d05544b5d..353d832f5dc 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx @@ -3,13 +3,13 @@ %% Copyright (C) 2012 by Jean-Francois Burnol %<*ins> \def\pkgname{etoc} -\def\pkgdate{2012/11/28} +\def\pkgdate{2012/12/01} \def\pkgversion{v1.05} \def\pkgdescription{easily customizable TOCs (jfB)} %</ins> %<*none> -\def\lasttimestamp{Time-stamp: <29-11-2012 19:26:40 CET jfb>} -\def\docdate{2012/11/29} +\def\lasttimestamp{Time-stamp: <01-12-2012 13:48:11 CET jfb>} +\def\docdate{2012/12/01} \def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4} \edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp} \ProvidesFile{\pkgname.dtx} @@ -241,7 +241,7 @@ test all their bells and whistles in the presence of \etoctoclines \etocmarkboth\contentsname \etocmulticolstyle{} -\tableofcontents* \label{toc:main} +\tableofcontents \label{toc:main} \part{Overview} @@ -483,7 +483,7 @@ should use the original: \toc|\ref{toc:c}|. The \cs{label} command should follow \toc before the reference via \cs{ref} to the other TOC. Indeed a \cs{label} following it is -detected by \toc (skipping spaces and an optional \texttt\lowast) A +detected by \toc (skipping spaces and an optional \texttt\lowast). A \cs{label} after the \cs{ref} will not be treated by \etoc itself and will refer to the latest reference point, possibly to some counter updated in the title of the TOC or, although @@ -778,7 +778,7 @@ syntax {\ttfamily label=\char32} from the package |enumitem|: {\etocname (page \etocpage)} {\end{enumerate}} \end{verbatim} -Rather than just\cs{etocnumber} we then used something like +Rather than just \cs{etocnumber} we then used something like |\fbox{\etocnumber}|. @@ -1016,7 +1016,7 @@ following type: \etocruledstyle[1]{Title} \tableofcontents (or \localtableofcontents) shortcuts: - \etocruled[1]{Title} (or \localetocruled[1]{Title}) + \etocruled[1]{Title} (or \etoclocalruled[1]{Title}) \end{verbatim} \subsection{The command \csbhyp{etocruledstyle}} @@ -1061,7 +1061,7 @@ specified style. A shortcut for just one table of contents and not affecting the styles of later TOCs is:\\ \centerline{\cs{etocmulticol}\oarg{number\_of\_columns}\marg{heading}} And there is also -\cs{localetocmulticol}\oarg{number\_of\_columns}\marg{heading}. +\cs{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}. \subsubsection{The command \csbhyp{etoctocstyle}} @@ -1117,7 +1117,7 @@ As a shortcut to set the style and issue a so that future table of contents will not be affected, there is:\\ \centerline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}} -And the local form will be \csb{localetocruled}. +And the local form will be \csb{etoclocalruled}. \subsection{The commands \csbhyp{etocframedstyle} and \csbhyp{etocframed}} @@ -1130,8 +1130,8 @@ Here the entire table of contents is framed, hence this can only work if it fits on a page. Note that the title itself is not framed, if one wants a frame one should set it up inside the \meta{title} argument to \cs{etocframedstyle} or -\cs{etocframed}. There is also \cs{local\-etocframedstyle} and -\cs{localetocframed}. +\cs{etocframed}. There is also \cs{etoc\-localframedstyle} and +\cs{etoclocalframed}. \subsection{The command \csbhyp{etocsettocstyle}} @@ -1168,29 +1168,34 @@ file, as is the usage for the original \toc command in that class, whereas the starred variants do not, as is the habit in that class. -To customize what is written to the |.toc| file by the -non-starred variants there is the command -\csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name}, where -\meta{kind} is |chapter|, or |section|, ... and \meta{name} -can be for example \cs{contentsname}. The default is |chapter| -and |\contentsname|. - -Note though that this concerns only what is written to the -|.toc| file: the unstarred commands have an interest only if -the heading of the TOC was typeset using a suitable -\emph{unnumbered} division command (\emph{e.g.} using -\cs{etoctocstyle}), which should be chosen by the user to be -identical to the \meta{kind} argument above. In compatibility -mode for the global style, the |memoir| class will use a -Chapter like heading if the user has not customized it to do -otherwise: this will not fit well with local table of contents in -sections, and even chapters. - -Generally speaking there is hook macro called -\csb{etocaftertitlehook} which is defined initially to do -nothing, except for the |memoir| class for which it does the -above, and which is inhibited by using the starred variants of -the displaying commands. +As soon as one starts using local table of contents one +discovers that the default |memoir| thing which is to create a +|chapter| entry for each TOC is not convenient. The command +\csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} will change +the format (\meta{kind} is |chapter|, |section|, |subsection|... and +\meta{name} can be for example \cs{contentsname}.) The initial set-up +is with |chapter| and |\contentsname|. + +The format of the actual heading of the TOC should also be set +appropriately (for example with \cs{etoctocstyle}), to use the +identical division unit as in the first argument to +\cs{etocmemoirtoctotocfmt}. + +A weird situation arises when one has two successive +\cs{localtableofcontents} (obviously this is not a truly real +life situation), just after a \cs{part} for example. The first +one creates (if the default has not been modified as indicated +above) a Chapter heading which is +written to the |.toc|. Then the second one thinks to be local +to this chapter . . . and as a result it displays nothing. The +fix is to define the second one to be a clone of the first +one. + +Independently of the situation with the |memoir| class there is +generally speaking a hook macro called +\csb{etocaftertitlehook} which is inhibited by using the +starred variants of the displaying commands. Except for the +|memoir| class, this hook is initially defined to do nothing. \section{Table of contents for part \ref{part:globalcmds}} @@ -1342,11 +1347,11 @@ class commands.} \toc\\ \localtoc\\ \cs{etocmulticol}\oarg{number\_of\_columns}\marg{heading}\\ - \cs{localetocmulticol}\oarg{number\_of\_columns}\marg{heading}\\ + \cs{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}\\ \cs{etocruled}\oarg{number\_of\_columns}\marg{title}\\ - \cs{localetocruled}\oarg{number\_of\_columns}\marg{title}\\ + \cs{etoclocalruled}\oarg{number\_of\_columns}\marg{title}\\ \cs{etocframed}\oarg{number\_of\_columns}\marg{title}\\ - \cs{localetocframed}\oarg{number\_of\_columns}\marg{title}\\ + \cs{etoclocalframed}\oarg{number\_of\_columns}\marg{title}\\ \hbox{}{\itshape\ttfamily\ \ \ \ and their starred variants} }}} @@ -1369,8 +1374,10 @@ can be followed with optional labels or references:\par }}} -\medskip The local table of -contents does not react to a \cs{ref} following it. When +\medskip The commands for local tables of +contents do \emph{not} react to a \cs{ref} following them. + +When re-displaying another toc, only its contents are transferred: both the line styles and the global style are the ones currently defined, not the ones from the cloned toc. @@ -1775,7 +1782,7 @@ macros \cs{etocname}, \cs{etocnumber}, and \cs{etocpage} contain the |hyperref| links, if present (note that the |linktoc=all| option of |hyperref| tells it to put a link also in the page number corresponding to a given toc entry). The -table of contents of the present document are fully linked. +tables of contents of the present document are fully linked. The contents of the |.toc| file are read into memory by \etoc once, at the \cs{begin\{document\}} (and not at the first @@ -2419,8 +2426,11 @@ release. \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 +\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}} @@ -2456,7 +2466,7 @@ release. \def\localtable@fcontents{\par \refstepcounter{etoc@tocid}% \addtocontents{toc} - {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}% + {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}} \Etoc@tocwithidtrue \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \def\tableofcontents{\@ifstar @@ -2722,7 +2732,7 @@ release. \newcommand\etoc@ruledheading[1]{% \hb@xt@\linewidth{\color@begingroup \hss #1\hss\hskip-\linewidth - \etoctoprulecolorcmd\leaders\etoctoprule\hfil + \etoctoprulecolorcmd\leaders\etoctoprule\hss \phantom{#1}% \leaders\etoctoprule\hss\color@endgroup}% \nointerlineskip\vskip\etocinnertopsep} @@ -2804,7 +2814,7 @@ release. \egroup \vskip\etocinnerbottomsep \egroup - \vbox{\hsize\linewidth + \vbox{\hsize\linewidth \ifx\etocbkgcolorcmd\Etoc@relax\else \kern\ht\etoc@framed@titlebox \kern\dp\etoc@framed@titlebox @@ -2816,12 +2826,11 @@ release. \@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 + \color@endgroup}\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 \hb@xt@\linewidth{\color@begingroup @@ -2897,17 +2906,17 @@ release. \@ifstar {\etoc@framedtoci} {\etoc@framedtoc}} -\newcommand\localetocmulticol{\begingroup +\newcommand\etoclocalmulticol{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@multicoltoci} {\etoc@local@multicoltoc}} -\newcommand\localetocruled{\begingroup +\newcommand\etoclocalruled{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@ruledtoci} {\etoc@local@ruledtoc}} -\newcommand\localetocframed{\begingroup +\newcommand\etoclocalframed{\begingroup \Etoc@mustclosegrouptrue \@ifstar {\etoc@local@framedtoci} @@ -2943,17 +2952,30 @@ release. \let\etocreportstyle\etocbookstyle \let\etocreportstylenomarks\etocbookstylenomarks % \end{macrocode} -% placeholder for comments +% placeholder for comments. December 1, 11:33 Very weird +% problem with the two successive \cs{addtocontents} (one for +% \cs{etoc@startlocaltoc} and the next one here for the memoir +% class and unstarred \cs{tableofcontents}). They are not put +% in the correct order into the aux file hence into the toc +% file. It is very weird that if the aux file already exists +% due to a previous latex run where the user had put * after +% the TOC displaying command, the things end up in the correct +% order in the new aux file, hence things work correctly. +% Anyway, \cs{etocaftertitlehook} is defined here in a strange +% way which empirically seems to solve the problem. v1.05a % \begin{macrocode} +\newcommand\Etoc@addcontentsline{} \newcommand\etocmemoirtoctotocfmt[2]{% - \renewcommand\etocaftertitlehook{\ifmem@em@starred@listof \else - \phantomsection \addcontentsline {toc}{#1}{#2}\fi}} + \renewcommand\Etoc@addcontentsline{\addcontentsline {toc}{#1}{#2}}% + \renewcommand\etocaftertitlehook{% + \ifmem@em@starred@listof + \else\phantomsection\aftergroup\Etoc@addcontentsline\fi}} \newcommand\etocmemoirstyle{% \etocsettocstyle {\ensureonecol \par \begingroup \@nameuse {@tocmaketitle} \Etoc@aftertitlehook\let\Etoc@aftertitlehook\relax \parskip \cftparskip \@nameuse {cfttocbeforelisthook}} - {\@nameuse {cfttocafterlisthook}\endgroup \restorefromonecol}} + {\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}} % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3061,7 +3083,7 @@ release. Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{2536} +\CheckSum{2542} \Finale %% diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins index b7d5e068036..f12eac492d3 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.ins +++ b/Master/texmf-dist/source/latex/etoc/etoc.ins @@ -1,8 +1,7 @@ %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012 by Jean-Francois Burnol -\def\lasttimestamp{Time-stamp: <29-11-2012 19:26:40 CET jfb>} \def\pkgname{etoc} -\def\pkgdate{2012/11/28} +\def\pkgdate{2012/12/01} \def\pkgversion{v1.05} \def\pkgdescription{easily customizable TOCs (jfB)} %% |