diff options
author | Karl Berry <karl@freefriends.org> | 2013-02-24 22:52:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-02-24 22:52:02 +0000 |
commit | c8a9826216b33cc752a7d5f5502bbf565e07d002 (patch) | |
tree | bdf0f4acd3bec9fdcffed64075aa80e9dca57d13 /Master | |
parent | 1bf864481b4d669293f0176fd20de5c60c4bc00f (diff) |
etoc (24feb13)
git-svn-id: svn://tug.org/texlive/trunk@29222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/etoc/README | 31 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/etoc/etoc.pdf | bin | 219091 -> 221047 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.dtx | 763 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 126 |
5 files changed, 488 insertions, 436 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/README b/Master/texmf-dist/doc/latex/etoc/README index 282f23d382a..94dbc6ebcd4 100644 --- a/Master/texmf-dist/doc/latex/etoc/README +++ b/Master/texmf-dist/doc/latex/etoc/README @@ -1,6 +1,10 @@ +version 1.07d (2013/02/24) - Package `etoc' (v1.07c, 2013/02/22) - Copyright (C) 2012, 2013 by Jean-Francois Burnol + Package `etoc' + + Copyright (C) 2012, 2013 by Jean-Francois Burnol + + *** License information *** The source file etoc.dtx and its derived files may be distributed and/or modified under the conditions of the @@ -14,7 +18,7 @@ LaTeX version 2003/12/01 or later. - Installation + *** Installation *** `latex etoc.dtx' creates the file `etoc.sty'. `latex etoc.dtx' (twice more) finishes producing the documentation. @@ -24,7 +28,8 @@ The other generated files may be discarded. - Abstract + + *** Abstract *** The etoc package gives to the user complete control on how the entries of the table of contents should be constituted @@ -55,18 +60,20 @@ tables of contents related to the document sectioning units. No auxiliary file is used apart from the usual .toc file. - Change log - v1.07c [2013/02/22] +Change log +========== + + v1.07d [2013/02/24] - minor code changes and new documentation section - "Another compatibility mode". + minor code improvements and new documentation + section "Another compatibility mode". v1.07b [2013/02/02] - decision is made to remove the \xspace from the - macros \etocname, \etocnumber, \etocpage. + removal of the \xspace from the macros \etocname, + \etocnumber, \etocpage. additional examples in the documentation. @@ -83,8 +90,8 @@ modified command: \etocmulticolstyle - new documentation section `surprising uses of etoc' which - explains how to do `lists of arbitrary things', in + new documentation section "Surprising uses of etoc" which + explains how to do "Lists of arbitrary things", in addition to the tables of contents. diff --git a/Master/texmf-dist/doc/latex/etoc/etoc.pdf b/Master/texmf-dist/doc/latex/etoc/etoc.pdf Binary files differindex fa0a3afc5a4..160054fa73a 100644 --- a/Master/texmf-dist/doc/latex/etoc/etoc.pdf +++ b/Master/texmf-dist/doc/latex/etoc/etoc.pdf diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index afd0241d96a..db36e5fbbc7 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx @@ -1,8 +1,8 @@ % -*- coding: iso-latin-1; -*- %<*ins> \def\pkgname{etoc} -\def\pkgdate{2013/02/22} -\def\pkgversion{v1.07c} +\def\pkgdate{2013/02/24} +\def\pkgversion{v1.07d} \def\pkgdescription{easily customizable TOCs (jfB)} %</ins> %% @@ -10,8 +10,8 @@ %% Copyright (C) 2012, 2013 by Jean-Francois Burnol %% %<*none> -\def\lasttimestamp{Time-stamp: <22-02-2013 09:48:08 CET jfb>} -\def\docdate{2013/02/22} +\def\lasttimestamp{Time-stamp: <24-02-2013 12:23:39 CET jfb>} +\def\docdate{2013/02/24} \def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4} \edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp} \ProvidesFile{\pkgname.dtx} @@ -133,15 +133,15 @@ pdfpagemode=UseOutlines} % \def\href#1#2{{#2}} % \makeatother -\DeclareRobustCommand\cs[1]{{\ttfamily\hyphenchar\font45\char`\\#1}} +\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45\char`\\#1}} \DeclareRobustCommand\csb[1]{{% \color{blue}\ttfamily\hyphenchar\font45\char`\\#1}} -\newcommand\cshyp[1]{\texorpdfstring{\cs{#1}}{\textbackslash #1}} +\newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}} \newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}} \newcommand\lowast{\raisebox{-.25\height}{*}} -\newcommand\starit[1]{\cs{#1\lowast}} +\newcommand\starit[1]{\csa{#1\lowast}} \newcommand\staritb[1]{\csb{#1\lowast}} @@ -197,8 +197,8 @@ pdfpagemode=UseOutlines} \makeatother -\newcommand\toc{\cs{table\-of\-contents}\xspace} -\newcommand\localtoc{\cs{local\-table\-of\-contents}\xspace} +\newcommand\toc{\csa{table\-of\-contents}\xspace} +\newcommand\localtoc{\csa{local\-table\-of\-contents}\xspace} \newcommand\tocb{\csb{table\-of\-contents}\xspace} \newcommand\localtocb{\csb{local\-table\-of\-contents}\xspace} @@ -209,6 +209,11 @@ pdfpagemode=UseOutlines} \hyphenation{toc-depth sec-num-depth etoc-framed-style etoc-ruled-style} \hyphenation{etoc-toc-style-with-marks etoc-ruled etoc-framed} \hyphenation{etoc-stan-dard-display-style} +\hyphenation{etoc-the-page etoc-the-name etoc-the-num-ber etoc-if-num-bered} +\hyphenation{etoc-link etoc-stan-dard-lines etoc-toc-lines} +\hyphenation{etoc-in-ner-top-sep} + + \frenchspacing @@ -242,11 +247,11 @@ pdfpagemode=UseOutlines} simplest usage will be to take advantage of the layout facilities of packages dealing with list environments. - The \cs{tableofcontents} command may be used arbitrarily - many times and it has a variant \cs{localtableofcontents} + The \csa{tableofcontents} command may be used arbitrarily + many times and it has a variant \csa{localtableofcontents} which prints tables of contents `local' to the current surrounding document unit. An extension of the - \cs{label}/\cs{ref} syntax allows to reproduce (with another + \csa{label}/\csa{ref} syntax allows to reproduce (with another layout) a TOC defined somewhere else in the document. The formatting inherited (and possibly customized by other @@ -278,7 +283,7 @@ buried in the class definitions. In particular, most of the lengths therein are hardcoded, and the only way for the user to change them is to recopy the class definitions into the document and then change them to obtain what is desired -(within suitable \cs{makeatletter} and \cs{makeatother}). +(within suitable \csa{makeatletter} and \csa{makeatother}). The more reasonable alternative is to use a dedicated package such as |tocloft| or to use another flexible document class. @@ -308,51 +313,56 @@ compatible with the |article|, |book|, |report|, |scrartcl|, \begingroup -\def\MacroFont{\footnotesize\normalfont\baselineskip10pt\relax} +\renewcommand\lowast{{\normalsize\raisebox{-.4\height}{*}}} \section*{\bfseries\small Change history} \setlength{\columnsep}{\etoccolumnsep} \makeatletter -\def\@verbatim{\leftskip \z@ \parindent \z@ \parfillskip \@flushglue -\parskip \tw@\p@ plus 1fil\relax -\let \do \@makeother \dospecials\catcode`\~\active \obeyspaces} - -\def\endverbatim{} \let\@vobeyspaces\relax +\def\jfverbatim{\@beginparpenalty \predisplaypenalty + %\leftskip \z@ + \parindent \z@ + \parfillskip \@flushglue + \parskip \tw@\p@ plus 1fil\relax + \let \do \@makeother \dospecials + \catcode`\~\z@ + \footnotesize\normalfont\baselineskip10pt\relax + \frenchspacing \obeyspaces \jf@xverbatim } -\newdimen\jfdim -\everypar{\leftskip\jfdim\bgroup - \def\par{\egroup\jfdim\z@\@@par}% - \def\jfspace#1{\ifcat\noexpand#1\noexpand~\unskip\else\ \fi#1}} - -\begingroup\obeyspaces\def\x{\endgroup% -\def {\ifvmode\advance\jfdim.5em\relax\else\expandafter\jfspace\fi}}\x -\begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 +\begingroup +\catcode `|=0 \catcode `[= 1 \catcode`]=2 \catcode `\{=12 \catcode `\}=12 \catcode`\\=12 -|long|gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]] +|long|gdef|jf@xverbatim#1\end{jfverbatim}[#1|end[jfverbatim]] |endgroup -\makeatother +\def\endjfverbatim{} -\let~\columnbreak +\newdimen\jfverbadim -\hyphenation{etocthe-page} +\everypar{\leftskip\jfverbadim\bgroup + \def\par{\egroup\jfverbadim\z@\@@par}% + \def\jfverbaspace#1{\ifcat\noexpand#1\noexpand~\unskip\else\ \fi#1}} + +\begingroup\obeyspaces\def\x{\endgroup% +\def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x + +\makeatother \begin{multicols}{2} -\begin{verbatim} -v1.07c [2013/02/22] +\begin{jfverbatim} +v1.07d [2013/02/24] - minor code changes and new documentation section - "Another compatibility mode". + minor code improvements and new documentation + section "Another compatibility mode". v1.07b [2013/02/02] - decision is made to remove the \xspace from the - macros \etocname, \etocnumber, \etocpage. + removal of the \xspace from the macros \etocname, + \etocnumber, \etocpage. additional examples in the documentation. @@ -363,18 +373,18 @@ v1.07 [2013/01/29] \etocthename, \etocthenumber, \etocthepage, \etoclink, - \etoctoccontentsline, \etoctoccontentsline* + \etoctoccontentsline, \etoctoccontentsline~lowast \etocnopar, \etocaftercontentshook modified command: \etocmulticolstyle - new documentation section `surprising uses of etoc' which - explains how to do `lists of arbitrary things', in + new documentation section "Surprising uses of etoc" which + explains how to do "Lists of arbitrary things", in addition to the tables of contents. -~v1.06 [2012/12/07] +~columnbreak v1.06 [2012/12/07] the standard macros \l@section etc... are modified only during the calls to \tableofcontents; they can thus be @@ -385,7 +395,7 @@ v1.07 [2013/01/29] v1.05 [2012/12/01] - \localtableofcontents replaces \tableofcontents* (for + \localtableofcontents replaces \tableofcontents~lowast (for compatibility with the memoir class). compatibility with KOMA-script and memoir document @@ -408,7 +418,7 @@ v1.02 [2012/11/18] initial version. -\end{verbatim} +\end{jfverbatim} \end{multicols} \endgroup @@ -431,21 +441,26 @@ v1.02 [2012/11/18] \section{Initial motivation: nested lists} -The initial impetus was to feed nested -list environments with the data consisting of the \emph{name}, -\emph{number}, and \emph{page number} as recorded in the -|.toc| file.\footnote{I got - started about this through reading this question on the - \TeX{} Stackexchange site:\\ -\href{http://tex.stackexchange.com/questions/79682/can-i-get-a-list-of-all-sections-as-a-simple-enumerate-list}{tex.stackexchange.com/questions/79682}} -For example, typesetting -the line corresponding to the first sub-section in a given -section would open a list environment which would be closed only when a -section, chapter, or part line entry in the |.toc| file would -be encountered. \etoc allows to do this very easily -and the opening and closing may be for example -|\begin{enumerate}| and |\end{enumerate}| pairs, will all the -customizing allowed by packages such as |enumitem|. +The initial impetus was to feed nested list environments +with the data consisting of the \emph{name} +(\csb{etocname}), \emph{number} (\csb{etocnumber}), and +\emph{page number} (\csb{etocpage}) as +recorded\footnote{the \emph{number} has to be disentangled + from the \emph{name}, and in case |hyperref| is present, the + hyperlink has to be redistributed around each of them.} in the +|.toc| file. +% \footnote{I got started about this through +% reading this question on the +% \TeX{} Stackexchange site: +% \href{http://tex.stackexchange.com/questions/79682/can-i-get-a-list-of-all-sections-as-a-simple-enumerate-list}{tex.stackexchange.com/questions/79682}} +For example, typesetting the line corresponding to the first +sub-section in a given section would open a list environment +which would be closed only when a section, chapter, or part +line entry in the |.toc| file would be encountered. \etoc +allows to do this very easily and the opening and closing +may be for example |\begin{enumerate}| and |\end{enumerate}| +pairs, will all the customizing allowed by packages such as +|enumitem|. \subsection{Limitations intrinsic to the use of environments} \label{ssec:limitations} @@ -464,8 +479,8 @@ tried alternating them and did succeed to nest 6 levels (and not 8 alas . . . \footnote{this is surely a well-known issue which I did not at all investigate any further.}). With -\csb{etocnumber} as the optional parameter to \cs{item}: -\cs{item}|[\etocnumber]| one may transform the itemize into an +\csb{etocnumber} as the optional parameter to \csa{item}: +\csa{item}|[\etocnumber]| one may transform the itemize into an enumerated list... anyway, 4 levels of sectional divisions in a TOC are generally sufficient, and again using |enumerate| environments is only a possibility provided by \etoc, it is by @@ -492,8 +507,8 @@ lack of a better name) which tells how the title should be set, whether an entry in the |.toc| file should be made, whether the contents should be typeset with multiple columns, etc... the latter is governed by the command -\cs{etocsettocstyle} (or some higher-level commands) and the -former by the command \cs{etocsetstyle}. +\csa{etocsettocstyle} (or some higher-level commands) and the +former by the command \csa{etocsetstyle}. \subsection{\csbhyp{etocsettocstyle} for the toc display} @@ -515,8 +530,8 @@ These commands must be followed either by \toc or \localtoc. \subsection{\csbhyp{etocsetstyle} for the line styles} -The command to inform \etoc of what to do with \cs{etocname}, -\cs{etocnumber}, and \cs{etocpage} is called +The command to inform \etoc of what to do with \csa{etocname}, +\csa{etocnumber}, and \csa{etocpage} is called \csb{etocsetstyle}. It has five mandatory arguments. The first one is the name of the sectional unit: a priori known names are |book|, |part|, |chapter|, |section|, |subsection|, @@ -542,22 +557,22 @@ document class.\footnote{for the ``toc display style'' |% `toc display' as without \usepackage{etoc}| -If the command \cs{etocsetstyle} has not been used in the +If the command \csa{etocsetstyle} has not been used in the preamble the package will be at |\begin{document}| in this - compatibility mode: hence just adding \cs{usepackage\{etoc\}} + compatibility mode: hence just adding \csa{usepackage\{etoc\}} should hopefully not change anything to the look of a previously existing document, under the |article|, |book|, |report|, |scrartcl|, |scrbook|, |scrreprt| and |memoir| classes. - Any use of \cs{etocsetstyle} in the preamble or body of the + Any use of \csa{etocsetstyle} in the preamble or body of the document turns off the compatibility mode for line styles (but not for the global display style; for this one needs to - use the command \cs{etocsettocstyle}). + use the command \csa{etocsettocstyle}). -To exit after \cs{etocstandardlines} from compatibility mode +To exit after \csa{etocstandardlines} from compatibility mode one uses the command \csb{etoctoclines}, which re-activates -the latest line styles as defined by \cs{etocsetstyle} (if +the latest line styles as defined by \csa{etocsetstyle} (if their scope was not limited to a group or environment). The command \csb{etocdefaultlines} resets the line styles to be the package initial default ones. @@ -565,10 +580,10 @@ the package initial default ones. \section{Arbitrarily many TOCs, and local ones too} -\etoc allows arbitrarily many \cs{tableofcontents} commands in +\etoc allows arbitrarily many \csa{tableofcontents} commands in your document. The line styles and the toc display style may of course be changed in-between. Furthermore -\cs{localtableofcontents} will print local tables of +\csa{localtableofcontents} will print local tables of contents\footnote{Up to version |1.04| we called this \starit{tableofcontents}, but for reasons of compatibility with the |memoir| class, we have decided to drop this @@ -582,9 +597,9 @@ subsection, etc . . . \subsection{Labeling and reusing elsewhere} -\etoc allows the labeling of a TOC with \cs{label\{toc:A\}} +\etoc allows the labeling of a TOC with \csa{label\{toc:A\}} and will redisplay it elsewhere when told -\cs{tableofcontents}\cs{ref\{toc:A\}}. The actual layout +\csa{tableofcontents}\csa{ref\{toc:A\}}. The actual layout (title inclusive) used for the cloned TOC will be decided locally. The line styles and toc display style (including the title) will be the current ones and the current value of the @@ -606,7 +621,7 @@ of contents of Part \ref{part:custom}: We actually did something like:\\ \hbox to \linewidth{\hss - \toc\space\cs{label}|{toc:d}|\cs{ref}|{toc:c}|\hss} Hence + \toc\space\csa{label}|{toc:d}|\csa{ref}|{toc:c}|\hss} Hence \hyperref[toc:d]{\color{niceone}the present location} can itself now be referred to via |\ref{toc:d}|: it gives the id of this TOC\footnote{\emph{i.e} @@ -640,22 +655,22 @@ option to |hyperref|, so as to not have to reset |tocdepth| each time its value was changed. \subsection{On manually adding layout commands to the - \texorpdfstring{\ttfamily .toc}{.toc} file} + \texorpdfstring{\texttt{.toc}}{.toc} file} When displaying in that way many tables of contents in the same document one should of course beware of the impact of adding manually things to the |.toc| file. For example, inserting\\ \hbox to \linewidth{\hss - \cs{addtocontents}|{toc}{\string\clearpage}|\hss} just -before a \cs{part} to fix the problem when some part entry (in + \csa{addtocontents}|{toc}{\string\clearpage}|\hss} just +before a \csa{part} to fix the problem when some part entry (in the table of contents) is isolated at the bottom of one page, -will cause problems with multiple TOCs: this \cs{clearpage} +will cause problems with multiple TOCs: this \csa{clearpage} will be executed by \etoc each time a \toc or \localtoc command is encountered! The more prudent thing is to have issued rather:\\ \hbox to -\linewidth{\hss\cs{addtocontents}|{toc}{\string\myclearpage}|,\hss} +\linewidth{\hss\csa{addtocontents}|{toc}{\string\myclearpage}|,\hss} to have a |\let\myclearpage\relax| at the top level of the document and to use where needed something like: \begin{verbatim} @@ -663,18 +678,18 @@ document and to use where needed something like: \tableofcontents \let\myclearpage\relax \end{verbatim} -The |memoir| class has the command \cs{settocdepth} which -writes a \cs{changetoc\-depth} command inside the |.toc| file. +The |memoir| class has the command \csa{settocdepth} which +writes a \csa{changetoc\-depth} command inside the |.toc| file. This will impact the typesetting by \etoc of \emph{all} tables of contents, with possibly unexpected results: imagine the -document has \cs{settocdepth}|{chapter}| at some point to +document has \csa{settocdepth}|{chapter}| at some point to avoid having the sections from subsequent chapters be listed in the main table of contents. Then a local table of contents in one of these chapters will print a title but will be -without any entry. A solution is to do \cs{begingroup} -|\renewcommand*\changetocdepth[1]{}| \cs{localtableofcontents} -\cs{endgroup}, and to set the desired level for the local -table of contents with the other |memoir| command \cs{maxtocdepth}. +without any entry. A solution is to do \csa{begingroup} +|\renewcommand*\changetocdepth[1]{}| \csa{localtableofcontents} +\csa{endgroup}, and to set the desired level for the local +table of contents with the other |memoir| command \csa{maxtocdepth}. \footnote{The |memoir| class allows multiple calls to the \toc command, so these issues already arise there, independently of \etoc, see page 170 of the |memoir| @@ -686,7 +701,7 @@ The intrinsic levels manipulated by \etoc are numeric: from |-2| (which corresponds to |book| in the |memoir| class) down to |5| (|subparagraph|). But the assignment of a numeric level to a given name can be modified at any time with the command -\cs{etocsetlevel}\marg{level\_name}\marg{n}. In conjunction +\csa{etocsetlevel}\marg{level\_name}\marg{n}. In conjunction with the use of the \LaTeX{} |tocdepth| counter, this has powerful applications: \meta{level\_name} does not have to coincide with an actual document sectioning command, and \etoc @@ -698,12 +713,12 @@ explained further in the section \ref{sec:surprising}. Immediately after the line in the source file starting with the first -\cs{part} we wrote: +\csa{part} we wrote: % -% The \cs{label} command should follow \toc before the reference via -% \cs{ref} to the other TOC. Indeed a \cs{label} following it is +% The \csa{label} command should follow \toc before the reference via +% \csa{ref} to the other TOC. Indeed a \csa{label} following it is % detected by \toc (skipping spaces and an optional \texttt\lowast). A -% \cs{label} after the \cs{ref} will not be treated by \etoc +% \csa{label} after the \csa{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 % this would require the user to have done a suitable set-up in the @@ -902,10 +917,21 @@ have the possibility explained earlier to use nested |enumerate| environments, of course this means mastering another syntax. -However, using as here the \TeX{} primitives |\par|, -|\leftskip|, |\rightskip|, \cs{parfillskip}, ... is by far the +However, using as here the \TeX{} primitive |\par|,\footnote{\csa{par} is + redefined by \LaTeX{} but this is of no immediate + relevance here.} and basic skip registers +|\leftskip|, |\rightskip|, \csa{parfillskip}, ... is by far the surest way to completely understand and master what happens. -Any user of \LaTeX{} should learn their signification. +Any user of \LaTeX{} should learn their +signification. +% \footnote{I am always slightly bemused to +% observe that some, not the majority perhaps, of \LaTeX{} +% experts and advisers are prompt to say ``don't do this, don't do that''; +% for example I even read somewhere that \csa{hbox} was not +% to be used except in the \LaTeX{} kernel! well I am sorry +% but \csa{makebox} and \csa{mbox} do a \csa{leavevmode} +% which sometimes leaves no option than to use rather +% \csa{hbox}. } \section{Surprising uses of \etoc} \label{sec:surprising} @@ -956,10 +982,10 @@ it here we just wrote:\footnote{click the `\protect\thevisibletoc' increments its own private counter even before typesetting the title of a table of contents, this provides (most of the time) a better link destination than any counter manipulated - from inside \cs{etocaftertitlehook} (for which the link + from inside \csa{etocaftertitlehook} (for which the link would target the area just after the title). So, rather than including |\refstepcounter{visibletoc}| inside - \cs{etocaftertitlehook}, we just put there + \csa{etocaftertitlehook}, we just put there |\stepcounter{visibletoc}| followed by the package command \csb{etoctoccontentsline}\marg{level\_name}\marg{name}. This command has the same effect as:\\ @@ -981,14 +1007,14 @@ it here we just wrote:\footnote{click the `\protect\thevisibletoc' value |10| for example; this is independently of whether \etoc uses the document class default line styles or its own line styles, or the ones defined by the user with the - \cs{etocsetstyle} command. So there is no need to worry that + \csa{etocsetstyle} command. So there is no need to worry that something could go wrong. Then, only here we have set |\etocsetlevel{visibletoc}{0}|. And to display only this kind of entries we assign temporarily to |part| and |chapter| level |1| (or anything higher than zero) and set |tocdepth| to the value |0|. - We also did \cs{etocsetstyle\{visibletoc\}\{\string\etocskipfirstprefix\}\{, \}\{\string\etocname\}\{\}} which + We also did \csa{etocsetstyle\{visibletoc\}\{\string\etocskipfirstprefix\}\{, \}\{\string\etocname\}\{\}} which defines an inline display with the comma as separator. Finally, as \etoc issues |\par| automatically by default just before typesetting a table of contents, we had to use the command @@ -1036,7 +1062,6 @@ shuffling of levels. \subsection{Arbitrary ``Lists Of...''} -\begingroup This idea of interverting the levels is very powerful and allows to let \etoc display lists of arbitrary things contained in the @@ -1053,17 +1078,17 @@ of all these exercises. For this we put in the preamble: \newenvironment{exercise}{\begin{exerci}\exercisetotoc}{\end{exerci}} \etocsetlevel{exercise}{6} \end{verbatim} -In this way, \cs{etocname} will give the exercise number (but \cs{etocnumber} +In this way, \csa{etocname} will give the exercise number (but \csa{etocnumber} will be empty). Had we used instead \begin{verbatim} \newcommand*{\exercisetotoc} {\etoctoccontentsline{exercise}{\protect\numberline{\theexerci}}} \end{verbatim} -the exercise number would then have been available via \cs{etocnumber}, and -\cs{etocname} would have been empty. It doesn't matter which one of the two -methods is used. The \etoc command \cs{etoctoccontentsline}|{..}{..}| is -provided as a substitute to \cs{addcon\-tentsline}|{toc}{..}{..}|: this is to -avoid the patching which is done by |hyperref| to \cs{addcontentsline} in its +the exercise number would then have been available via \csa{etocnumber}, and +\csa{etocname} would have been empty. It doesn't matter which one of the two +methods is used. The \etoc command \csa{etoctoccontentsline}|{..}{..}| is +provided as a substitute to \csa{addcon\-tentsline}|{toc}{..}{..}|: this is to +avoid the patching which is done by |hyperref| to \csa{addcontentsline} in its process of creation of bookmarks. If one wants to authorize |hyperref| to create bookmarks at a specific level \meta{n}, one can use (here with \meta{n}$=$|2|) the starred variant \starit{etoctoccontentsline} which has an additional @@ -1072,20 +1097,19 @@ argument: \newcommand{\exercisetotoc}{\etoctoccontentsline*{exercise}{\theexerci}{2}} \end{verbatim} - This example originates with question |94766| on the \TeX-StackExchange site. The counter |exerci| is already incremented by the |exerci| theorem environment, and provides the correct destination for the link added by package -|hyperref|. The command \cs{exercisetotoc} adds for each exercise a line +|hyperref|. The command \csa{exercisetotoc} adds for each exercise a line to the |.toc| file, corresponding to a fictitious document unit with name `|exercise|'. A four-column list, including the sections, can then be typeset with the following code: \begin{verbatim} + \setcounter{tocdepth}{2} % sections are at level 1 and will show up \begingroup - \setcounter{tocdepth}{2} % we keep the sections which are at level 1 - \etocsetlevel{exercise}{2} % so this will show up, but: + \etocsetlevel{exercise}{2} % but: \etocsetlevel{chapter}{3} % no chapters \etocsetlevel{subsection}{3} % no subsections \etocsetlevel{part}{3} % no parts @@ -1109,7 +1133,6 @@ The global |hyperref| option \emph{bookmarksdepth} can be used to avoid having to systematically reset |tocdepth| after having changed it. -\endgroup \subsection{A TOC with a fancy layout} @@ -1183,6 +1206,7 @@ displayed the table of contents following: \newbox\forsectionnumbers \makeatletter +% 21 février 2013: je rajoute \color@begingroup et \color@endgroup \etocsetstyle{dummysection} {\setbox\forsectionnumbers=\hbox to .1\linewidth \bgroup\color@begingroup\hss\etocskipfirstprefix} @@ -1191,6 +1215,10 @@ displayed the table of contents following: {\etocnumber\color@endgroup\egroup % for reasons I do not quite understand, in some pdf viewers the dots % do not completely disappear if here \fboxsep0pt is used. + % (problèmes liés à l'anti-aliasing, sur Mac OS X, Skim, Preview...) + % (j'ai maintenu ici la méthode de mon post sur stackexchange, mais + % sans doute je pourrais réfléchir à une autre façon évitant d'avoir à + % « effacer ») \fboxsep=.5pt\colorbox{white}{\box\forsectionnumbers}\par \ifextraiidone\else \begin{center}\bfseries Concord.\end{center} @@ -1199,7 +1227,6 @@ displayed the table of contents following: } \makeatother - \renewcommand{\etocinnertopsep}{0pt} \etocruledstyle[1]{% @@ -1208,7 +1235,7 @@ displayed the table of contents following: \textsc{\bfseries\LARGE\MakeUppercase{Table of Contents}}\\ \rule{.2\linewidth}{2pt}}% } - + \setcounter{tocdepth}{1} \leavevmode\vfil \tableofcontents @@ -1378,17 +1405,17 @@ displayed the table of contents following: \subsection{Another compatibility mode} As explained in the section \ref{ssub:compat}, the commands -\cs{etocstandardlines} and \cs{etocstandarddisplaystyle} tell \etoc to, +\csa{etocstandardlines} and \csa{etocstandarddisplaystyle} tell \etoc to, essentially, act as an observer. The document class layout for the table of contents is then perfectly obeyed. There is no way to customize this standard layout (change fonts, margins, vertical spacings, etc...) from within the package. For this, use some package dedicated to this task; because \etoc either is (temporarily perhaps) in compatibility mode with no customization on its part -possible, or the user has specified the layout in \cs{etocsetstyle} commands -(and \cs{etocsettocstyle}) and is (supposedly...) in complete control. +possible, or the user has specified the layout in \csa{etocsetstyle} commands +(and \csa{etocsettocstyle}) and is (supposedly...) in complete control. Well, there is actually an alternative. It is possible to use the -\cs{etocsetstyle} commands to recreate an artificial compatibility mode, in +\csa{etocsetstyle} commands to recreate an artificial compatibility mode, in order to achieve effects like the following, all things being otherwise equal to the document class defaults: \begin{enumerate}[noitemsep] @@ -1433,20 +1460,29 @@ Here is how to proceed. One puts in the preamble: \makeatother \end{verbatim} Of course if the document has only one table of contents then there is no need -to put the commands inside a macro, or even inside a group. With these commands +to put the commands inside a macro, or even inside a group.\footnote{and if +moreover one just wants to keep the same layout as in the default, one may +question why using \etoc... there is \emph{one} good reason: numbers and names +are separately \texttt{hyperref} links, whereas normally there is only one link +holding both the number and the name corresponding to one toc entry.} With these +commands \etoc will construct a TOC completely identical to what would have been done by -one of the document class: |article|, |book|, |scrartcl|, |scrbook|. For the -|memoir| class, one needs a bit more: each of the command \cs{booknumberline}, -\cs{partnumberline} and \cs{chapternumberline} will have to be saved with a -\cs{let}, and, one then specifies (analogously for |part| and |book|): -\begin{verbatim} -\etocsetstyle{chapter}{}{}{\savedchapterline{\savedchapternumberline - {\etocnumber}\etocname}{\etocpage}}{}% -\end{verbatim} +one of the document class: |article|, |book|, |scrartcl|, |scrbook|. \footnote{For the +|memoir| class, one needs a bit more: each of the command \csa{booknumberline}, +\csa{partnumberline} and \csa{chapternumberline} will have to be saved with a +\csa{let}, and, one then specifies:\\ +\hbox to \linewidth{% +\csa{etocsetstyle\{chapter\}\{\}\{\}\{\string\savedchapterline\{% +\string\savedchapternumberline}\hss} +\hbox to \linewidth{\hfil\hfil \ttfamily + \{\csa{etocnumber}\}\csa{etocname}\}\{\csa{etocpage}\}\}\{\}\hfil} +(and analogously for |part|, respectively |book|).} The number and the name of each entry are each separately an |hyperref| link, as is always the case with \etoc, when not in compatibility mode. Replacing -\cs{etocnumber} with \cs{etocthenumber} will give a TOC where the numbers are -not links anymore, but the names still are. +\csa{etocnumber} with \csa{etocthenumber} will give a TOC where the numbers are +not links anymore, but the names still are. Or one may decide to use \csa{etocthename} +and keep an hyperlinked number with +\csa{etocnumber}. Here is a subtler example where one only marginally modifies the sections (adding color to the number and removing the |hyperref| link) and keeps @@ -1454,7 +1490,7 @@ the subsections as in the default, \emph{except} for those of one specific section, for which the layout is completely modified: \MyQuasiStandardTOC{\ref{toc:partone}} \bigskip -This example only has sections and subsections, and the code used in \cs{MyStandardTOC} was: +This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was: \begin{verbatim} \etocsetstyle{section}{} {\ifnum\etocthenumber=3 @@ -1481,13 +1517,13 @@ This example only has sections and subsections, and the code used in \cs{MyStand \end{verbatim} \endgroup -Notice the -page head-mark added by this standard TOC. Sections and subsections are printed -exactly as in the default (except for the subsections of one specific -user-chosen section), with no need to specify explicitely any length, font or -other formatting instructions. But we had to examine the |scrartcl| sources -to determine what to use for \cs{leftskip} and \cs{rightskip} for our customized -subsection entries. +Notice the page head-mark added by this standard TOC. Sections and subsections +are printed exactly as in the default (except for the subsections of one +specific user-chosen section and except for the color of the section numbers), +with no need to specify explicitely any length, font or other formatting +instructions. But we had to examine the |scrartcl| sources to determine what to +use for \csa{leftskip} and \csa{rightskip} for our customized subsection +entries. Also, a fancier layout has been commented out. @@ -1551,9 +1587,9 @@ obtained in the following manner:% \footnote{the present document has {\ttfamily\string\renewcommand\string{% \string\familydefault\string}\string{\string\sfdefault\string}} - in its preamble, hence \cs{normalfont} switches to the + in its preamble, hence \csa{normalfont} switches to the |sans| typeface; so in the section line-style, I wrote - \cs{rmfamily} instead.} + \csa{rmfamily} instead.} \begingroup\small \begin{verbatim} @@ -1603,12 +1639,12 @@ typeset by executing first the \meta{prefix} code and then the The commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are provided for use inside the \marg{prefix} and \marg{contents} parts of the -\cs{etocsetstyle} specification. They represent of course, the name, number, and +\csa{etocsetstyle} specification. They represent of course, the name, number, and page number of the corresponding toc entry.\footnote{\protect\fbox{% \parbox{.9\textwidth}{up to version -\texttt{1.07a} the package put an \cs{xspace} in each of -\cs{etocname}, \cs{etocnumber}, and \cs{etocpage}, but this +\texttt{1.07a} the package put an \csa{xspace} in each of +\csa{etocname}, \csa{etocnumber}, and \csa{etocpage}, but this wasn't such a great idea and has now been removed.}}} \subsection{The \csbhyp{etocskipfirstprefix} command} @@ -1654,23 +1690,23 @@ 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 -|\fbox{\etocnumber}|. Note that \cs{etocnumber} is a protected +Rather than just \csa{etocnumber} we then used something like +|\fbox{\etocnumber}|. Note that \csa{etocnumber} is a protected command which explains why it can be used inside the label specification without needing an added |\protect|. \subsubsection{The \csbhyp{etocifnumbered} switch} -The \cs{fbox} would give an unaesthetic result in the case of +The \csa{fbox} would give an unaesthetic result in the case of an unnumbered section (which ended up in the table of -contents via an \cs{addcontentsline} command).\footnote{as - seen we use \cs{fcolorbox} rather than \cs{fbox}. Due +contents via an \csa{addcontentsline} command).\footnote{as + seen we use \csa{fcolorbox} rather than \csa{fbox}. Due to some redefinition made by package |xcolor|, had we used - \cs{fbox} (and not used |hyperref|) we would have needed - \cs{protect}\cs{fbox}.} + \csa{fbox} (and not used |hyperref|) we would have needed + \csa{protect}\csa{fbox}.} -The \cs{etocifnumbered}\marg{A}\marg{B} command executes +The \csa{etocifnumbered}\marg{A}\marg{B} command executes \meta{A} if the number exists, and \meta{B} if not. So we use it in the code which was finally chosen for the |section| level: \begin{verbatim} @@ -1691,7 +1727,7 @@ it in the code which was finally chosen for the |section| level: If we had changed only the |section| level, and not the |subsection| level, an error on compilation would have occurred because the package style for subsections expects to start `in -vertical mode'. An additional \cs{par} token in the +vertical mode'. An additional \csa{par} token in the \meta{contents} part of the |section| level would have fixed this: |{...(page \etocpage)\par}|. @@ -1700,7 +1736,7 @@ this: |{...(page \etocpage)\par}|. It is sometimes desirable to have access to the name, number and page number without the hyperref link data: something -similar to the starred variant of the \cs{ref} command, when +similar to the starred variant of the \csa{ref} command, when package |hyperref| is used. For example one may wish to use the unit or page number in some kind of numeric context, or change its formatting. This is provided by the |\etocthe...| @@ -1714,26 +1750,26 @@ preceded by |\protect|. The command \csb{etoclink}\marg{linkname} can be used in the line style specifications in a manner analogous to the argument-less -commands \cs{etocname}, \cs{etocnumber} and \cs{etocpage}. It +commands \csa{etocname}, \csa{etocnumber} and \csa{etocpage}. It creates a link (if such a link was added by |hyperref| to the |.toc| file entry) whose destination is the corresponding document unit and whose name is the given argument. Hence |\etoclink{\etocthename}| is like the original -|\etocname|, except that \cs{etocname} starts with a -\cs{leavevmode} (this was found out to be necessary when +|\etocname|, except that \csa{etocname} starts with a +\csa{leavevmode} (this was found out to be necessary when |hyperref| has added its link data, during testing of various uses of the first versions of \etoc). The -command \cs{etoclink} is protected. +command \csa{etoclink} is protected. \subsection{The \csbhyp{etocsetlevel} command} As already explained in the section \ref{sec:surprising}, one can inform \etoc of a level to associate to a given sectioning -command with \cs{etocsetlevel}. For example: +command with \csa{etocsetlevel}. For example: \begin{verbatim} \etocsetlevel{cell}{0} \etocsetlevel{molecule}{1} @@ -1745,7 +1781,7 @@ macros |\l@cell|, |\l@molecule|, ..., pre-exist. If no table of contents is typeset in compatibility mode, then all that matters is that the line styles have been set. If for example |section| is at level |1|, then there is no need to do a -\cs{etocsetstyle}|{molecule}| if \cs{etocsetstyle}|{section}| +\csa{etocsetstyle}|{molecule}| if \csa{etocsetstyle}|{section}| has already been done (and it has been done by the package itself in its definition of its own line styles). @@ -1762,7 +1798,7 @@ does: \etocsetlevel{paragraph}{4} \etocsetlevel{subparagraph}{5} \end{verbatim} -Its own line styles are activated by \cs{etocdefaultlines}. They +Its own line styles are activated by \csa{etocdefaultlines}. They are illustrated by the main table of contents of this document. The level assignments can be modified at anytime, as has been explained in the section \ref{sec:surprising}. @@ -1896,7 +1932,7 @@ We then switch to our set-up from the previous part and add to it: {\etocfontminusone\item} {\etocname} {\end{enumerate}} -\tableofcontents \label{toc:test} \ref{toc:main} +\tableofcontents \end{verbatim} @@ -1945,14 +1981,14 @@ shortcuts: \subsection{The command \csbhyp{etocruledstyle}} -The general format of \cs{etocruledstyle} is:\\ -\centerline{\color{blue}\cs{etocruledstyle}% +The general format of \csa{etocruledstyle} is:\\ +\centerline{\color{blue}\csa{etocruledstyle}% \oarg{number of columns}\marg{title of the toc}} \noindent Note that the title is horizontal material, if it -does not fit on one line it should be put in a \cs{parbox} of +does not fit on one line it should be put in a \csa{parbox} of a given width. We did this and even enclosed the parboxes in -\cs{fbox}es to get frames around them. For the example with -the standard formatting we did not use an \cs{fbox} and got +\csa{fbox}es to get frames around them. For the example with +the standard formatting we did not use an \csa{fbox} and got rid of the horizontal rules via: \begin{verbatim} \renewcommand{\etoctoprule}{\hrule height 0pt} @@ -1972,7 +2008,7 @@ the \hyperref[toc:a]{% \subsection{The command \csbhyp{etocmulticolstyle}} This is also a command with one optional and one mandatory argument:\\ -\centerline{\color{blue}\cs{etocmulticolstyle}% +\centerline{\color{blue}\csa{etocmulticolstyle}% \oarg{number\_of\_columns}\marg{heading}} The \meta{number\_of\_columns} can go from 1 to 10 (it defaults to 2, and from 2 on is passed to a |multicols| @@ -1992,21 +2028,21 @@ configured: \leaders\hrule height1pt\hfill \MakeUppercase{Table of Contents}} \end{verbatim} -After \cs{etocmulticolstyle} all future \cs{tableofcontents} will use the +After \csa{etocmulticolstyle} all future \csa{tableofcontents} will use the specified style, if not changed in-between. 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}} +\centerline{\csa{etocmulticol}\oarg{number\_of\_columns}\marg{heading}} And there is also -\cs{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}. +\csa{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}. \subsubsection{The command \csbhyp{etoctocstyle}} -\centerline{\color{blue}\cs{etoctocstyle}\oarg{kind}% +\centerline{\color{blue}\csa{etoctocstyle}\oarg{kind}% \marg{number\_of\_columns}\marg{title}} \hbox to \linewidth{\hss= -\cs{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% +\csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% |{\kind*{|\itshape title\upshape|}}|\hss} where |kind| is one of |chapter|, |section|, . . . and defaults to |chapter| or |section| depending on the document class. @@ -2014,7 +2050,7 @@ to |chapter| or |section| depending on the document class. \paragraph{\texorpdfstring{\csb{etoc\-toc\-style\-with\-marks}}{etoctocstylewithmarks}}% \leavevmode\unskip{\color{blue}\oarg{kind}\marg{number\_of\_columns}\marg{title}\marg{mark}}\\ \hbox to \linewidth -{\hss=\cs{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% +{\hss=\csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% |{\kind*{|\itshape title \ttfamily\upshape\string\markboth% |{\MakeUppercase{|{\rmfamily\itshape mark}|}}}}|\hss} where |kind| is one of |chapter|, |section|, ... The @@ -2031,7 +2067,7 @@ which does not uppercase. As a shortcut to set the style with \csb{etocruledstyle} and then issue a -\cs{tableofcontents}, all inside a group +\csa{tableofcontents}, all inside a group so that future table of contents will not be affected, there is:\\ \centerline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}} @@ -2040,32 +2076,32 @@ And the local form will be \csb{etoclocalruled}. \subsection{The commands \csbhyp{etocframedstyle} and \csbhyp{etocframed}} Same mechanism:\\ -\centerline{\color{blue}\cs{etocframedstyle}% +\centerline{\color{blue}\csa{etocframedstyle}% \oarg{number\_of\_columns}\marg{title}} and the accompanying shortcut:\\ \centerline{\csb{etocframed}\oarg{number\_of\_columns}\marg{title}} 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{etoc\-localframedstyle} and -\cs{etoclocalframed}. +inside the \meta{title} argument to \csa{etocframedstyle} or +\csa{etocframed}. There is also \csa{etoc\-localframedstyle} and +\csa{etoclocalframed}. \subsection{Headings, titles, \csbhyp{etocinnertopsep}} [\emph{modified in v1.07}] There is a slight difference -between \cs{etocmulticolstyle} and \cs{etocruledstyle} or -\cs{etocframedstyle}. For \cs{etocmulticolstyle} the mandatory +between \csa{etocmulticolstyle} and \csa{etocruledstyle} or +\csa{etocframedstyle}. For \csa{etocmulticolstyle} the mandatory \meta{heading} argument can be something like: \starit{section}% -|{|\emph{Table of Contents}|}|. On the contrary \cs{etocruledstyle} and -\cs{etocframedstyle} expect an argument +|{|\emph{Table of Contents}|}|. On the contrary \csa{etocruledstyle} and +\csa{etocframedstyle} expect an argument ``in LR mode'' (to use the terminology from the \emph{LaTeX, a document preparation system}). This means that multiline -contents arguments to \cs{etocruledstyle} or -\cs{etocframedstyle} must be enclosed in something like a \cs{parbox}. +contents arguments to \csa{etocruledstyle} or +\csa{etocframedstyle} must be enclosed in something like a \csa{parbox}. -[\emph{new in v1.07}] The command \cs{etocmulticolstyle} now +[\emph{new in v1.07}] The command \csa{etocmulticolstyle} now also accepts horizontal mode material in its mandatory argument \meta{heading}: it internally automatically adds a closing |\par|. So one can use for example @@ -2088,22 +2124,23 @@ someone here? \end{verbatim} \end{multicols} \endgroup -But the code on the right does not. So the package provides -\csb{etocoldpar} as a substitute for |\par| (it executes -|\let\etocoldpar\par| just before starting the |multicols| -environment and automatically add it to close the heading, and +But the version on the right does not (it disguises |\par| so as to be +acceptable). \etoc provides +\csb{etocoldpar} as a substitute for |\par| (it does +|\let\etocoldpar\par| just before the |multicols| +environment and automatically adds it to close the heading, before the vertical skip of value -\cs{etocinnertopsep}).\footnote{this command \cs{etocoldpar} (= -working \cs{par} in the argument to \cs{etocmulticolstyle}) is -not related to the switch \cs{etocnopar} whose purpose is to -tell \etoc not to do a \cs{par} before the table of +\csa{etocinnertopsep}).\footnote{this command \csa{etocoldpar} (= +working \csa{par} in the argument to \csa{etocmulticolstyle}) is +not related to the switch \csa{etocnopar} whose purpose is to +tell \etoc not to do a \csa{par} before the table of contents.} The command \csb{etocoldpar} can also be used explicitely in the mandatory argument to -\cs{etocmulticolstyle}. +\csa{etocmulticolstyle}. -An important dimension used by all three of \cs{etocmulticolstyle}, -\cs{etocruledstyle} and \cs{etocframedstyle} is +An important dimension used by all three of \csa{etocmulticolstyle}, +\csa{etocruledstyle} and \csa{etocframedstyle} is \csb{etocinnertopsep}. It gives the amount of separation between the heading and the start of the contents. Its default value is |2ex| and it is changed by @@ -2114,7 +2151,7 @@ value is |2ex| and it is changed by \subsection{The command \csbhyp{etocsettocstyle}} This is a command with two mandatory arguments:\\ -\centerline{\color{blue}\cs{etocsettocstyle}\marg{before\_toc}% +\centerline{\color{blue}\csa{etocsettocstyle}\marg{before\_toc}% \marg{after\_toc}} The \marg{before\_toc} part is responsible for typesetting the heading, for example it can be something like @@ -2132,9 +2169,9 @@ it could check (book class) to see if two-column mode is on, and switch to one-column style, and the \meta{after\_toc} part would then reenact the two-column mode. -The previously described commands \cs{etocmulticolstyle}, -\cs{etocruledstyle}, and \cs{etocframedstyle} actually call -\cs{etocsettocstyle} as a lower-level routine, and start a +The previously described commands \csa{etocmulticolstyle}, +\csa{etocruledstyle}, and \csa{etocframedstyle} actually call +\csa{etocsettocstyle} as a lower-level routine, and start a |multicols| environment in \marg{before\_toc} to close it in \marg{after\_toc}. @@ -2148,7 +2185,7 @@ class should be obeyed, too. \section{Starred variants of the \csbhyp{tableofcontents} etc... commands} -The \toc, \localtoc, \cs{etocmulticol}, etc... have starred +The \toc, \localtoc, \csa{etocmulticol}, etc... have starred variants (the star must be before the other arguments). For all but the |memoir| class, they are like the original. For the |memoir| class, the original prints an entry in the |.toc| @@ -2161,17 +2198,17 @@ 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 +\meta{name} can be for example \csa{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 +appropriately (for example with \csa{etoctocstyle}), to use the identical division unit as in the first argument to -\cs{etocmemoirtoctotocfmt}. +\csa{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 +\csa{localtableofcontents} (obviously this is not a truly real +life situation), just after a \csa{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 @@ -2352,51 +2389,51 @@ document, not for print! \subsection{Setting up local styles} \hbox{\color{green}\fboxrule1pt\fboxsep1em -\setbox0\hbox{\cs{etocthename}, \cs{etocthenumber}, \cs{etocthepage}, \cs{etoclink}\marg{linkname}}% +\setbox0\hbox{\csa{etocthename}, \csa{etocthenumber}, \csa{etocthepage}, \csa{etoclink}\marg{linkname}}% \framebox[\linewidth][c] {\vbox{\hsize\wd0\normalcolor\noindent -\cs{etocsetstyle}\marg{levelname}% +\csa{etocsetstyle}\marg{levelname}% \marg{start}\marg{prefix}\marg{contents}\marg{finish}\\ -\cs{etocname}, \cs{etocnumber}, \cs{etocpage}, -\cs{etocifnumbered}\marg{A}\marg{B}\\ -\cs{etocthename}, \cs{etocthenumber}, \cs{etocthepage}, \cs{etoclink}\marg{linkname} +\csa{etocname}, \csa{etocnumber}, \csa{etocpage}, +\csa{etocifnumbered}\marg{A}\marg{B}\\ +\csa{etocthename}, \csa{etocthenumber}, \csa{etocthepage}, \csa{etoclink}\marg{linkname} }}} \subsection{Setting up toc display styles} \medskip \hbox{\color{green}\fboxrule1pt\fboxsep1em -\setbox0\hbox{\cs{etoctocstylewithmarksnouc}\oarg{kind}% +\setbox0\hbox{\csa{etoctocstylewithmarksnouc}\oarg{kind}% \marg{number\_of\_columns}\marg{title}\marg{mark}}% \framebox[\linewidth][c] {\vbox{\hsize\wd0 \normalcolor\noindent -\cs{etocmulticolstyle}\oarg{number\_of\_columns}\marg{heading}\\ -\cs{etoctocstyle}\oarg{kind}\marg{number\_of\_columns}\marg{title}\\ -\cs{etoctocstylewithmarks}\oarg{kind}\marg{number\_of\_columns}% +\csa{etocmulticolstyle}\oarg{number\_of\_columns}\marg{heading}\\ +\csa{etoctocstyle}\oarg{kind}\marg{number\_of\_columns}\marg{title}\\ +\csa{etoctocstylewithmarks}\oarg{kind}\marg{number\_of\_columns}% \marg{title}\marg{mark}\\ -\cs{etoctocstylewithmarksnouc}\oarg{kind}\marg{number\_of\_columns}% +\csa{etoctocstylewithmarksnouc}\oarg{kind}\marg{number\_of\_columns}% \marg{title}\marg{mark}\\ -\cs{etocruledstyle}\oarg{number\_of\_columns}\marg{title}\\ -\cs{etocframedstyle}\oarg{number\_of\_columns}\marg{title}\\ -\cs{etocsettocstyle}\marg{before\_toc}\marg{after\_toc}}}} +\csa{etocruledstyle}\oarg{number\_of\_columns}\marg{title}\\ +\csa{etocframedstyle}\oarg{number\_of\_columns}\marg{title}\\ +\csa{etocsettocstyle}\marg{before\_toc}\marg{after\_toc}}}} \subsection{Displaying tables of contents} \medskip \hbox{\color{green}\fboxrule1pt\fboxsep1em - \setbox0\hbox{\cs{etocname}, \cs{etocnumber}, - \cs{etocpage}, \cs{etocifnumbered}\marg{A}\marg{B}}% + \setbox0\hbox{\csa{etocname}, \csa{etocnumber}, + \csa{etocpage}, \csa{etocifnumbered}\marg{A}\marg{B}}% \framebox[\linewidth][c] {\vbox{\hsize\wd0\normalcolor\noindent \toc\\ \localtoc\\ - \cs{etocmulticol}\oarg{number\_of\_columns}\marg{heading}\\ - \cs{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}\\ - \cs{etocruled}\oarg{number\_of\_columns}\marg{title}\\ - \cs{etoclocalruled}\oarg{number\_of\_columns}\marg{title}\\ - \cs{etocframed}\oarg{number\_of\_columns}\marg{title}\\ - \cs{etoclocalframed}\oarg{number\_of\_columns}\marg{title}\\ + \csa{etocmulticol}\oarg{number\_of\_columns}\marg{heading}\\ + \csa{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}\\ + \csa{etocruled}\oarg{number\_of\_columns}\marg{title}\\ + \csa{etoclocalruled}\oarg{number\_of\_columns}\marg{title}\\ + \csa{etocframed}\oarg{number\_of\_columns}\marg{title}\\ + \csa{etoclocalframed}\oarg{number\_of\_columns}\marg{title}\\ \hbox{}{\itshape\ttfamily\ \ \ \ and their starred variants} }}} @@ -2406,21 +2443,21 @@ The commands (starred or not) to actually display the table of contents can be followed with optional labels or references:\par \medskip \hbox{\color{green}\fboxrule1pt\fboxsep1em - \setbox0\hbox{\cs{etocname}, \cs{etocnumber}, - \cs{etocpage}, \cs{etocifnumbered}\marg{A}\marg{B}}% + \setbox0\hbox{\csa{etocname}, \csa{etocnumber}, + \csa{etocpage}, \csa{etocifnumbered}\marg{A}\marg{B}}% \framebox[\linewidth][c] {\vbox{\hsize\wd0\normalcolor\noindent - \toc \cs{label}|\{toc:here\}|\\ - \toc \cs{ref}|\{toc:far\}| \\ - \toc \cs{label}|\{toc:here\}| \cs{ref}|\{toc:far\}| \\ - \localtoc \cs{label}|\{toc:here\}|\\ + \toc \csa{label}|\{toc:here\}|\\ + \toc \csa{ref}|\{toc:far\}| \\ + \toc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\ + \localtoc \csa{label}|\{toc:here\}|\\ \hbox{}{\itshape\ttfamily\ \ \ \ similarly with\ }% - \cs{etocmulticol}{\itshape\ttfamily\ etc . . . } + \csa{etocmulticol}{\itshape\ttfamily\ etc . . . } }}} \medskip The commands for local tables of -contents do \emph{not} react to a \cs{ref} following them. +contents do \emph{not} react to a \csa{ref} following them. When re-displaying another toc, only its contents are transferred: @@ -2434,7 +2471,7 @@ I got motivated by a question\footnote{\href{http://tex.stackexchange.com/questions/83184/how-to-change-style-and-color-of-table-of-content}{tex.stackexchange.com/questions/83184}} I saw on the \TeX{} StackExchange site. I copied the color RGB specifications from an answer which had been provided to the -question. The \cs{etocframedstyle} puts the title on the top +question. The \csa{etocframedstyle} puts the title on the top rule in a centered position. This is not very convenient for this example so we included the title as part of the \meta{start} code at section level, to get it \emph{inside} @@ -2467,8 +2504,7 @@ the frame. \newcommand\shiftedwhiterule[2]{% \hbox to \linewidth{\color{white}% - \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip -\vskip#2} + \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip\vskip#2} \etocsetstyle{subsubsection}{\etocskipfirstprefix} {\shiftedwhiterule{\leftskip}{6pt}} @@ -2610,7 +2646,7 @@ use or not colors is left to the user. We will simply list the relevant commands as defined in the package. Customizing them goes through suitable -\cs{renewcommand}s: +\csa{renewcommand}s: \begin{verbatim} \newcommand*\etocfontminustwo{\normalfont \LARGE \bfseries} @@ -2649,23 +2685,23 @@ package. Customizing them goes through suitable No customizing of the standard line styles is possible from within \etoc. As already explained, when -\cs{etocstandardlines} has been issued, the package just makes +\csa{etocstandardlines} has been issued, the package just makes itself very discrete and acts only at the global level, and the TOC entries are (hopefully) formatted as would have happened in the absence of \etoc.\footnote{with the KOMA-script classes, we noticed that - \cs{etocstandarddisplaystyle} was apparently needed for the + \csa{etocstandarddisplaystyle} was apparently needed for the KOMA options |toc=left| to be active at the level of the line entries.} -The \cs{etocstandardlines} compatibility mode will work also with -sectioning commands made known to \etoc via \cs{etocsetlevel}, +The \csa{etocstandardlines} compatibility mode will work also with +sectioning commands made known to \etoc via \csa{etocsetlevel}, under the condition of course that these sectioning commands are accompanied with all the relevant definitions for typesetting toc entries in the \LaTeX{} default manner -(existence of the macros \cs{l@something} . . .). +(existence of the macros \csa{l@something} . . .). -Using the command \cs{etocsetstyle}, be it in the preamble or +Using the command \csa{etocsetstyle}, be it in the preamble or in the body of the document, has the secondary effect of switching off the compatibility mode. @@ -2673,11 +2709,11 @@ switching off the compatibility mode. Again we list the relevant macros, what they do should be -legible from their names. Note that \cs{renewcommand}'s and -not \cs{setlength}'s have to be used for what appear to be +legible from their names. Note that \csa{renewcommand}'s and +not \csa{setlength}'s have to be used for what appear to be lengths, and that color commands are not just color -specifications, they must include \cs{color}, and are canceled -by re-defining them to do \cs{relax}. +specifications, they must include \csa{color}, and are canceled +by re-defining them to do \csa{relax}. \begin{verbatim} \newcommand*\etocabovetocskip{3.5ex plus 1ex minus .2ex} \newcommand*\etocbelowtocskip{3.5ex plus 1ex minus .2ex} @@ -2709,17 +2745,17 @@ by re-defining them to do \cs{relax}. \newcommand\etocframedmphook{\relax} \end{verbatim} -The \cs{etocframedmphook} is positioned immediately +The \csa{etocframedmphook} is positioned immediately after the beginning of a minipage environment where the contents of the framed TOC are typeset. -The \cs{...colorcmd} things are initially set to be -\cs{relax}, so there is no need to do \cs{usepackage}|{color}| +The \csa{...colorcmd} things are initially set to be +\csa{relax}, so there is no need to do \csa{usepackage}|{color}| if the document does not use colors. If the scope of a change -to a color command such as \cs{etocbkgcolorcmd} has not +to a color command such as \csa{etocbkgcolorcmd} has not been limited to a group and one then wishes to let it again be -\cs{relax} one must use a \cs{renewcommand} and not -\cs{let}\cs{etocbkgcolorcmd}\cs{relax}. +\csa{relax} one must use a \csa{renewcommand} and not +\csa{let}\csa{etocbkgcolorcmd}\csa{relax}. Regarding the dimensions of the top rule they can be specified in |ex|'s or |em|'s as in this example:\\ @@ -2727,8 +2763,8 @@ in |ex|'s or |em|'s as in this example:\\ |\renewcommand{\etoctoprule}{\hrule height 1ex}|\hss} The package code is done in such a manner that it is the font size in instance at the end of typesetting -the title argument to \cs{etocruledtoc} or -\cs{etocframedtoc} which will be used for the meaning of the +the title argument to \csa{etocruledtoc} or +\csa{etocframedtoc} which will be used for the meaning of the `1ex'. Of course also the other rule commands can have their dimensions in font relative units, but their values are decided on the basis of the font in effect just before the @@ -2777,18 +2813,19 @@ Let us display and count all subsections occurring in this document (see section \ref{sec:surprising} for other uses of this technique): \begin{verbatim} \setcounter{tocdepth}{2} +\begingroup \etocsetlevel{part}{3} \etocsetlevel{section}{3} -\etocsetstyle{subsection}{\begin{enumerate}[itemsep=0pt,% -label=,leftmargin=0pt]} -{\normalfont\bfseries\item} -{\roman{enumi}. \normalfont\etocname{} (\etocnumber, p.~\etocpage)} -{\end{enumerate}} +\etocsetstyle{subsection} + {\small\begin{enumerate}[itemsep=0pt,label=,leftmargin=0pt]} + {\normalfont\bfseries\item} + {\roman{enumi}. \mdseries\etocname{} (\etocnumber, p.~\etocpage)} + {\end{enumerate}} \renewcommand{\etoccolumnsep}{2.75em} \renewcommand{\columnseprule}{1pt} \etocmarkbothnouc{List of all subsections} \etocmulticol[3]{\subsection{All subsections of this document}} -\setcounter{tocdepth}{3} +\endgroup \end{verbatim} \setcounter{tocdepth}{2} @@ -2800,10 +2837,10 @@ label=,leftmargin=0pt]} \etocsetlevel{part}{3} \etocsetlevel{chapter}{3} \etocsetlevel{section}{3} -\etocsetstyle{subsection}{% +\etocsetstyle{subsection}{\small \begin{enumerate}[itemsep=0pt,label=,leftmargin=0pt]} {\normalfont\bfseries\item} -{\roman{enumi}. \normalfont\etocname{} (\etocnumber, p.~\etocpage)} +{\roman{enumi}. \mdseries\etocname{} (\etocnumber, p.~\etocpage)} {\end{enumerate}} \renewcommand{\etoccolumnsep}{2.75em} @@ -2827,7 +2864,7 @@ doesn't matter whether \etoc or |hyperref| is loaded first. The contents of the |.toc| file (if it exists) are read into -memory by \etoc once, at the time of \cs{usepackage\{etoc\}}. +memory by \etoc once, at the time of \csa{usepackage\{etoc\}}. The |.toc| file will be opened for write operations only at the time of the first TOC displaying command. @@ -2846,64 +2883,65 @@ contents will be displayed only on the next |latex| run. \etoc expects the document sectioning units to write their data into the file having extension |.toc|, in the form of -lines containing the \cs{contentsline} command and its -arguments. The macros \cs{etocname}, \cs{etocnumber}, and -\cs{etocpage} contain the |hyperref| links, if present (note +lines containing the \csa{contentsline} command and its +arguments. The macros \csa{etocname}, \csa{etocnumber}, and +\csa{etocpage} contain the |hyperref| links, if present (note that the \emph{linktoc=all} option of |hyperref| tells it to put a link also in the page number corresponding to a given -toc entry). The tables of contents of the present document are +toc entry). For example, the tables of contents of the present document are fully linked. It is possible to customize (using package |tocloft| for -example) throughout the document the macros \cs{l@section}, -\cs{l@subsection} ... and the effect will be seen in the next +example) throughout the document the macros \csa{l@section}, +\csa{l@subsection} ... and the effect will be seen in the next table of contents typeset by \etoc in compatibility mode. \subsection{\TeX nical matters} -The \cs{etocname}, \cs{etocnumber}, \cs{etocpage} and -\cs{etocifnumbered} are protected against premature expansion. -They contain suitable |hyperref| links if package |hyperref| -is loaded and active for the TOC. The command \cs{etoclink} is -also protected against premature expansion. +The \csa{etocname}, \csa{etocnumber}, \csa{etocpage} commands are protected against +premature expansion. They contain suitable |hyperref| links if package +|hyperref| is loaded and active for the TOC. The commands \csa{etoclink} and +\csa{etocifnumbered} are also protected against premature expansion. -On the other hand \cs{etocthename}, \cs{etocthenumber}, -\cs{etocthepage} do not represent |hyperref| links, and are +On the other hand \csa{etocthename}, \csa{etocthenumber}, +\csa{etocthepage} do not represent |hyperref| links, and are \emph{not} protected against expansion. -The commands such as \cs{etocsetstyle}, \cs{etocsetlevel}, -\cs{etocsettocstyle}, \cs{etocmulticolstyle}, -\cs{etocruledstyle}, \cs{etocframedstyle} obey \LaTeX{}'s +The commands such as \csa{etocsetstyle}, \csa{etocsetlevel}, +\csa{etocsettocstyle}, \csa{etocmulticolstyle}, +\csa{etocruledstyle}, \csa{etocframedstyle} obey \LaTeX{}'s groups. All TOCs are typeset inside groups. \subsection{Errors and catastrophes} \begin{small} - After using \cs{etocsetstyle} for one level, the remaining - uncustomized levels use the \etoc's default styles (those - which are activated by \cs{etocdefaultlines}). One has to + After using \csa{etocsetstyle} for one level, the remaining + uncustomized levels use the \etoc default styles (those + which are activated by \csa{etocdefaultlines}). One has to make sure that all levels needed for the next table of - contents are mutually compatible. - - % When using multiple \toc commands in a document, one should - % beware from adding typesetting instructions directly in the - % |.toc| file, as they will be executed by \etoc for all TOCs: - % even for a \localtoc it doesn't matter if that instruction - % seems to concern material outside of its scope, it will get - % executed nevertheless. If absolutely necessary these - % instructions should be done in such a way that they can be - % activated or deactivated easily from the document source, as - % need be. + contents are mutually compatible: in particular the \etoc + default styles expect to start in ``vertical mode''. + + When using multiple \toc commands in a document, one should + beware from adding typesetting instructions directly in the + |.toc| file, as they will be executed by \etoc for all TOCs: + even for a \localtoc it doesn't matter if that instruction + seems to concern material outside of its scope, it will get + executed nevertheless. If absolutely necessary these + instructions should be done in such a way that they can be + activated or deactivated easily from the document source, as + need be. % Do not clone a clone but produce rather twins by cloning the % same original local table of contents. - % As is usual with toc and labels, after each change, one has - % to run latex a certain number of times to let the produced - % document get its final appearance (at least twice).\par + As is usual with toc and labels, after each change, one has + to run latex a certain number of times to let the produced + document get its final appearance (at least twice).\par \end{small} +\clearpage \part{The code} @@ -2985,6 +3023,7 @@ release. \newif\ifEtoc@v % subparagraph \newif\ifEtoc@number \newif\ifEtoc@hyperref +\newif\ifEtoc@parskip % 1.07d \newif\ifEtoc@tocwithid \newif\ifEtoc@standard \newif\ifEtoc@part @@ -2997,7 +3036,6 @@ release. \newif\ifEtoc@notactive \newcounter{etoc@tocid} \newif\ifEtoc@mustclosegroup -\newif\ifEtoc@tocopenedforwrite % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3127,11 +3165,11 @@ release. % placeholder for comments % \begin{macrocode} \AtBeginDocument{% +\@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}% \@ifpackageloaded{hyperref}{\Etoc@hyperreftrue \def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}% \long\def\Etoc@gobblesixorfive#1#2#3#4#5#6{}} - {\Etoc@hyperreffalse - \def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}% + {\def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}% \long\def\Etoc@gobblesixorfive#1#2#3#4#5{}}% } % \end{macrocode} @@ -3247,10 +3285,10 @@ release. % placeholder for comments % \begin{macrocode} \def\Etoc@lxyz #1#2{% - \@namedef{etoclink }##1{##1}% fall-back if no links - \@namedef{etocpage }{\leavevmode #2}% + \@namedef{etoclink }{\leavevmode}% fall-back + \@namedef{etocpage }{\leavevmode #2}% fall-back \Etoc@getthepage #2\etoc@ - \@namedef{etocname }{\leavevmode #1}% + \@namedef{etocname }{\leavevmode #1}% fall-back \def\etocthename{#1}% \Etoc@getnb #1\relax\relax\etoc@ \ifEtoc@number\else @@ -3359,18 +3397,12 @@ release. % \end{macrocode} % placeholder for comments % \begin{macrocode} -\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} -\edef\etocifnumbered{\noexpand\protect\expandafter\noexpand - \csname etocifnumbered \endcsname} +\DeclareRobustCommand*{\etocname} {} +\DeclareRobustCommand*{\etocnumber}{} +\DeclareRobustCommand*{\etocpage} {} +\DeclareRobustCommand*{\etoclink} {} +\DeclareRobustCommand*{\etocifnumbered} + {\ifEtoc@number\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3387,28 +3419,34 @@ release. \Etoc@nextread{#1}% } \IfFileExists{\jobname .toc} - {{\endlinechar=-1 \makeatletter - \newread\Etoc@tf - \openin\Etoc@tf\@filef@und - \Etoc@readtoc\Etoc@tf - \closein\Etoc@tf}}{\typeout{No file \jobname .toc.}} + {{\endlinechar=-1 + \makeatletter + \newread\Etoc@tf + \openin\Etoc@tf\@filef@und + \Etoc@readtoc\Etoc@tf + \closein\Etoc@tf}} + {\typeout{No file \jobname .toc.}} % \end{macrocode} % placeholder for comments % \begin{macrocode} -\def\Etoc@starttoc{% -\begingroup -\makeatletter -\ifEtoc@hyperref +\def\Etoc@openouttoc{% formerly \Etoc@starttoc +%% 1.07d: parskip and \@nobreakfalse stuff moved to \Etoc@tableofcontents + \ifEtoc@hyperref \ifx\hyper@last\@undefined - \ltx@ifpackageloaded {parskip}{\parskip \z@ }{}% - \IfFileExists {\jobname .toc} - {\Hy@WarningNoLine - {old toc file detected, not used; run LaTeX again (cheers from etoc)}% - \global\Etoc@toctoks={}} -{}\fi\fi -\if@filesw \newwrite \tf@toc -\immediate \openout \tf@toc \jobname .toc\relax \fi \@nobreakfalse -\endgroup} + \IfFileExists{\jobname .toc} + {\Hy@WarningNoLine + {old toc file detected, not used; run LaTeX again (cheers from etoc)}% + \global\Etoc@toctoks={}% + } + {}% + \fi + \fi + \if@filesw + \newwrite \tf@toc + \immediate \openout \tf@toc \jobname .toc\relax + \fi + \gdef\Etoc@openouttoc{}% 1.07d, rather than using a boolean +} % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3495,7 +3533,7 @@ release. \global\Etoc@stoptocfalse \global\Etoc@notactivetrue \Etoc@tableofcontents}% - \endgroup\ifEtoc@mustclosegroup\expandafter\endgroup\fi} + \endgroup\ifEtoc@mustclosegroup\endgroup\fi} % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3525,7 +3563,7 @@ release. \global\Etoc@notactivefalse \Etoc@tableofcontents \endgroup - \ifEtoc@mustclosegroup\expandafter\endgroup\fi}% + \ifEtoc@mustclosegroup\endgroup\fi}% \fi \fi\fi\fi\Etoc@next} % \end{macrocode} @@ -3547,41 +3585,45 @@ release. \newcommand*\etocaftertitlehook{} \newcommand*\etocaftercontentshook{} \renewcommand*\tableofcontents{% - \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi - \global\Etoc@tocopenedforwritetrue - \Etoc@par\begingroup - \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% - \@ifstar - {\def\Etoc@aftertitlehook{}\table@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}} + \Etoc@openouttoc + \Etoc@par + \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents + \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% + \@ifstar + {\def\Etoc@aftertitlehook{}\table@fcontents} + {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}} \newcommand*\localtableofcontents{% - \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi - \global\Etoc@tocopenedforwritetrue - \Etoc@par\begingroup\@ifstar - {\def\Etoc@aftertitlehook{}\localtable@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}} + \Etoc@openouttoc + \Etoc@par + \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents + \@ifstar + {\def\Etoc@aftertitlehook{}\localtable@fcontents} + {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}} % \end{macrocode} % placeholder for comments % \begin{macrocode} \newcommand\etocsettocstyle[2]{% \def\Etoc@tableofcontents -{\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else -\let\Etoc@@next\@gobble\fi -\Etoc@@next{#1\Etoc@aftertitlehook +{\ifnum\c@tocdepth>\Etoc@minf + \let\Etoc@@next\@firstofone\else + \let\Etoc@@next\@gobble +\fi +\Etoc@@next{#1\ifEtoc@parskip\parskip\z@skip\fi %1.07d + \Etoc@aftertitlehook \let\Etoc@savedcontentsline\contentsline \let\contentsline\Etoc@etoccontentsline \Etoc@toctoc - \let\Etoc@n@xt\relax + \let\Etoc@@next\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 + \def\Etoc@@next{\Etoc@localtocfalse + \global\Etoc@notactivefalse + \Etoc@toctoc}% + \fi\fi\fi + \Etoc@@next \etocaftercontentshook - #2}}} + #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -3636,8 +3678,8 @@ release. \newcommand*\etocbookname{Book} % \end{macrocode} % placeholder for comments -% The macro \cs{etocdefaultlines} was initially called \cs{etoctoclines}. Now -% \cs{etoctoclines} just does \cs{Etoc@standardfalse}. +% The macro \csa{etocdefaultlines} was initially called \csa{etoctoclines}. Now +% \csa{etoctoclines} just does \csa{Etoc@standardfalse}. % \begin{macrocode} \def\etocdefaultlines{\Etoc@standardfalse % \end{macrocode} @@ -4169,9 +4211,8 @@ release. Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{2549} +\CheckSum{2516} \Finale %% %% End of file `etoc.dtx'. - diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins index c3922595c6f..e14f2c2eabb 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.ins +++ b/Master/texmf-dist/source/latex/etoc/etoc.ins @@ -1,6 +1,6 @@ \def\pkgname{etoc} -\def\pkgdate{2013/02/22} -\def\pkgversion{v1.07c} +\def\pkgdate{2013/02/24} +\def\pkgversion{v1.07d} \def\pkgdescription{easily customizable TOCs (jfB)} %% %% Package `etoc' by Jean-Francois Burnol diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index f5ece10416c..166b4711d04 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/02/22 v1.07c easily customizable TOCs (jfB)] + [2013/02/24 v1.07d easily customizable TOCs (jfB)] %% %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012, 2013 by Jean-Francois Burnol @@ -45,6 +45,7 @@ \newif\ifEtoc@v % subparagraph \newif\ifEtoc@number \newif\ifEtoc@hyperref +\newif\ifEtoc@parskip % 1.07d \newif\ifEtoc@tocwithid \newif\ifEtoc@standard \newif\ifEtoc@part @@ -54,7 +55,6 @@ \newif\ifEtoc@notactive \newcounter{etoc@tocid} \newif\ifEtoc@mustclosegroup -\newif\ifEtoc@tocopenedforwrite \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} \def\Etoc@@minustwo@@{-\tw@} \let\Etoc@@minusone@@\m@ne @@ -171,11 +171,11 @@ \fi \fi} \AtBeginDocument{% +\@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}% \@ifpackageloaded{hyperref}{\Etoc@hyperreftrue \def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}% \long\def\Etoc@gobblesixorfive#1#2#3#4#5#6{}} - {\Etoc@hyperreffalse - \def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}% + {\def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}% \long\def\Etoc@gobblesixorfive#1#2#3#4#5{}}% } \def\Etoc@swa#1{% @@ -282,10 +282,10 @@ \Etoc@next \@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}} \def\Etoc@lxyz #1#2{% - \@namedef{etoclink }##1{##1}% fall-back if no links - \@namedef{etocpage }{\leavevmode #2}% + \@namedef{etoclink }{\leavevmode}% fall-back + \@namedef{etocpage }{\leavevmode #2}% fall-back \Etoc@getthepage #2\etoc@ - \@namedef{etocname }{\leavevmode #1}% + \@namedef{etocname }{\leavevmode #1}% fall-back \def\etocthename{#1}% \Etoc@getnb #1\relax\relax\etoc@ \ifEtoc@number\else @@ -373,18 +373,12 @@ \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\etoclink{\noexpand\protect\expandafter - \noexpand\csname etoclink \endcsname} -\@namedef{etocifnumbered }{\ifEtoc@number - \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} -\edef\etocifnumbered{\noexpand\protect\expandafter\noexpand - \csname etocifnumbered \endcsname} +\DeclareRobustCommand*{\etocname} {} +\DeclareRobustCommand*{\etocnumber}{} +\DeclareRobustCommand*{\etocpage} {} +\DeclareRobustCommand*{\etoclink} {} +\DeclareRobustCommand*{\etocifnumbered} + {\ifEtoc@number\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \def\Etoc@readtoc#1{% \ifeof #1 \let\Etoc@nextread\@gobble @@ -398,25 +392,31 @@ \Etoc@nextread{#1}% } \IfFileExists{\jobname .toc} - {{\endlinechar=-1 \makeatletter - \newread\Etoc@tf - \openin\Etoc@tf\@filef@und - \Etoc@readtoc\Etoc@tf - \closein\Etoc@tf}}{\typeout{No file \jobname .toc.}} -\def\Etoc@starttoc{% -\begingroup -\makeatletter -\ifEtoc@hyperref + {{\endlinechar=-1 + \makeatletter + \newread\Etoc@tf + \openin\Etoc@tf\@filef@und + \Etoc@readtoc\Etoc@tf + \closein\Etoc@tf}} + {\typeout{No file \jobname .toc.}} +\def\Etoc@openouttoc{% formerly \Etoc@starttoc +%% 1.07d: parskip and \@nobreakfalse stuff moved to \Etoc@tableofcontents + \ifEtoc@hyperref \ifx\hyper@last\@undefined - \ltx@ifpackageloaded {parskip}{\parskip \z@ }{}% - \IfFileExists {\jobname .toc} - {\Hy@WarningNoLine - {old toc file detected, not used; run LaTeX again (cheers from etoc)}% - \global\Etoc@toctoks={}} -{}\fi\fi -\if@filesw \newwrite \tf@toc -\immediate \openout \tf@toc \jobname .toc\relax \fi \@nobreakfalse -\endgroup} + \IfFileExists{\jobname .toc} + {\Hy@WarningNoLine + {old toc file detected, not used; run LaTeX again (cheers from etoc)}% + \global\Etoc@toctoks={}% + } + {}% + \fi + \fi + \if@filesw + \newwrite \tf@toc + \immediate \openout \tf@toc \jobname .toc\relax + \fi + \gdef\Etoc@openouttoc{}% 1.07d, rather than using a boolean +} \def\Etoc@toctoc{% \global\Etoc@vfalse \global\Etoc@ivfalse @@ -494,7 +494,7 @@ \global\Etoc@stoptocfalse \global\Etoc@notactivetrue \Etoc@tableofcontents}% - \endgroup\ifEtoc@mustclosegroup\expandafter\endgroup\fi} + \endgroup\ifEtoc@mustclosegroup\endgroup\fi} \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@}} @@ -518,7 +518,7 @@ \global\Etoc@notactivefalse \Etoc@tableofcontents \endgroup - \ifEtoc@mustclosegroup\expandafter\endgroup\fi}% + \ifEtoc@mustclosegroup\endgroup\fi}% \fi \fi\fi\fi\Etoc@next} \def\table@fcontents{% @@ -534,38 +534,42 @@ \newcommand*\etocaftertitlehook{} \newcommand*\etocaftercontentshook{} \renewcommand*\tableofcontents{% - \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi - \global\Etoc@tocopenedforwritetrue - \Etoc@par\begingroup - \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% - \@ifstar - {\def\Etoc@aftertitlehook{}\table@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}} + \Etoc@openouttoc + \Etoc@par + \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents + \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% + \@ifstar + {\def\Etoc@aftertitlehook{}\table@fcontents} + {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}} \newcommand*\localtableofcontents{% - \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi - \global\Etoc@tocopenedforwritetrue - \Etoc@par\begingroup\@ifstar - {\def\Etoc@aftertitlehook{}\localtable@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}} + \Etoc@openouttoc + \Etoc@par + \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents + \@ifstar + {\def\Etoc@aftertitlehook{}\localtable@fcontents} + {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}} \newcommand\etocsettocstyle[2]{% \def\Etoc@tableofcontents -{\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else -\let\Etoc@@next\@gobble\fi -\Etoc@@next{#1\Etoc@aftertitlehook +{\ifnum\c@tocdepth>\Etoc@minf + \let\Etoc@@next\@firstofone\else + \let\Etoc@@next\@gobble +\fi +\Etoc@@next{#1\ifEtoc@parskip\parskip\z@skip\fi %1.07d + \Etoc@aftertitlehook \let\Etoc@savedcontentsline\contentsline \let\contentsline\Etoc@etoccontentsline \Etoc@toctoc - \let\Etoc@n@xt\relax + \let\Etoc@@next\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 + \def\Etoc@@next{\Etoc@localtocfalse + \global\Etoc@notactivefalse + \Etoc@toctoc}% + \fi\fi\fi + \Etoc@@next \etocaftercontentshook - #2}}} + #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here \newcommand*\etocsetstyle{\Etoc@standardfalse\etoc@setstyle} \long\def\etoc@setstyle#1#2#3#4#5{% \long\expandafter\def |