From 7517a8cc36ffb0c06ac028f06a69251551d2c939 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 29 Sep 2017 20:37:58 +0000 Subject: bxjscls (28sep17) git-svn-id: svn://tug.org/texlive/trunk@45429 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/etoc/etoc.dtx | 1149 +++++++++++++++++--------- 1 file changed, 744 insertions(+), 405 deletions(-) (limited to 'Master/texmf-dist/source/latex/etoc/etoc.dtx') diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index 1ad9f8b888d..a1ab3297a6d 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx @@ -2,12 +2,12 @@ % N.B.: this dtx file is NOT for use with \DocInput. The latex source of the % user manual is not prefixed with percent signs. %<*none> -\def\etocdtxtimestamp {Time-stamp: <21-09-2017 at 19:38:23 CEST>}% +\def\etocdtxtimestamp {Time-stamp: <28-09-2017 at 16:19:24 CEST>}% % %<*!readme> %% %% Package: etoc -%% Version: 1.08j-2017/09/21 +%% Version: 1.08k-2017/09/28 %% License: LPPL 1.3c %% Copyright (C) 2012-2017 Jean-Francois Burnol %% @@ -17,14 +17,14 @@ %% % %<*insfile> -\def\etocpkgdate {2017/09/21} -\def\etocdocdate {2017/09/21} -\def\etocpkgversion {v1.08j} +\def\etocpkgdate {2017/09/28} +\def\etocdocdate {2017/09/28} +\def\etocpkgversion {v1.08k} \def\etocpkgdescription {Completely customisable TOCs (JFB)} % %<*none> -\def\etocDEpkgdate {21.09.2017} -\def\etocDEdocdate {21.09.2017} +\def\etocDEpkgdate {28.09.2017}% METTRE À JOUR À CHAQUE BUMP! +\def\etocDEdocdate {28.09.2017} \def\etocDEDEdocdate {09.04.2015}% \def\etocDEDEpkgversion {v1.08d}% % Definition of \etocLicense @@ -35,7 +35,7 @@ \catcode32=13\catcode`\\=12^^Brelax^^A ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A {% Package: etoc -% Version: 1.08j-2017/09/21 +% Version: 1.08k-2017/09/28 % License: LPPL 1.3c % Copyright (C) 2012-2017 Jean-Francois Burnol % Copyright (C) 2014-2017 Christine Roemer @@ -64,12 +64,12 @@ % etoc.ins, etoc.tex, etoc-DE.tex, and README.md. See README.md for % further instructions. }}% -\iffalse +\bgroup\catcode2 0 \catcode`\\ 12 ^^Biffalse % %<*readme> - Source: etoc.dtx (v1.08j-2017/09/21) + Source: etoc.dtx (v1.08k-2017/09/28) Author: Jean-Francois Burnol Author: Christine Roemer et al. (German tranlation) Info: Completely customisable TOCs @@ -185,6 +185,26 @@ etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi. RECENT CHANGES ============== +v1.08k \[2017/09/28\] +--------------------- + +Adds `\etocsetlocaltop.toc`. See corresponding manual section for +details. + +Adds `\etocsavedparttocline`, `\etocsavedchaptertocline`, +`\etocsavedsectiontocline`, ... They can be used in the context of +the technique explained in section "Another compatibility mode". + +Formerly, etoc redefined for the duration of the TOC the memoir +macro `\chapternumberline` and its likes to have same meaning as +`\numberline` (of course, not when executed in compatibility mode), +for the sake of extraction of `\etocnumber`. + +New method detects presence of any `\numberline` macro without +any change to originals; they can thus be used as is when applying +the approach of "Another compatibility mode" section from manual. + + v1.08j \[2017/09/21\] --------------------- @@ -358,7 +378,7 @@ Thanks to Christine Römer! \endbatchfile %--------------------------------------------------------------------- %<*none>------------------------------------------------------------------------ -\fi +^^Bfi^^Begroup % \chardef\noetex 0 \ifx\numexpr\undefined\chardef\noetex 1 \fi @@ -786,11 +806,10 @@ pdfpagemode=UseOutlines} % et maintenant =4 pour version de la doc du 28 avril 2014... faudra vraiment qu % je mette un mécanisme plus robuste pour cette TOC. % ATTENTION AUSSI AUX CODES VERBATIM +% màj pour 1.08k: \etocsavedsectiontocline etc... \makeatletter \newcommand*{\MyQuasiStandardTOC}[1]{% \begingroup - \let\savedsectionline\l@section - \let\savedsubsectionline\l@subsection \etocsetstyle{section}{} {\ifnum\etocthenumber=4 % <- check this if new sections added to user manual \etocsetstyle{subsection} @@ -805,9 +824,9 @@ pdfpagemode=UseOutlines} {.\par\endgroup}% \else \etocsetstyle{subsection}{}{} - {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% \fi} - {\savedsectionline + {\etocsavedsectiontocline {\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} {}% \etocstandarddisplaystyle @@ -948,29 +967,8 @@ pdfpagemode=UseOutlines} \pgftransformxshift{\the\tikzleveldistance}% \fi \ifnum\tikztreelevel=2 -% modifications le Vendredi 09 septembre 2016 à 11:23:42 - % \pgfmathsetmacro\tikzoffsetofcurrentchild{(\tikzsiblingdistance)*(\tikznumberofcurrentgrandchild)}% - % \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelwidth pt - % \pgftransformxshift{\tikzlevelwidth/2-\tikzoffsetofcurrentchild} - % \pgftransformyshift{\tikzlevelheight/2} - % \else - % \pgfmathsetmacro\tikzoffsetofcurrentchild{\tikzoffsetofcurrentchild-\tikzlevelwidth}% - % \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelheight pt - % \pgftransformxshift{-\tikzlevelwidth/2} - % \pgftransformyshift{\tikzlevelheight/2-\tikzoffsetofcurrentchild} - % \else - % \pgfmathsetmacro\tikzoffsetofcurrentchild{\tikzoffsetofcurrentchild-\tikzlevelheight}% - % \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelwidth pt - % \pgftransformxshift{-\tikzlevelwidth/2+\tikzoffsetofcurrentchild} - % \pgftransformyshift{-\tikzlevelheight/2} - % \else - % \pgfmathsetmacro\tikzoffsetofcurrentchild{\tikzoffsetofcurrentchild-\tikzlevelwidth}% - % \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelheight pt - % \pgftransformxshift{\tikzlevelwidth/2} - % \pgftransformyshift{-\tikzlevelheight/2+\tikzoffsetofcurrentchild} - % \fi\fi\fi\fi - % \global\advance\tikznumberofcurrentgrandchild by1 - \pgfmathsetmacro\tikzoffsetofcurrentchild{(\tikzsiblingdistance)*(\tikznumberofcurrentgrandchild)}% +% modif Mercredi 27 septembre 2017 à 17:16:44 + \pgfmathsetmacro\tikzoffsetofcurrentchild{(\tikzsiblingdistance)*(6+\tikznumberofcurrentgrandchild)}% \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelheight pt \pgftransformxshift{\tikzlevelwidth/2} \pgftransformyshift{-\tikzlevelheight/2+\tikzoffsetofcurrentchild} @@ -1227,8 +1225,10 @@ etoc-framed-mp-hook {% define the section node \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber} \unexpanded\expandafter{\etocthelinkedname}}}}% - \ifnum\value{partco}<9 % pour 1.08h - \appendtotok\parttok\childnode \fi} + %\ifnum\value{partco}<9 % pour 1.08h + \appendtotok\parttok\childnode + %\fi + } {} \etocsetnexttocdepth{section} @@ -1241,6 +1241,18 @@ etoc-framed-mp-hook version:\par \etocpkgversion{} (\etocpkgdate )\par}}}} {\global\appendtotok\treetok{ ;}} +\etocsettagdepth {preamble}{part} +\etocsettagdepth {overview}{part} +\etocsettagdepth {arbitrarily}{all} +\etocsettagdepth {examples}{all} +\etocsettagdepth {surprising}{all} +\etocsettagdepth {linestyles}{part} +\etocsettagdepth {globalcmds}{part} +\etocsettagdepth {custom}{part} +\etocsettagdepth {tips}{all} +\etocsettagdepth {etocandworld}{all} +\etocsettagdepth {code}{all} + \etocinline\tableofcontents\label{toc:mindmaptitlepage} % \immediate\openout\TOCasTree=\jobname.toctree @@ -1278,7 +1290,7 @@ etoc-framed-mp-hook % 39 hard coded mais je pourrais aussi le calculer % pour version rectangulaire, par tâtonnements: level 2/.append style={level width=21cm,level height=30cm, sibling - distance=2.31cm},% je passe à 2.29cm par tatons après ajout section 1.09j + distance=3cm},% modif Mercredi 27 septembre 2017 à 17:17:20 ] \the\treetok \end{tikzpicture}}\endgroup } @@ -1410,6 +1422,8 @@ manner: they are made available via the \csb{etocname}, % Starting with release |1.07k| it is possible to % use \etoc concurrently with package |tocloft|. +\clearpage + \section{License} \begingroup\ttfamily\small\hyphenchar\font -1 @@ -1417,8 +1431,7 @@ manner: they are made available via the \csb{etocname}, \obeyspaces\obeylines % \etocLicense\endgroup - -% \clearpage +\clearpage \etocsettocdepth {subsection} @@ -1622,6 +1635,8 @@ remains initially as defined by the document class (or the compatibility mode at the ``toc display style'' level. It will be re-activated if use if made of \csb{etocstandarddisplaystyle}. +See further \autoref{sec:anothercompat}. + \section{A first example} \label{sec:firstexample} @@ -2384,39 +2399,42 @@ the document class defaults: \item do either of the above only for some portions of the table of contents. \end{enumerate} -Here is how to proceed. One puts in the preamble: +Here is how to proceed. + +This has become easier since release |1.08k| as now \etoc preserves +automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline} +etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... macros as +they were at the time the TOC is typeset. + \begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} \makeatletter \newcommand{\MyStandardTOC}{% \begingroup - \let\savedpartline\l@part - \let\savedchapterline\l@chapter %% remove if article/scrartcl class - \let\savedsectionline\l@section - \let\savedsubsectionline\l@subsection - % and so on if \subsubsection, etc... is used - % % for the book or article classes: - \etocsetstyle{part}{}{} - {\savedpartline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}% + %\etocsetstyle{part}{}{} + % {\etocsavedparttocline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}% % for the scrbook or scrartcl classes: \etocsetstyle{part}{}{} - {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% - % identical in book/article/scrbook/scrartcl classes: + {\etocsavedparttocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + % following is identical in book/article/scrbook/scrartcl classes: \etocsetstyle{chapter}{}{} %%% only for book and scrbook - {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedchaptertocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% \etocsetstyle{section}{}{} - {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% \etocsetstyle{subsection}{}{} - {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% % etc... if further sectioning units are used - % (see the text for what to do with the memoir class) \etocstandarddisplaystyle % this is for the title, page-marks, etc... \tableofcontents \endgroup} \makeatother \end{filecontentshere} \attachfile{etocsnippet-\the\value{section}-A.tex} -Of course if the document has only one table of contents then there is no need + +One can add to the above arbitrary text formatting commands, for example +replace |\etocpage| by |\textcolor{blue}{\etocpage}|. + +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.\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 @@ -2424,16 +2442,11 @@ 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|. \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: -\centeredline{% -\csa{etocsetstyle\{chapter\}\{\}\{\}\{\string\savedchapterline\{% -\string\savedchapternumberline}} -\hbox to \linewidth{\hfil\hfil \ttfamily - \{\csa{etocnumber}\}\csa{etocname}\}\{\csa{etocpage}\}\}\{\}\hfil} -(and analogously for |part|, respectively |book|).} +one of the document class: |article|, |book|, |scrartcl|, |scrbook|.\footnote{For the +|memoir| class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline}, +\csa{partnumberline} and \csa{chapternumberline} had to be saved. They can now +be used directly in the line styles, because their meanings are not modified +anymore by \etoc during its TOC typesetting.} 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 \csa{etocnumber} with \csa{etocthenumber} will give a TOC where the numbers are @@ -2466,10 +2479,10 @@ This example only has sections and subsections, and the code used in \csa{MyStan \else \etocsetstyle{subsection} {}{} - {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}} + {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}} {}% \fi} - {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} + {\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} {}% \end{filecontentshere} \attachfile{etocsnippet-\the\value{section}-B.tex} @@ -4141,10 +4154,8 @@ Notes: \localtableofcontents \label{toc:a} -\section{The \csbhyp{etocsetstyle} command} +\section{The \csbhyp{etocsetstyle}, \csbhyp{etocname} and \csbhyp{etocpage} commands}\label{sec:etocsetstyle} \label{etocsetstyle} - -\subsection{The \csbhyp{etocname} and \csbhyp{etocpage} commands} \label{etocname} \label{etocpage} @@ -4231,7 +4242,7 @@ links are kept in the commands \csa{etocname}, \csa{etocnumber} and \csa{etocpage} (this last one will have a link only if |hyperref| was passed option \emph{linktoc=all}.) -\subsection{The \csbhyp{etocskipfirstprefix} and \csbhyp{etociffirst} commands} +\section{The \csbhyp{etocskipfirstprefix} and \csbhyp{etociffirst} commands} \label{etocskipfirstprefix} \label{etociffirst} \label{etocxiffirst} @@ -4252,7 +4263,7 @@ command which survives to expansion (for example in an |enumitem| label). The variant \csb{etocxiffirst} does the same, but is expandable. -\subsection{The \csbhyp{etocnumber} command} +\section{The \csbhyp{etocnumber} command} \label{etocnumber} So far, our specifications would use the numbering generated @@ -4274,7 +4285,7 @@ command which explains why it can be used inside the label specification without needing an added |\protect|. -\subsection{The \csbhyp{etocifnumbered} switch} +\section{The \csbhyp{etocifnumbered} switch} \label{etocifnumbered} \label{etocxifnumbered} @@ -4315,7 +4326,7 @@ The command \csb{etocifnumbered} is robust; \csb{etocxifnumbered} (new with |1.08|) has the same effect but is expandable. -\subsection{The \csbhyp{etocthename}, \csbhyp{etocthenumber}, and +\section{The \csbhyp{etocthename}, \csbhyp{etocthenumber}, and \csbhyp{etocthepage} commands} \label{etocthename} \label{etocthenumber} @@ -4332,7 +4343,7 @@ These commands are not protected, so in moving argument contexts (for example in a label specification) they should be preceded by |\protect|. -\subsection{The \csbhyp{etoclink} command} +\section{The \csbhyp{etoclink} command} \label{etoclink} The command \csb{etoclink}\marg{linkname} can be used in the line style @@ -4353,7 +4364,7 @@ The command \csa{etoclink} is robust. Since |etoc 1.08j| it contains the link destination in an already expanded form, so for example can be used even after a |&| in a tabular construction, if \csb{etocglobaldefs} was issued. -\subsection{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, +\section{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, \csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands} \label{etocthelinkedname} \label{etocthelinkednumber} @@ -4442,6 +4453,18 @@ Example of \etocinline\tableofcontents \ref{toc:globalcmds} \endgroup +\section{The \csbhyp{etocsavedsectiontocline}, etc... commands.} +\label{etocsavedsectiontocline} +\label{etocsavedchaptertocline} + +Since |1.08k| \etoc preserves +automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline} +etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... in force +at the time each \csb{tableofcontents} or \csb{localtableofcontents} +macro is executed. + +See \autoref{sec:anothercompat} for usage. + \section{The \csbhyp{etocsetlevel} command} \label{etocsetlevel} @@ -5078,6 +5101,7 @@ package. Customizing them goes through suitable \newcommand*\etocfontminusone{\normalfont \large \bfseries} \newcommand*\etocfontzero{\normalfont \large \bfseries} \newcommand*\etocfontone{\normalfont \normalsize \bfseries} +% (in classes with chapter, \etocfontone does not do \bfseries) \newcommand*\etocfonttwo{\normalfont \normalsize} \newcommand*\etocfontthree{\normalfont \footnotesize} @@ -5322,21 +5346,90 @@ use or not colors is left to the user. %\section{... and tricks} -\section{A known issue with \csbhyp{localtableofcontents}} +\section{The \csbhyp{etocsetlocaltop.toc} command} +\label{etocsetlocaltop.toc} + +It is important to understand that \csb{localtableofcontents} works entirely +from data \emph{in the |.toc| file}. If the document, say with |article| +class, contains starred sectioning commands, which are not accompanied +by suitable \csa{addcontentsline}, then these units are completely +transparent to \csb{localtableofcontents}: +\begin{itemize} +\item If it is issued before |\section*{Foo}|, say locally to a |\section|, + then the local TOC will include not only the |subsection|s between the + |\section| and the |\section*{Foo}| but also those following, and be stopped + uniquely by a later |\section| or |\part| from the document's body. +\item If the command is issued right after |\section*{Foo}| and the later was + itself subsequent to a (numbered) |\subsection|, then \etoc will think it + must display a TOC local to that \emph{subsection} level. +\end{itemize} +Before concluding that \etoc is buggy, imagine how the global TOC of the +document would look like in such circumstances: the \csb{localtableofcontents} +does exactly the job of extracting from that global TOC various local TOCs; it +works only from material in that (virtual) global TOC. + +Since relase |1.08k|, \etoc provides the one-argument command +\csb{etocsetlocaltop.toc} to insert into the |.toc| file a kind +of ``ghost'' of a given sectioning unit. Here is an example: + +\begin{verbatim} +\part*{Extra unnumbered part} +\etocsetlocaltop.toc{part} +\localtableofcontents +\end{verbatim} -The macro \csa{localtableofcontents} will be dysfunctional after a sectioning -unit which \emph{does not make its way to the \texttt{.toc} file}: typically -after a non-numbered section for example. The non-numbered section must be -added to the \texttt{.toc} file via an \csa{addcontentsline}. Else, \etoc will -construct a local TOC according to the last sectioning unit added to the -\texttt{.toc} file. For example if this is a sub-section, then \etoc will think -it must create a local TOC corresponding to a sub-section. +Then in this example, \csb{localtableofcontents} will be stopped +by the next |\part| (naturally a numbered one or a |\part*| followed by +suitable |\addcontentsline|) or also by a later |\etocsetlocaltop.toc{part}|. -This may be qualified a bug, perhaps a future version will fix -this. If no one complains it might stay that way. +This is all fine but keep in mind again that \csb{localtableofcontents} can +only display units which have been pushed to the |.toc| file, so that |\part*| +must be followed by numbered sections or |\section*/\addcontentsline| pairs if +\csb{localtableofcontents} is to display anything useful. One can not use +\etoc to typeset data not actually there in the |.toc| file! -\section{Hacking framed parboxes} +Thus, in the situation above, one may wonder why the document does not use +|\addcontentsline| after the |\part*| as it must do so for sub-sectioning +units if they are to appear in the local TOC. + +One may imagine some document where all |Part|s are non-numbered but +nevertheless the user wants its \csb{localtableofcontents} for each one: then +indeed \csb{etocsetlocaltop.toc} will help in that case. + +There are at least two more methods to handle this situation: +\begin{itemize} +\item the first one is simply to use the |\addcontentsline{toc}{part}{..}| + commands, and to set the |part| style to do nothing, so that the main TOC + will not display them, +\item the second one does not add the |\addcontentsline{toc}{part}{...}| but + uses ``depth tags'' (\autoref{ssec:tocwithdepthtags}) and multiple + \csb{tableofcontents} (not \csb{localtableofcontents}), one for each desired + local TOC. +\end{itemize} +There is a variant of the first method which would set the level of |part| +temporarily to |6| for the typesetting of the main TOC. But then the |chapter| +toc line style will execute inside the main TOC only once its \emph{start} and +\emph{finish} parts (see \autoref{sec:etocsetstyle}). This is actually also a +problem of the second method. + +But not of the first method which uses +\centeredline{\csb{etocsetstyle}|{part}{}{}{}{}|} nor of the approach with +\csb{etocsetlocaltop.toc}: the \emph{start} and \emph{finish} portions of the +|chapter| toc line style will get executed at the appropriate times in the +main, global, TOC. + +Be aware however that this use of \csb{etocsetlocaltop.toc}|{part}| will also +cause the main global TOC to execute (once) the \emph{start} and \emph{finish} +portions of the |part| toc line style (assuming here again it is not typeset in +compatibility mode). + +Final remark: usage of \csb{etocsetlocaltop.toc} interferes with +\csb{etocchecksemptiness} only to the extent that it modifies (as explained in +this section) the selection made by \csb{localtableofcontents}, hence the +decision whether the local TOC is empty or not. + +\section{Hacking framed parboxes} \begin{verbatim} \etocdefaultlines @@ -5907,6 +6000,8 @@ contents will be displayed only on the next |latex| run. \part{The code} +\localtableofcontents + \section{Timestamp} This is the documentation as of \texttt{\etocdocdate}, printed from the @@ -5962,7 +6057,10 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. {% define the section node \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber} \unexpanded\expandafter{\etocthelinkedname}}}}% - \ifnum\value{partco}<9 \appendtotok\parttok\childnode \fi} + %\ifnum\value{partco}<9 + \appendtotok\parttok\childnode + %\fi + } {} \etocsetnexttocdepth{section} @@ -5974,6 +6072,18 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. {\normalsize Paketversion:\par \etocpkgversion{} (\etocDEpkgdate )\par}}}} {\global\appendtotok\treetok{ ;}} +\etocsettagdepth {preamble}{part} +\etocsettagdepth {overview}{part} +\etocsettagdepth {arbitrarily}{all} +\etocsettagdepth {examples}{all} +\etocsettagdepth {surprising}{all} +\etocsettagdepth {linestyles}{part} +\etocsettagdepth {globalcmds}{part} +\etocsettagdepth {custom}{part} +\etocsettagdepth {tips}{all} +\etocsettagdepth {etocandworld}{all} +\etocsettagdepth {code}{all} + \etocinline\tableofcontents\label{toc:mindmaptitlepage} \tikzset {branch color/.style={concept color=#1!white, @@ -5998,7 +6108,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. level 1 concept/.append style={font=\Large, text width = 3cm}, % geändert 2015/11/12 20cm->21cm level 2/.append style={level width=21cm,level height=30cm, sibling - distance=2.31cm},% + distance=3cm},% ] \the\treetok \end{tikzpicture}}\endgroup } @@ -6035,7 +6145,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. Daniel Büttner, Claudia Dahl, Christian Otto und Christine Römer (FSU Jena). Die letzte Aktualisierung der Übersetzung is vom \texttt{\etocDEDEdocdate} (Paketversion \texttt{\etocDEDEpkgversion}). - Neuere Abschnitte bleiben in englischer Sprache. Hinweise zur + Neuere Abschnitte bleiben auf English. Hinweise zur Übersetzung an Christine\_Roemer at t-online dot de. \medskip @@ -6134,6 +6244,8 @@ abgerufen werden. kompatibel zu sein. Seit der Version |1.07k| ist es möglich \etoc gleichzeitig mit |tocloft| zu benutzen. +\clearpage + \section{Lizenz} \begingroup\ttfamily\small\hyphenchar\font -1 @@ -6142,7 +6254,7 @@ gleichzeitig mit |tocloft| zu benutzen. \etocLicense\endgroup -%\clearpage % ATTENTION retiré 28 mars 2015 +\clearpage \etocsettocdepth {subsection} @@ -7113,39 +7225,46 @@ gleichen andererseits dem Dokumentenklassen"=Standard: ändern Sie es nur für Teilbereiche; \end{enumerate} -Hier ist beschrieben, wie Sie vorgehen müssen. Man nimmt in die Präambel: +Hier ist beschrieben, wie Sie vorgehen müssen. + +\begin{otherlanguage}{english} + This has become easier since release |1.08k| as now \etoc preserves +automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline} +etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... macros as +they were at the time the TOC is typeset. +\end{otherlanguage} + +Man nimmt in die Präambel: \begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} \makeatletter \newcommand{\MyStandardTOC}{% \begingroup - \let\savedpartline\l@part - \let\savedchapterline\l@chapter %% remove if article/scrartcl class - \let\savedsectionline\l@section - \let\savedsubsectionline\l@subsection - % and so on if \subsubsection, etc... is used - % % for the book or article classes: - \etocsetstyle{part}{}{} - {\savedpartline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}% + %\etocsetstyle{part}{}{} + % {\etocsavedparttocline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}% % for the scrbook or scrartcl classes: \etocsetstyle{part}{}{} - {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% - % identical in book/article/scrbook/scrartcl classes: + {\etocsavedparttocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + % following is identical in book/article/scrbook/scrartcl classes: \etocsetstyle{chapter}{}{} %%% only for book and scrbook - {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedchaptertocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% \etocsetstyle{section}{}{} - {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% \etocsetstyle{subsection}{}{} - {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% + {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}% % etc... if further sectioning units are used - % (see the text for what to do with the memoir class) \etocstandarddisplaystyle % this is for the title, page-marks, etc... \tableofcontents \endgroup} \makeatother \end{filecontentshere} \attachfile{etocsnippet-\the\value{section}-A.tex} -Natürlich ist es so, wenn das Dokument nur ein Inhaltsverzeichnis hat, dann gibt + + +One can add to the above arbitrary text formatting commands, for example +replace |\etocpage| by |\textcolor{blue}{\etocpage}|. + +Wenn das Dokument nur ein Inhaltsverzeichnis hat, dann gibt es keine Notwendigkeit, die Befehle in ein Makro zu setzen oder sogar in eine Gruppe. \footnote{Und wenn darüber hinaus, um das gleiche Layout wie im Standard zu halten, kann man sich die Frage stellen, warum man \etoc benutzt \ldots\ Es @@ -7153,17 +7272,11 @@ gibt \emph{einen} guten Grund: Zahlen und Namen sind separate \texttt{hyperref}-Links, nach der Regel gibt es nur eine Verbindung, die sowohl die Nummer und den Namen auf einem toc"=Eintrag entsprechen.} Mit dem Befehl \etoc ist ein Inhaltsverzeichnis völlig identisch zu einem von der -Dokumentenklasse: |article|, |book|, |scrartcl|, |scrbook|. \footnote{Für die -|memoir|-Klasse braucht man ein bisschen mehr: Jeder der Befehle -\csa{booknumberline}, -\csa{partnumberline} und \csa{chapternumberline} müssen in ein -\csa{let} gebettet werden und sie ergeben dann ein: -\centeredline{% -\csa{etocsetstyle\{chapter\}\{\}\{\}\{\string\savedchapterline\{% -\string\savedchapternumberline}} -\hbox to \linewidth{\hfil\hfil \ttfamily - \{\csa{etocnumber}\}\csa{etocname}\}\{\csa{etocpage}\}\}\{\}\hfil} -(und analog für |part| und |book|).} +Dokumentenklasse: |article|, |book|, |scrartcl|, |scrbook|. \footnote{For the +|memoir| class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline}, +\csa{partnumberline} and \csa{chapternumberline} had to be saved. They can now +be used directly in the line styles, because their meanings are not modified +anymore by \etoc during its TOC typesetting.} Die Anzahl und die Namen der einzelnen Einträge sind jeweils separat in einem |hyperref|-Link, wie es immer der Fall bei \etoc ist, wenn man nicht im Kompatibilitätsmodus ist. Ersetzt man \csa{etocnumber} mit \csa{etocthenumber}, @@ -7197,10 +7310,10 @@ war: \else \etocsetstyle{subsection} {}{} - {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}} + {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}} {}% \fi} - {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} + {\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} {}% \end{filecontentshere} \attachfile{etocsnippet-\the\value{section}-B.tex} @@ -8831,10 +8944,8 @@ Notes: \localtableofcontents \label{toc:a} -\section{Der \csbhyp{etocsetstyle}"=Befehl} +\section{Die \csbhyp{etocsetstyle}-, \csbhyp{etocname}- und \csbhyp{etocpage}"=Befehle}\label{sec:etocsetstyle} \label{etocsetstyle} - -\subsection{Die \csbhyp{etocname}- und \csbhyp{etocpage}"=Befehle} \label{etocname} \label{etocpage} @@ -8921,7 +9032,7 @@ Option \emph{linktoc=all} übergeben wurde). -\subsection{Die \csbhyp{etocskipfirstprefix} und \csbhyp{etociffirst} Befehle} +\section{Die \csbhyp{etocskipfirstprefix} und \csbhyp{etociffirst} Befehle} \label{etocskipfirstprefix} \label{etociffirst} \label{etocxiffirst} @@ -8945,7 +9056,7 @@ Die Variante \csb{etocxiffirst} macht das Gleiche, aber sie ist erweiterbar. -\subsection{Der \csbhyp{etocnumber}"=Befehl} +\section{Der \csbhyp{etocnumber}"=Befehl} \label{etocnumber} Bis hierhin würde unsere Spezifikation die Nummerierung verwenden, die von der @@ -8966,7 +9077,7 @@ benutzt. Dabei ist festzuhalten, dass \csa{etocnumber} ein robuster Befehl ist, was erklärt, warum er in der Label"=Spezifikation benutzt werden kann, ohne |\protect| hinzuzufügen. -\subsection{Der \csbhyp{etocifnumbered}-Schalter} +\section{Der \csbhyp{etocifnumbered}-Schalter} \label{etocifnumbered} \label{etocxifnumbered} @@ -9004,7 +9115,7 @@ hätte das behoben: |{...(page \etocpage)\par}|. Der Befehl \csb{etocifnumbered} ist robust; \csb{etocxifnumbered} (neu für |1.08|) hat den gleiche Effekt, aber er ist expandierbar. -\subsection{Die Befehle \csbhyp{etocthename}, \csbhyp{etocthenumber} sowie +\section{Die Befehle \csbhyp{etocthename}, \csbhyp{etocthenumber} sowie \csbhyp{etocthepage}} \label{etocthename} \label{etocthenumber} @@ -9022,7 +9133,7 @@ Kontexten (zum Beispiel Label"=Beschreibungen mit vorangestelltem |\protect|) verwendet werden. -\subsection{Der \csbhyp{etoclink}"=Befehl} +\section{Der \csbhyp{etoclink}"=Befehl} \label{etoclink} Der Befehl \csb{etoclink}\marg{linkname} kann in Linienstil"=Beschreibungen @@ -9044,7 +9155,7 @@ Der Befehl \csa{etoclink} ist robust. if \csb{etocglobaldefs} was issued. \end{otherlanguage} -\subsection{Die Befehle \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, +\section{Die Befehle \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, \csbhyp{etocthelinkedpage} und \csbhyp{etocthelink}} \label{etocthelinkedname} \label{etocthelinkednumber} @@ -9149,6 +9260,18 @@ Beispiel\begingroup\etocglobaldefs % <-- NEU mit etoc 1.08. \etocinline\tableofcontents \ref{toc:globalcmds} \endgroup +\section{Die \csbhyp{etocsavedsectiontocline}, usw... Befehle.} +\label{etocsavedsectiontocline} +\label{etocsavedchaptertocline} + +\begin{otherlanguage}{english} + Since |1.08k| \etoc preserves automatically in + \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline} etc... the + meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... in force at the + time each \csb{tableofcontents} or \csb{localtableofcontents} macro is + executed. +\end{otherlanguage} + \section{Der \csbhyp{etocsetlevel}"=Befehl} \label{etocsetlevel} @@ -9770,6 +9893,7 @@ bequem mittels \csa{renewcommand} anpassen: \newcommand*\etocfontminusone{\normalfont \large \bfseries} \newcommand*\etocfontzero{\normalfont \large \bfseries} \newcommand*\etocfontone{\normalfont \normalsize \bfseries} +% (in classes with chapter, \etocfontone does not do \bfseries) \newcommand*\etocfonttwo{\normalfont \normalsize} \newcommand*\etocfontthree{\normalfont \footnotesize} @@ -10011,26 +10135,96 @@ Farben nutzen will oder nicht. %\section{\ldots\ und Tricks} -\section{A known issue with \csbhyp{localtableofcontents}} - \begin{otherlanguage}{english} - The macro \csa{localtableofcontents} will be dysfunctional after a - sectioning unit which \emph{does not make its way to the \texttt{.toc} - file}: typically after a non-numbered section for example. The - non-numbered section must be added to the \texttt{.toc} file via an - \csa{addcontentsline}. Else, \etoc will construct a local TOC according to - the last sectioning unit added to the \texttt{.toc} file. For example if - this is a sub-section, then \etoc will think it must create a local TOC - corresponding to a sub-section. - - This may be qualified a bug, perhaps a future version will fix this. If - no one complains it might stay that way. +\section{The \csbhyp{etocsetlocaltop.toc} command} +\label{etocsetlocaltop.toc} + +It is important to understand that \csb{localtableofcontents} works entirely +from data \emph{in the |.toc| file}. If the document, say with |article| +class, contains starred sectioning commands, which are not accompanied +by suitable \csa{addcontentsline}, then these units are completely +transparent to \csb{localtableofcontents}: +\begin{itemize} +\item If it is issued before |\section*{Foo}|, say locally to a |\section|, + then the local TOC will include not only the |subsection|s between the + |\section| and the |\section*{Foo}| but also those following, and be stopped + uniquely by a later |\section| or |\part| from the document's body. +\item If the command is issued right after |\section*{Foo}| and the later was + itself subsequent to a (numbered) |\subsection|, then \etoc will think it + must display a TOC local to that \emph{subsection} level. +\end{itemize} +Before concluding that \etoc is buggy, imagine how the global TOC of the +document would look like in such circumstances: the \csb{localtableofcontents} +does exactly the job of extracting from that global TOC various local TOCs; it +works only from material in that (virtual) global TOC. + +Since relase |1.08k|, \etoc provides the one-argument command +\csb{etocsetlocaltop.toc} to insert into the |.toc| file a kind +of ``ghost'' of a given sectioning unit. Here is an example: + +\begin{verbatim} +\part*{Extra unnumbered part} +\etocsetlocaltop.toc{part} +\localtableofcontents +\end{verbatim} + +Then in this example, \csb{localtableofcontents} will know be stopped +by the next |\part| (naturally a numbered one or a |\part*| followed by +suitable |\addcontentsline|) or also by a later |\etocsetlocaltop.toc{part}|. + +This is all fine but keep in mind again that \csb{localtableofcontents} can +only display units which have been pushed to the |.toc| file, so that |\part*| +must be followed by numbered sections or |\section*/\addcontentsline| pairs if +\csb{localtableofcontents} is to display anything useful. One can not use +\etoc to typeset data not actually there in the |.toc| file! + +Thus, in the situation above, one may wonder why the document does not use +|\addcontentsline| after the |\part*| as it must do so for sub-sectioning +units if they are to appear in the local TOC. + +One may imagine some document where all |Part|s are non-numbered (and are not +pushed to the |.toc| file) but nevertheless the user wants its +\csb{localtableofcontents} for each one: then indeed \csb{etocsetlocaltop.toc} +will help in that case. + +There are at least two more methods to handle this situation: +\begin{itemize} +\item the first one is simply to use the |\addcontentsline{toc}{part}{..}| + commands, and to set the |part| style to do nothing, so that the main TOC + will not display them, +\item the second one does not add the |\addcontentsline{toc}{part}{...}| but + uses ``depth tags'' (\autoref{ssec:tocwithdepthtags}) and multiple + \csb{tableofcontents} (not \csb{localtableofcontents}), one for each desired + local TOC. +\end{itemize} + +There is a variant of the first method which would set the level of |part| +temporarily to |6| for the typesetting of the main TOC. But then the |chapter| +toc line style will execute inside the main TOC only once its \emph{start} and +\emph{finish} parts (see \autoref{sec:etocsetstyle}). This is actually also a +problem of the second method. + +But not of the first method which uses +\centeredline{\csb{etocsetstyle}|{part}{}{}{}{}|} nor of the approach with +\csb{etocsetlocaltop.toc}: the \emph{start} and \emph{finish} portions of the +|chapter| toc line style will get executed at the appropriate times in the +main, global, TOC. + +Be aware however that this use of \csb{etocsetlocaltop.toc}|{part}| will also +cause the main global TOC to execute (once) the \emph{start} and \emph{finish} +portions of the |part| toc line style (assuming here again it is not typeset in +compatibility mode). + +Final remark: usage of \csb{etocsetlocaltop.toc} interferes with +\csb{etocchecksemptiness} only to the extent that it modifies (as explained in +this section) the selection made by \csb{localtableofcontents}, hence the +decision whether the local TOC is empty or not. + \end{otherlanguage} \section{Hacken "`framed parboxes"'} - -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{verbatim} \etocdefaultlines \renewcommand\etoctoprule{\hrule height 2pt depth 2pt} \etocruled{\color{green}\fboxrule2pt\fboxsep1ex @@ -10039,12 +10233,18 @@ Farben nutzen will oder nicht. {\normalfont Dieser Text ist vertikal perfekt zentriert unter Berücksichtigung der \emph{surrounding horizontal rules.}}}}} \ref{toc:globalcmds} -\end{filecontentsdef} +\end{verbatim} -\filecontentsexec\foo +\etocdefaultlines -\filecontentsprint\foo -\attachfile{etocsnippet-\the\value{section}.tex} +\renewcommand\etoctoprule{\hrule height 2pt depth 2pt} + +\etocruled{\color{green}\fboxrule2pt\fboxsep1ex + \fbox{\raisebox{-\fontdimen22\textfont2} + {\color{blue}\parbox{.5\linewidth} + {\normalfont Dieser Text ist vertikal perfekt zentriert + unter Berücksichtigung der \emph{surrounding horizontal rules.}}}}} +\ref{toc:globalcmds} \section{Umstellen der Ebenen} \label{subsec:interverting} @@ -10400,7 +10600,7 @@ zum Beispiel \autoref{sec:mindmap}. % je retire le \clearpage car il y a une page quasi-vide à l'exception de % l'icône Paperclip. -% \clearpage +\clearpage \etocdepthtag.toc {etocandworld} \part{\etoc und die Außenwelt} @@ -10609,12 +10809,14 @@ Aussehen zu erhalten (mindestens zweimal durchlaufen). \part{Der Code} +\localtableofcontents + \section{Zeitstempel} Die deutsche Übersetzung wurden zum letzten Mal am \texttt{\etocDEDEdocdate} (Paketversion \texttt{\etocDEDEpkgversion}) geändert (abgesehen von den organisatorischen Veränderungen). -Einige neuere Abschnitte bleiben in englischer Sprache. +Einige neuere Abschnitte bleiben auf Englisch. Dokumentation erzeugt von der Quelldatei mit dem Stempel \texttt{\etocdtxtimestamp}. Die dokumentierte Paketversion ist @@ -10689,7 +10891,25 @@ Dokumentation erzeugt von der Quelldatei mit dem Stempel \begin{multicols}{2} \begin{jfverbatim} -v1.08j [2017/09/21]^ +v1.08k [2017/09/28]^ + + Adds \etocsetlocaltop.toc. See corresponding manual section for + details. + + Adds \etocsavedparttocline, \etocsavedchaptertocline, + \etocsavedsectiontocline, ... They can be used in the context of + the technique explained in section "Another compatibility mode". + + Formerly, etoc redefined for the duration of the TOC the memoir + macro \chapternumberline and its likes to have same meaning as + \numberline (of course, not when executed in compatibility mode), + for the sake of extraction of \etocnumber. + + New method detects presence of any \numberline macro without + any change to originals; they can thus be used as is when applying + the approach of "Another compatibility mode" section from manual. + +~v1.08j [2017/09/21]^ Since 1.08a-2015/03/13 \etocname, \etocnumber, \etocpage contain, if hyperref is present and configured for using @@ -11192,7 +11412,7 @@ v1.08j [2017/09/21]^ \def\etocglobaldefs{\let\Etoc@global\global\let\tof@global\global} \def\etoclocaldefs {\let\Etoc@global\@empty\let\tof@global\@empty} \newif\ifEtoc@jj % book -\newif\ifEtoc@j % part +\newif\ifEtoc@j % part \newif\ifEtoc@ % chapter \newif\ifEtoc@i % section \newif\ifEtoc@ii % subsection @@ -11220,7 +11440,7 @@ v1.08j [2017/09/21]^ \def\etoc@{\etoc@} % \end{macrocode} % |1.07g| uses a second counter; this could be avoided, but ok, let's not be -% that strict. +% that strict. % \begin{macrocode} \newcounter{etoc@tocid} \newcounter{etoc@tocdepth}% 1.07g @@ -11265,7 +11485,7 @@ v1.08j [2017/09/21]^ \expandafter\let\csname Etoc@5@@\endcsname \Etoc@@five@@ \expandafter\let\csname Etoc@6@@\endcsname \Etoc@@six@@ \let\Etoc@all@@ \Etoc@@five@@ -\let\Etoc@none@@ \Etoc@minf +\let\Etoc@none@@ \Etoc@minf % \end{macrocode} % Versions earlier than |1.08| did |\Etoc@newlevel| in a quite % embarrassing way with an |\edef|. @@ -11275,10 +11495,10 @@ v1.08j [2017/09/21]^ % \begin{macrocode} \let\Etoc@levellist\@empty \def\Etoc@newlevel #1{\expandafter\def\expandafter\Etoc@levellist\expandafter - {\Etoc@levellist\Etoc@levellist@elt #1}} + {\Etoc@levellist\Etoc@levellist@elt{#1}}} \def\etocsetlevel#1#2{% - \@ifundefined{Etoc@#1@@}{\expandafter\Etoc@newlevel\csname l@#1\endcsname}{}% - \ifcase#2\relax + \@ifundefined{Etoc@#1@@}{\Etoc@newlevel{#1}}{}% + \ifcase#2\relax \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@zero@@ \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@zero@ \or @@ -11299,19 +11519,22 @@ v1.08j [2017/09/21]^ \or \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@six@@ \else - \ifnum#2=\m@ne - \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minusone@@ - \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minusone@ - \else - \ifnum#2=-\tw@ + \ifnum#2=\m@ne + \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minusone@@ + \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minusone@ + \else + \ifnum#2=-\tw@ \expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@ \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@ - \else - \PackageWarning{etoc} + \else + \PackageWarning{etoc} {unexpected value `#2' in \string\etocsetlevel.^^J% Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}% - \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@ -\fi\fi\fi} + \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@ + \fi + \fi + \fi +} \etocsetlevel{book}{-2} \etocsetlevel{part}{-1} \etocsetlevel{chapter}{0} @@ -11324,7 +11547,7 @@ v1.08j [2017/09/21]^ % The first two parameters of |\Etoc@et@hop| are exchanged in |1.08| % compared to earlier versions; this is in relation to changes done in % |\Etoc@etoccontentsline|. -% +% % |1.08i| as a |fourorthree| rather than as formerly a |sixorfive|. % \begin{macrocode} \AtBeginDocument{% @@ -11343,52 +11566,52 @@ v1.08j [2017/09/21]^ % |1.08| uses |\Etoc@level| rather than a |#1| which used to be anyhow always % the |\Etoc@tmp|. Now |\Etoc@level| is what was called formerly |\Etoc@tmp| % in |\Etoc@etoccontentsline|. +% +% Attention that |\Etoc@setflags| must not modify |\Etoc@next|! % \begin{macrocode} \def\Etoc@setflags {% - \ifcase \Etoc@level - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiifalse - \global\Etoc@iifalse - \global\Etoc@ifalse - \global\Etoc@true - \or - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiifalse - \global\Etoc@iifalse - \global\Etoc@itrue - \or - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiifalse - \global\Etoc@iitrue - \or - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiitrue - \or - \global\Etoc@vfalse - \global\Etoc@ivtrue - \or - \global\Etoc@vtrue - \else -% \end{macrocode} -% |2015/03/08| I move up the common assignments. -% \begin{macrocode} - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiifalse - \global\Etoc@iifalse - \global\Etoc@ifalse - \global\Etoc@false - \ifnum\Etoc@level=\m@ne - \global\Etoc@jtrue + \ifcase \Etoc@level + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iifalse + \global\Etoc@ifalse + \global\Etoc@true + \or + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iifalse + \global\Etoc@itrue + \or + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iitrue + \or + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiitrue + \or + \global\Etoc@vfalse + \global\Etoc@ivtrue + \or + \global\Etoc@vtrue \else - \global\Etoc@jfalse - \global\Etoc@jjtrue + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iifalse + \global\Etoc@ifalse + \global\Etoc@false + \ifnum\Etoc@level=\m@ne + \global\Etoc@jtrue + \else + \global\Etoc@jfalse + \global\Etoc@jjtrue + \fi \fi - \fi} +} % \end{macrocode} % |1.08| This was originally in |\Etoc@etoccontentsline|, intermixed % with the definitions of |\Etoc@contents| and |\Etoc@prefix|. Separated @@ -11398,44 +11621,110 @@ v1.08j [2017/09/21]^ % |\ifcase| assumes none of the |\Etoc@end@..| routines modify it, % naturally. % \begin{macrocode} -\def\Etoc@doends {% +\def\Etoc@doends {% \ifcase \Etoc@level - \ifEtoc@v \Etoc@end@five\fi - \ifEtoc@iv \Etoc@end@four\fi + \ifEtoc@v \Etoc@end@five \fi + \ifEtoc@iv \Etoc@end@four \fi \ifEtoc@iii\Etoc@end@three\fi - \ifEtoc@ii \Etoc@end@two\fi - \ifEtoc@i \Etoc@end@one\fi + \ifEtoc@ii \Etoc@end@two \fi + \ifEtoc@i \Etoc@end@one \fi \or - \ifEtoc@v \Etoc@end@five\fi - \ifEtoc@iv \Etoc@end@four\fi + \ifEtoc@v \Etoc@end@five \fi + \ifEtoc@iv \Etoc@end@four \fi \ifEtoc@iii\Etoc@end@three\fi - \ifEtoc@ii \Etoc@end@two\fi + \ifEtoc@ii \Etoc@end@two \fi \or - \ifEtoc@v \Etoc@end@five\fi - \ifEtoc@iv \Etoc@end@four\fi + \ifEtoc@v \Etoc@end@five \fi + \ifEtoc@iv \Etoc@end@four \fi \ifEtoc@iii\Etoc@end@three\fi \or - \ifEtoc@v \Etoc@end@five\fi - \ifEtoc@iv\Etoc@end@four\fi - \or - \ifEtoc@v \Etoc@end@five\fi - \or + \ifEtoc@v \Etoc@end@five \fi + \ifEtoc@iv \Etoc@end@four \fi + \or + \ifEtoc@v \Etoc@end@five \fi + \or \else - \ifEtoc@v \Etoc@end@five \fi - \ifEtoc@iv \Etoc@end@four \fi - \ifEtoc@iii\Etoc@end@three\fi - \ifEtoc@ii \Etoc@end@two \fi - \ifEtoc@i \Etoc@end@one \fi - \ifEtoc@ \Etoc@end@zero \fi - \ifnum \Etoc@level =-\tw@ - \ifEtoc@j \Etoc@end@minusone\fi - \fi + \ifEtoc@v \Etoc@end@five \fi + \ifEtoc@iv \Etoc@end@four \fi + \ifEtoc@iii\Etoc@end@three\fi + \ifEtoc@ii \Etoc@end@two \fi + \ifEtoc@i \Etoc@end@one \fi + \ifEtoc@ \Etoc@end@zero \fi + \ifnum \Etoc@level =-\tw@ + \ifEtoc@j \Etoc@end@minusone\fi + \fi \fi } % \end{macrocode} +% |1.08| the |\Etoc@next| will (possibly) execute the |begin| code, +% \emph{before} |\Etoc@contents| and |\Etoc@prefix| get defined, +% contrarily to what I did in earlier versions. I still reset the flags +% before execution of the |begin| codes (although the flags are not +% supposed to be used therein anyhow). +% +% Also the \meta{begin} code does |\Etoc@isfirsttrue|. +% +% |1.08k| This was originally in |\Etoc@etoccontentsline|. Extracted for +% re-use by |\etocsetlocaltop.toc|. Calls |\Etoc@setflags| which must not +% modify |\Etoc@next|. +% \begin{macrocode} +\def\Etoc@dobegins{% + \let\Etoc@next\@empty + \Etoc@global\Etoc@isfirstfalse +% \end{macrocode} +% |2015/03/08| If my naming scheme had not been so baroque, I could easily do +% things in a more concise way here... +% \begin{macrocode} + \ifcase\Etoc@level + \ifEtoc@ + \else + \def\Etoc@next{\Etoc@begin@zero}% + \fi + \or + \ifEtoc@i + \else + \def\Etoc@next{\Etoc@begin@one}% + \fi + \or + \ifEtoc@ii + \else + \def\Etoc@next{\Etoc@begin@two}% + \fi + \or + \ifEtoc@iii + \else + \def\Etoc@next{\Etoc@begin@three}% + \fi + \or + \ifEtoc@iv + \else + \def\Etoc@next{\Etoc@begin@four}% + \fi + \or + \ifEtoc@v + \else + \def\Etoc@next{\Etoc@begin@five}% + \fi + \else + \ifnum\Etoc@level=\m@ne + \ifEtoc@j + \else + \def\Etoc@next{\Etoc@begin@minusone}% + \fi + \else + \ifEtoc@jj + \else + \def\Etoc@next{\Etoc@begin@minustwo}% + \fi + \fi + \fi + \Etoc@setflags + \Etoc@next +} +% \end{macrocode} % Heart of \etoc hack into execution of |.toc| file. The |.toc| % file must contain (at least indirectly via expansion) -% |\contentsline {}...| instructions, with +% |\contentsline {}...| instructions, with % the standard meaning of executing |\l@unit| (the hyperref % modifications are taken into account). It is the various |\l@unit|'s % which are (locally) |\let| to |\Etoc@lxyz| and it is |\Etoc@lxyz| @@ -11511,18 +11800,22 @@ v1.08j [2017/09/21]^ \ifEtoc@localtoc \ifEtoc@stoptoc\Etoc@skipthisonetrue \else - \ifEtoc@notactive\Etoc@setflags\Etoc@skipthisonetrue + \ifEtoc@notactive\Etoc@setflags + \Etoc@skipthisonetrue \else - \ifnum\Etoc@level<\Etoc@localtop\Etoc@skipthisonetrue - \global\Etoc@stoptoctrue + \ifnum\Etoc@level<\Etoc@localtop + \Etoc@skipthisonetrue + \global\Etoc@stoptoctrue \fi \fi \fi \fi \fi \let\Etoc@next\Etoc@gobblefourorthree - \ifEtoc@skipthisone\else - \ifnum\c@tocdepth<\Etoc@level\else + \ifEtoc@skipthisone + \else + \ifnum\c@tocdepth<\Etoc@level + \else \ifEtoc@standard \let\Etoc@next\Etoc@savedcontentsline \else @@ -11530,7 +11823,7 @@ v1.08j [2017/09/21]^ \fi \fi \fi - \Etoc@next {#1}% + \Etoc@next{#1}% } % \end{macrocode} % |1.08| New way to handle the compatibility mode. One has to worry @@ -11547,48 +11840,15 @@ v1.08j [2017/09/21]^ % inclusive of |\Etoc@doends| which may close groups. (code has changed since, % slightly). % -% Versions |1.08| extracts to a separate macro |\Etoc@doends|. Earlier code +% |1.08| extracts to a separate macro |\Etoc@doends|. Earlier code % did |\global\let\Etoc@next\relax| but we can now give a default |\relax| % value to |\Etoc@next| with no need of a |\global| prefix. -% \begin{macrocode} -\def\Etoc@etoccontentsline@ #1{% - \Etoc@doends -% \end{macrocode} -% |1.08| the |\Etoc@next| will (possibly) execute the |begin| code, -% \emph{before} |\Etoc@contents| and |\Etoc@prefix| get defined, -% contrarily to what I did in earlier versions. I still reset the flags -% before execution of the |begin| codes (although the flags are not -% supposed to be used therein anyhow). % -% Also the \meta{begin} code does |\Etoc@isfirsttrue|. -% \begin{macrocode} - \let\Etoc@next\@empty - \Etoc@global\Etoc@isfirstfalse -% \end{macrocode} -% |2015/03/08| If my naming scheme had not been so baroque, I could easily do -% things in a more concise way here... +% |1.08k| extracts |\Etoc@dobegins|. % \begin{macrocode} - \ifcase\Etoc@level - \ifEtoc@\else \def\Etoc@next{\Etoc@begin@zero}\fi - \or - \ifEtoc@i\else \def\Etoc@next{\Etoc@begin@one}\fi - \or - \ifEtoc@ii\else \def\Etoc@next{\Etoc@begin@two}\fi - \or - \ifEtoc@iii\else \def\Etoc@next{\Etoc@begin@three}\fi - \or - \ifEtoc@iv\else \def\Etoc@next{\Etoc@begin@four}\fi - \or - \ifEtoc@v\else \def\Etoc@next{\Etoc@begin@five}\fi - \else - \ifnum\Etoc@level=\m@ne - \ifEtoc@j\else \def\Etoc@next{\Etoc@begin@minusone}\fi - \else - \ifEtoc@jj\else \def\Etoc@next{\Etoc@begin@minustwo}\fi - \fi - \fi - \Etoc@setflags - \Etoc@next +\def\Etoc@etoccontentsline@ #1{% + \Etoc@doends % separated since 1.08 + \Etoc@dobegins % separated since 1.08k. Does \Etoc@setflags. % \end{macrocode} % |1.08|: % \begin{enumerate} @@ -11604,7 +11864,7 @@ v1.08j [2017/09/21]^ % \item has |\Etoc@level| rather than |\Etoc@tmp| and thus we can dispense % with the |\ifEtoc@part| switch as we will be able to test the equality % |\Etoc@level=-1| inside of |\Etoc@lxyz|. -% +% % \item adds the |\Etoc@global| prefix. % \end{enumerate} % |1.08i| uses an |\edef| rather than |\def| with a chain of |\expandafter|. @@ -11622,8 +11882,8 @@ v1.08j [2017/09/21]^ % compatibility mode). % % For the record we don't do |\csname l@#1\endcsname| mainly because -% hyperref patches |\contentsline|. -% +% hyperref patches |\contentsline|. +% % The location where |\Etoc@savedcontentsline| is |\let| to % |\contentsline| has been moved with release |1.08| to before the % title as set by |\etocsettoctyle|, thus it is now possible to open a @@ -11637,7 +11897,7 @@ v1.08j [2017/09/21]^ } % \end{macrocode} % START OF MAINLY OBSOLETE COMMENTS -% +% % |2013/03/07|: up to |1.06| \etoc defined only \csa{etocname}, \csa{etocnumber} and % \csa{etocpage}. The |hyperref| added data is recycled in the simplest % manner, prefixing it with \csa{leavevmode}. The included @@ -11673,7 +11933,7 @@ v1.08j [2017/09/21]^ % % |1.08a| drops the original constructions of |\etocname| etc... The obvious % decision to convert \csa{etocname}, etc ... to be the robust versions of -% \csa{etocthelinkedname}, etc ... was delayed two years +% \csa{etocthelinkedname}, etc ... was delayed two years % (from |1.07f 2013/03/07| to |1.08a 2015/03/13|) for sentimental reason. But % the original % versions contained the hyperref destination only in unexpanded form, this @@ -11688,13 +11948,13 @@ v1.08j [2017/09/21]^ % closed for example by a |&| from the sectioning style, even if having used % |\etocglobaldefs|. % \begin{macrocode} -\def\Etoc@lxyz #1#2{% +\def\Etoc@lxyz #1#2{% \Etoc@global\let\etocthelink\@firstofone % fall-back, was let \@empty up to 1.08i (inc.) \Etoc@global\def\etocthename {#1}% (if linked, will be removed later) \Etoc@global\def\etocthelinkedname {#1}% (probably redefined later) \Etoc@getthepage #2\etoc@ % defines \etocthelinkedpage \Etoc@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink - \ifEtoc@number\else + \ifEtoc@number\else \ifnum\Etoc@level=\m@ne \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts \fi @@ -11721,7 +11981,7 @@ v1.08j [2017/09/21]^ \Etoc@global\def\etocthelinkedpage {#1}% } % \end{macrocode} -% |1.07k| corrects a bug here with an extra space before |##1| in +% |1.07k| corrects a bug here with an extra space before |##1| in % |\@namedef{etoclink } ##1|. In 99.99\% of use cases however, the % macro gets redefined at a later stage, thus the bug did not show. % @@ -11766,13 +12026,23 @@ v1.08j [2017/09/21]^ % |1.08| adds the |\Etoc@global|'s. % % |1.08j| corrects an old |\ifx#1\numberline| into |\ifx\numberline#1|. +% +% |1.08k| uses a delimited macro to identify \csa{numberline}, +% \csa{chapternumberline} etc... in one go, avoiding +% the |\let\chapternumberline\numberline| etc... which were done formerly +% in \csa{Etoc@tableofcontents}. Currently \etoc does not yet use \eTeX. % \begin{macrocode} +\begingroup\@tfor\x:=NUMBZRLINZ\do{\catcode\expandafter`\x=12 }\lccode`Z `e +\lowercase{\endgroup +\long\def\Etoc@oneifnumberline #1NUMBZRLINZ#2#3\Etoc@next{% + \ifx\etoc@#20\else1\fi +}% \def\Etoc@getnb@nohyp #1#2#3\etoc@ {% \def\Etoc@getname ##1\relax\relax\etoc@ {% \Etoc@global\def\etocthename {##1}% \Etoc@global\def\etocthelinkedname {##1}% }% - \ifx\numberline#1% + \if1\expandafter\Etoc@oneifnumberline\string#1NUMBZRLINZ\etoc@\Etoc@next \Etoc@global\def\etocthenumber {#2}% \Etoc@global\def\etocthelinkednumber {#2}% \Etoc@global\Etoc@numbertrue @@ -11782,12 +12052,15 @@ v1.08j [2017/09/21]^ \Etoc@global\let\etocthelinkednumber \@empty \Etoc@global\Etoc@numberfalse \fi -} +}% % \end{macrocode} % |1.07n| replaces use of |\toks@| by macro |\Etoc@tmp|. |1.08| adds % the |\Etoc@global|'s. % % |1.08j| corrects the old |\ifx#1\numberline| into |\ifx\numberline#1|. +% +% |1.08k| uses a delimited macro to identify \csa{numberline}, +% \csa{chapternumberline} etc... in one go, avoiding % \begin{macrocode} \def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% \def\Etoc@getname ##1\relax\relax\etoc@ {% @@ -11797,7 +12070,7 @@ v1.08j [2017/09/21]^ {\expandafter\hyperlink \Etoc@tmp{##1}}% }% \def\Etoc@getnbr ##1##2##3\etoc@ {% - \ifx\numberline##1% + \if1\expandafter\Etoc@oneifnumberline\string##1NUMBZRLINZ\etoc@\Etoc@next \Etoc@global\def\etocthenumber {##2}% \edef\Etoc@tmp {{#3}}% \Etoc@global\expandafter\def\expandafter\etocthelinkednumber @@ -11816,7 +12089,7 @@ v1.08j [2017/09/21]^ }% \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% \Etoc@getnbr #4\relax\relax\etoc@ -} +}} % \end{macrocode} % |1.08| adds the |\Etoc@global|'s. % \begin{macrocode} @@ -11825,7 +12098,8 @@ v1.08j [2017/09/21]^ \Etoc@global\def\etocthename {##1}% \Etoc@global\def\etocthelinkedname {##1}% }% - \ifx\relax#2\else + \ifx\relax#2% + \else \Etoc@global\def\etocthenumber {#1}% \Etoc@global\def\etocthelinkednumber {#1}% \Etoc@global\Etoc@numbertrue @@ -11851,7 +12125,8 @@ v1.08j [2017/09/21]^ \expandafter{\expandafter\hyperlink \Etoc@tmp{##1}}% }% \def\Etoc@getnbr ##1\hspace##2##3\etoc@ {% - \ifx\relax##2\else + \ifx\relax##2% + \else \Etoc@global\def\etocthenumber {##1}% \Etoc@global\expandafter\def\expandafter\etocthelinkednumber \expandafter{\expandafter\hyperlink \Etoc@tmp{##1}}% @@ -11917,20 +12192,20 @@ v1.08j [2017/09/21]^ % 1.07d: parskip and |\@nobreakfalse| stuff moved to |\Etoc@tableofcontents| % \begin{macrocode} \def\Etoc@openouttoc{% - \ifEtoc@hyperref + \ifEtoc@hyperref \ifx\hyper@last\@undefined \IfFileExists{\jobname .toc} - {\Hy@WarningNoLine + {\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 + \if@filesw + \newwrite \tf@toc + \immediate \openout \tf@toc \jobname .toc\relax + \fi \global\let\Etoc@openouttoc\empty } % \end{macrocode} @@ -11944,25 +12219,27 @@ v1.08j [2017/09/21]^ % easier to typeset TOC as tables with \etoc! % \begin{macrocode} \def\Etoc@toctoc{% - \global\Etoc@vfalse - \global\Etoc@ivfalse - \global\Etoc@iiifalse - \global\Etoc@iifalse - \global\Etoc@ifalse - \global\Etoc@false - \global\Etoc@jfalse - \global\Etoc@jjfalse -\the\Etoc@toctoks -\ifEtoc@notactive\else - \ifEtoc@v \Etoc@end@five\fi - \ifEtoc@iv \Etoc@end@four\fi - \ifEtoc@iii \Etoc@end@three\fi - \ifEtoc@ii \Etoc@end@two\fi - \ifEtoc@i \Etoc@end@one\fi - \ifEtoc@ \Etoc@end@zero\fi - \ifEtoc@j \Etoc@end@minusone\fi - \ifEtoc@jj \Etoc@end@minustwo\fi -\fi} + \global\Etoc@vfalse + \global\Etoc@ivfalse + \global\Etoc@iiifalse + \global\Etoc@iifalse + \global\Etoc@ifalse + \global\Etoc@false + \global\Etoc@jfalse + \global\Etoc@jjfalse + \the\Etoc@toctoks + \ifEtoc@notactive + \else + \ifEtoc@v \Etoc@end@five\fi + \ifEtoc@iv \Etoc@end@four\fi + \ifEtoc@iii \Etoc@end@three\fi + \ifEtoc@ii \Etoc@end@two\fi + \ifEtoc@i \Etoc@end@one\fi + \ifEtoc@ \Etoc@end@zero\fi + \ifEtoc@j \Etoc@end@minusone\fi + \ifEtoc@jj \Etoc@end@minustwo\fi + \fi +} % \end{macrocode} % Slightly better coded in |1.08b|. Had some bad experiences with TeX % conditionals back in 2011/2012 when I started LaTeX programming, and the @@ -11979,7 +12256,7 @@ v1.08j [2017/09/21]^ % sometimes tokens. % \begin{macrocode} \def\etoc@@startlocaltoc#1#2{% - \ifEtoc@localtoc + \ifEtoc@localtoc \ifnum #1=#2\relax \ifEtoc@jj \global\let\Etoc@localtop\Etoc@@minusone@@ \fi \ifEtoc@j \global\let\Etoc@localtop\Etoc@@zero@@ \fi @@ -12071,7 +12348,10 @@ v1.08j [2017/09/21]^ \expandafter \let\expandafter\etocxifwasempty\csname etocifwasempty \endcsname \def\Etoc@testingcontentslinelocal #1{% - \ifEtoc@stoptoc\else\ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else + \ifEtoc@stoptoc + \else + \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@ + \else \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname % \end{macrocode} % |\ifEtoc@notactive| set to False by |\etoc@startlocaltoc| with right id. It @@ -12080,33 +12360,41 @@ v1.08j [2017/09/21]^ % initialized by |\etoc@@startlocaltoc| as |\ifEtoc@notactive| flag can be % false only then. % \begin{macrocode} - \ifEtoc@notactive\else + \ifEtoc@notactive + \else \ifnum\Etoc@level>\Etoc@localtop - \ifnum\Etoc@level>\c@tocdepth\else - \global\Etoc@emptytocfalse - \global\Etoc@stoptoctrue + \ifnum\Etoc@level>\c@tocdepth + \else + \global\Etoc@emptytocfalse + \global\Etoc@stoptoctrue \fi \else \global\Etoc@stoptoctrue \fi \fi - \fi\fi + \fi + \fi \Etoc@gobblefourorthree\relax } \def\Etoc@testingcontentsline #1{% - \ifEtoc@stoptoc\else - \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else - \ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth\else - \global\Etoc@emptytocfalse - \global\Etoc@stoptoctrue - \fi\fi\fi + \ifEtoc@stoptoc + \else + \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@ + \else + \ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth + \else + \global\Etoc@emptytocfalse + \global\Etoc@stoptoctrue + \fi + \fi + \fi \Etoc@gobblefourorthree\relax } % \end{macrocode} % |1.07g| suppresses the printing of |--unknown etoc ref: run latex again--| as % sometimes one uses \csa{localtableofcontents} to prepare something else, and one % does not want any text output even in intermediate runs. -% +% % Also |1.07g| adds \csa{etocaftertochook} to help with % \csa{invisiblelocaltableofcontents} (and then I did \csa{etocsetnexttocdepth}). % |1.07h| makes the hook used by \csa{etocsetnexttocdepth} private. @@ -12188,7 +12476,7 @@ v1.08j [2017/09/21]^ \global\Etoc@emptytocfalse \edef\Etoc@tocid{#1}% \ifnum\Etoc@tocid<\@ne - %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% + %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% \setbox0\hbox{\ref{etoc-ref \@secondoftwo#1: run LaTeX again!}}% %\if@filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi \global\Etoc@stoptoctrue % do only heading @@ -12202,7 +12490,7 @@ v1.08j [2017/09/21]^ \ifEtoc@checksemptiness \Etoc@setemptytocbool \fi \ifEtoc@emptytoc \ifEtoc@notactive - %\PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% + %\PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% \setbox0\hbox{\ref{etoc-id \number\Etoc@tocid: run LaTeX again!}}% %\if@filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi \global\Etoc@emptytocfalse % assume real one will be non-empty @@ -12210,7 +12498,7 @@ v1.08j [2017/09/21]^ \Etoc@tableofcontents \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ \else - %% \PackageWarning{etoc}{This toc is apparently empty}% + %% \PackageWarning{etoc}{This toc is apparently empty}% \fi \else \global\Etoc@stoptocfalse @@ -12226,7 +12514,7 @@ v1.08j [2017/09/21]^ } % \end{macrocode} % |2013/03/07|: I discover a \csa{@namedef} trick to construct the -% \csa{Etoc@again} space delimited macro:\\ +% \csa{Etoc@again} space delimited macro:\\ % | \@namedef {Etoc@again} {...stuff...}|\\ % Original version was (copied from analogous stuff in |source2e|):\\ % | {\def\1{\Etoc@again}\expandafter\gdef\1 {...stuff...}}|\\ @@ -12279,7 +12567,7 @@ v1.08j [2017/09/21]^ \Etoc@tableofcontents \endgroup\ifEtoc@mustclosegroup\endgroup\fi \Etoc@tocdepthreset % 1.07h, renamed 1.08h - \etocaftertochook % 1.07g + \etocaftertochook % 1.07g \@gobble\etoc@ } % \end{macrocode} @@ -12296,7 +12584,7 @@ v1.08j [2017/09/21]^ % could turn the TOC into a local one. Handled by |\Etoc@t@bleofcontents|. % \begin{macrocode} \def\Etoc@table@fcontents{% - \refstepcounter{etoc@tocid}% + \refstepcounter{etoc@tocid}% \Etoc@tocwithidfalse \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \def\Etoc@localtable@fcontents{% @@ -12309,7 +12597,7 @@ v1.08j [2017/09/21]^ % brutal doings of some packages with |\tableofcontents|. % % |1.08| patches |tableof|'s influence. Version |1.4a| or later of |tableof| -% is needed. +% is needed. % \begin{macrocode} \let\etocaftertitlehook \@empty \let\etocaftercontentshook \@empty @@ -12388,14 +12676,17 @@ v1.08j [2017/09/21]^ \etocbeforetitlehook % 1.07m \Etoc@storetocdepth % 1.07g \let\Etoc@savedcontentsline\contentsline % moved up here 1.08 - \let\contentsline\Etoc@etoccontentsline + \let\contentsline\Etoc@etoccontentsline \ifEtoc@standard \else % moved here from \Etoc@toctoc (1.08) - \def\Etoc@levellist@elt####1{\let####1\Etoc@lxyz}% + \def\Etoc@levellist@elt####1{% + \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname + \csname l@####1\endcsname + \expandafter\let\csname l@####1\endcsname\Etoc@lxyz}% \Etoc@levellist - \let\booknumberline\numberline - \let\partnumberline\numberline - \let\chapternumberline\numberline +% \end{macrocode} +% |1.08k| removes |\let\chapternumberline\numberline| etc... done formerly here +% \begin{macrocode} \fi #1% \ifEtoc@parskip\parskip\z@skip\fi %1.07d @@ -12412,7 +12703,7 @@ v1.08j [2017/09/21]^ \ifx\Etoc@global\global\ifx\tof@finish\@empty\else \global\let\contentsline\Etoc@savedcontentsline \fi\fi - \@gobble\etoc@ + \@gobble\etoc@ }% end of \Etoc@tableofcontents definition by \etocsettocstyle } % \end{macrocode} @@ -12468,7 +12759,7 @@ v1.08j [2017/09/21]^ \def\etocminustworightmargin {1.5em plus -0.5fil} \def\etocminusoneleftmargin {1em} \def\etocminusonerightmargin {1em} -\def\etoctoclineleaders +\def\etoctoclineleaders {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}} \def\etocabbrevpagename {p.~} % \end{macrocode} @@ -12497,15 +12788,15 @@ v1.08j [2017/09/21]^ % package. Actually I am not fully satisfied with these line styles. % % \begin{macrocode} -\def\etocdefaultlines{\Etoc@standardfalse % +\def\etocdefaultlines{\Etoc@standardfalse % %% `book': \etoc@setstyle{@minustwo} {\addpenalty\@M\etocskipfirstprefix} {\addpenalty\@secpenalty} - {\begingroup + {\begingroup \etocfontminustwo \addvspace{\etocsepminustwo}% - \parindent \z@ + \parindent \z@ \leftskip \etocminustwoleftmargin \rightskip \etocminustworightmargin \parfillskip \@flushglue @@ -12519,10 +12810,10 @@ v1.08j [2017/09/21]^ \etoc@setstyle{@minusone} {\addpenalty\@M\etocskipfirstprefix} {\addpenalty\@secpenalty} - {\begingroup + {\begingroup \etocfontminusone \addvspace{\etocsepminusone}% - \parindent \z@ + \parindent \z@ \leftskip \etocminusoneleftmargin \rightskip \etocminusonerightmargin \parfillskip \@flushglue @@ -12536,10 +12827,10 @@ v1.08j [2017/09/21]^ \etoc@setstyle{@zero} {\addpenalty\@M\etocskipfirstprefix} {\addpenalty\@itempenalty} - {\begingroup + {\begingroup \etocfontzero \addvspace{\etocsepzero}% - \parindent \z@ \parfillskip \@flushglue + \parindent \z@ \parfillskip \@flushglue \vbox{\etocifnumbered{\etocnumber.\enspace}{}\etocname \baselineskip\etocbaselinespreadzero\baselineskip \par}% @@ -12552,7 +12843,7 @@ v1.08j [2017/09/21]^ {\begingroup \etocfontone \addvspace{\etocsepone}% - \parindent \z@ \parfillskip \z@ + \parindent \z@ \parfillskip \z@ \setbox\z@\vbox{\parfillskip\@flushglue \etocname\par \setbox\tw@\lastbox @@ -12571,16 +12862,16 @@ v1.08j [2017/09/21]^ \par}% 1.08b adds the % here \else \vbox{\etocname~% - \leaders\copy\z@\hfil\break + \leaders\copy\z@\hfil\break \hbox{}\leaders\box\z@\hfil\box\tw@ \baselineskip\etocbaselinespreadone\baselineskip - \par}% + \par}% \fi \endgroup} {\addpenalty\@secpenalty\addvspace{\etocsepzero}}% %% `subsection': \etoc@setstyle{@two} - {\addpenalty\@medpenalty\etocskipfirstprefix} + {\addpenalty\@medpenalty\etocskipfirstprefix} {\addpenalty\@itempenalty} {\begingroup \etocfonttwo @@ -12603,7 +12894,7 @@ v1.08j [2017/09/21]^ \par}% \else \vbox{\etocname~% - \leaders\copy\z@\hfil\break + \leaders\copy\z@\hfil\break \hbox{}\leaders\box\z@\hfil\box\tw@ \baselineskip\etocbaselinespreadtwo\baselineskip \par}% @@ -12636,7 +12927,7 @@ v1.08j [2017/09/21]^ % and |\etocabovetocskip|, I guess, but if I am remember correctly I chose them % to mimick the standard TOC spacings in |article| class. % \begin{macrocode} -\def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex} +\def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex} \def\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex} \def\etoccolumnsep{2em} \def\etocmulticolsep{0ex} @@ -12717,7 +13008,7 @@ v1.08j [2017/09/21]^ \begin{multicols}{#1}[\etoc@ruledheading{#2}]} {\etoc@ruledheading{#2}% \pretolerance\etocmulticolpretolerance - \tolerance\etocmulticoltolerance}} + \tolerance\etocmulticoltolerance}} {\ifnum #1>\@ne\expandafter\@firstofone \else \expandafter\@gobble \fi @@ -12746,8 +13037,8 @@ v1.08j [2017/09/21]^ \dimen\z@\dp\z@ \ifdim\wd\z@<\linewidth \dp\z@\z@ \else \dimen\z@\z@ \fi \setbox\etoc@framed@titlebox=\hb@xt@\linewidth{\color@begingroup - \hss - \ifx\etocbkgcolorcmd\Etoc@relax\else + \hss + \ifx\etocbkgcolorcmd\Etoc@relax\else \sbox\tw@{\color{white}% \vrule\@width\wd\z@\@height\ht\z@\@depth\dimen\z@}% \ifdim\wd\z@<\linewidth \dp\tw@\z@\fi @@ -12778,7 +13069,7 @@ v1.08j [2017/09/21]^ \multicoltolerance\etocmulticoltolerance \setlength{\columnsep}{\etoccolumnsep}% \setlength{\multicolsep}{\etocmulticolsep}% - \begin{multicols}{#1}} + \begin{multicols}{#1}} {\pretolerance\etocmulticolpretolerance \tolerance\etocmulticoltolerance}} {\ifnum #1>\@ne\expandafter\@firstofone @@ -12796,9 +13087,9 @@ v1.08j [2017/09/21]^ \hb@xt@\linewidth{\color@begingroup \etocleftrulecolorcmd\etocleftrule \etocbkgcolorcmd - \leaders\vrule - \@height\ht\etoc@framed@contentsbox - \@depth\dp\etoc@framed@contentsbox + \leaders\vrule + \@height\ht\etoc@framed@contentsbox + \@depth\dp\etoc@framed@contentsbox \hss \etocrightrulecolorcmd\etocrightrule \color@endgroup}\nointerlineskip @@ -12901,7 +13192,7 @@ v1.08j [2017/09/21]^ % \begin{macrocode} \def\etocarticlestyle{% \etocsettocstyle - {\section *{\contentsname + {\section *{\contentsname \@mkboth {\MakeUppercase \contentsname} {\MakeUppercase \contentsname}}} {}} @@ -12914,14 +13205,14 @@ v1.08j [2017/09/21]^ % \begin{macrocode} \def\etocbookstyle{% \etocsettocstyle - {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi - \chapter *{\contentsname + {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi + \chapter *{\contentsname \@mkboth {\MakeUppercase \contentsname} {\MakeUppercase \contentsname}}} {\if@restonecol \twocolumn \fi}} \def\etocbookstylenomarks{% \etocsettocstyle - {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi + {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi \chapter *{\contentsname}} {\if@restonecol \twocolumn \fi}} \let\etocreportstyle\etocbookstyle @@ -12950,16 +13241,16 @@ v1.08j [2017/09/21]^ {\if@twocolumn \aftergroup \twocolumn \onecolumn \fi }} {}% % \end{macrocode} -% |1.07k|: next line to do as within current |scrartcl 2013/12/19 v3.12| +% |1.07k|: next line to do as within current |scrartcl 2013/12/19 v3.12| % KOMA-Script article class. % \begin{macrocode} \iftocfeature {toc}{numberline}{\def \nonumberline {\numberline {}}}{}% \tocbasic@listhead {\listoftocname}% - \begingroup \expandafter \expandafter \expandafter - \endgroup \expandafter - \ifx - \csname microtypesetup\endcsname \relax - \else + \begingroup \expandafter \expandafter \expandafter + \endgroup \expandafter + \ifx + \csname microtypesetup\endcsname \relax + \else \iftocfeature {toc}{noprotrusion}{} {\microtypesetup {protrusion=false}% \PackageInfo {tocbasic}% @@ -12967,10 +13258,10 @@ v1.08j [2017/09/21]^ \fi \setlength {\parskip }{\z@ }% \setlength {\parindent }{\z@ }% - \setlength {\parfillskip }{\z@ \@plus 1fil}% + \setlength {\parfillskip }{\z@ \@plus 1fil}% \csname tocbasic@@before@hook\endcsname \csname tb@toc@before@hook\endcsname} - {\csname tb@toc@after@hook\endcsname + {\csname tb@toc@after@hook\endcsname \csname tocbasic@@after@hook\endcsname}} \let\etocscrbookstyle\etocscrartclstyle \let\etocscrreprtstyle\etocscrartclstyle @@ -13037,7 +13328,7 @@ v1.08j [2017/09/21]^ %have the |\if@cftnctoc| boolean. % \begin{macrocode} \def\etoctocloftstyle {% - \etocsettocstyle + \etocsettocstyle {\@cfttocstart\par\begingroup \parindent\z@ \parskip\cftparskip \@cftmaketoctitle \if@cfttocbibind\@cftdobibtoc\fi }% @@ -13053,7 +13344,7 @@ v1.08j [2017/09/21]^ {\@ifpackageloaded{tocloft} {\if@cftnctoc\else \PackageWarning {etoc} - {Package `tocloft' was loaded after `etoc'!^^J% + {Package `tocloft' was loaded after `etoc'!^^J% **** to prevent it from overwriting \protect\tableofcontents, it will be tricked^^J% **** into believing to have been loaded with option `titles'. For better^^J% **** compatibility, please load `tocloft' before `etoc'}% @@ -13069,11 +13360,11 @@ v1.08j [2017/09/21]^ % \begin{macrocode} \def\Etoc@addtocontents #1#2% {\ifEtoc@hyperref - \addtocontents {toc}{\protect\contentsline + \addtocontents {toc}{\protect\contentsline {#1}{#2}% {\thepage }{\@currentHref }}% \else - \addtocontents {toc}{\protect\contentsline + \addtocontents {toc}{\protect\contentsline {#1}{#2}{\thepage }}% \fi} \def\Etoc@addcontentsline@ #1#2#3% @@ -13084,12 +13375,12 @@ v1.08j [2017/09/21]^ % \end{macrocode} % All the following added for version |1.07g [2013/10/13]|. Motivated by % a demand about |tovsec2|. But it is impossible to make |tocvsec2| -% compatible, if not re-doing all `toc' macros in |tocvsec2| +% compatible, if not re-doing all `toc' macros in |tocvsec2| % (|v1.3, 2011/08/07|). I do not retain the stack idea, which does not convince % me as useful. The empty line in the |.toc| file is put there by -% |tocvsec2| (see its code line 143). -% -% I take this opportunity to add to the start of the toc file +% |tocvsec2| (see its code line 143). +% +% I take this opportunity to add to the start of the toc file % |\let\etoc@startlocaltoc\@gobble| in case |etoc| is not detected, I should % possibly have done that long ago (like I did in |tableof|). % @@ -13110,11 +13401,11 @@ v1.08j [2017/09/21]^ % \begin{macrocode} \def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth } \def\Etoc@resettocdepth {\global\c@tocdepth\c@etoc@tocdepth } -\def\etocobeytoctocdepth {\def\etoc@settocdepth +\def\etocobeytoctocdepth {\def\etoc@settocdepth {\afterassignment\Etoc@@nottoodeep \global\c@tocdepth}} \def\Etoc@@nottoodeep {\ifnum\c@tocdepth>\c@etoc@tocdepth \global\c@tocdepth\c@etoc@tocdepth\fi } -\def\etocignoretoctocdepth {\let\etoc@settocdepth\@gobble } +\def\etocignoretoctocdepth {\let\etoc@settocdepth\@gobble } \def\etocsettocdepth {\futurelet\Etoc@nexttoken\Etoc@set@tocdepth } \def\Etoc@set@tocdepth {\ifx\Etoc@nexttoken\bgroup \expandafter\Etoc@set@tocdepth@ @@ -13130,15 +13421,15 @@ v1.08j [2017/09/21]^ \@ifundefined{Etoc@#1@@}% {\PackageWarning{etoc} {Unknown sectioning depth #1, \protect\etocsettocdepth.toc ignored}}% - {\addtocontents {toc} - {\protect\etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}% + {\addtocontents {toc} + {\protect\etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}% } % \end{macrocode} % |1.07h| adds the depth tags, and an even more general mechanism could be added % at some point: we could insert `action' tags and have the user map them to -% arbitrary commands. For the time being we just provide +% arbitrary commands. For the time being we just provide % |\etocdepthtag.toc {name}| and |\etocsettagdepth {tag_name}{level}| where -% level is numeric or +% level is numeric or % alphabetical. The numeric % level |-3| is now again not accepted by |\etocsetlevel|, it can be used with % |\etocsettagdepth| (which accepts equivalently |none|). @@ -13165,7 +13456,7 @@ v1.08j [2017/09/21]^ % downgrades it from warning to info). % \begin{macrocode} \def\Etoc@tocvsec@err #1{\PackageError {etoc} - {the command \protect#1\space is incompatible with etoc} + {the command \protect#1\space is incompatible with etoc} {use \protect\etocsettocdepth.toc as replacement (see etoc manual)}% }% \AtBeginDocument {% @@ -13174,7 +13465,7 @@ v1.08j [2017/09/21]^ {Regarding memoir class command \protect\settocdepth, consider^^J \protect\etocsettocdepth.toc as a drop-in replacement with more capabilities^^J (see etoc manual). Similarly - \protect\etocsettocdepth\space and + \protect\etocsettocdepth\space and \protect\etocsetnexttocdepth^^J should replace use of memoir's \protect\maxtocdepth\space command.}} {\@ifpackageloaded {tocvsec2} @@ -13185,12 +13476,12 @@ v1.08j [2017/09/21]^ }% \def\save@tocdepth #1#2#3{}% % if etoc is added to file previously \let\reset@tocdepth\relax % using tocvsec2 - \let\remax@tocdepth\relax + \let\remax@tocdepth\relax \let\tableofcontents\etoctableofcontents \PackageWarning {etoc} {package tocvsec2 detected and its modification of^^J \protect\tableofcontents\space reverted. Use - \protect\etocsettocdepth.toc as a replacement^^J + \protect\etocsettocdepth.toc as a replacement^^J for the tocvsec2 toc-related commands}}{}% }% }% @@ -13203,7 +13494,7 @@ v1.08j [2017/09/21]^ % the actual TOC typesetting. % \begin{macrocode} \def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }% -\def\invisiblelocaltableofcontents +\def\invisiblelocaltableofcontents {\etocsetnexttocdepth {-3}\localtableofcontents }% \def\etocsetnexttocdepth #1{% \@ifundefined{Etoc@#1@@} @@ -13217,22 +13508,70 @@ v1.08j [2017/09/21]^ \global\let\Etoc@tocdepthset\@empty}}% }% % \end{macrocode} +% |1.08k|. Serves to make local TOCs even after headings which were not added +% to the |.toc| file; but of course the local TOCs can only display +% sub-headings which made their way into the |.toc| file... +% \begin{macrocode} +\def\etocsetlocaltop #1#{\Etoc@set@localtop}% +\def\Etoc@set@localtop #1{% + \@ifundefined{Etoc@#1@@}% + {\PackageWarning{etoc} + {Unknown sectioning depth #1, \protect\etocsetlocaltop.toc ignored}}% + {\addtocontents {toc} + {\protect\etoc@setlocaltop\expandafter\protect\csname Etoc@#1@@\endcsname}}% +}% +\def\etoc@setlocaltop #1{% + \global\let\Etoc@level #1% + \Etoc@skipthisonefalse + \ifnum\Etoc@level=\Etoc@@six@@ + \Etoc@skipthisonetrue + \else + \ifEtoc@localtoc + \ifEtoc@stoptoc\Etoc@skipthisonetrue + \else + \ifEtoc@notactive + \Etoc@setflags + \Etoc@skipthisonetrue + \else + \ifnum\Etoc@level<\Etoc@localtop + \Etoc@skipthisonetrue + \global\Etoc@stoptoctrue + \fi + \fi + \fi + \fi + \fi + \let\Etoc@next\@gobble + \ifEtoc@skipthisone + \else + \ifnum\c@tocdepth<\Etoc@level + \else + \ifEtoc@standard + \else + \let\Etoc@next\@firstofone + \fi + \fi + \fi + \Etoc@next{\Etoc@doends\Etoc@dobegins}% +}% +% \end{macrocode} % |1.07h|. In order for the |.toc| file to be usable without error even % without etoc. In |1.07i| use of |\@gobble| for |\etoc@settocdepth|. % \begin{macrocode} \addtocontents {toc}{\protect\@ifundefined{etoctocstyle}% - {\let\protect\etoc@startlocaltoc\protect\@gobble + {\let\protect\etoc@startlocaltoc\protect\@gobble \let\protect\etoc@settocdepth\protect\@gobble - \let\protect\etoc@depthtag\protect\@gobble }{}}% + \let\protect\etoc@depthtag\protect\@gobble + \let\protect\etoc@setlocaltop\protect\@gobble}{}}% % \end{macrocode} % Initializations. % \begin{macrocode} \def\etocstandardlines {\Etoc@standardtrue} \def\etoctoclines {\Etoc@standardfalse} \etocdefaultlines -\etocstandardlines +\etocstandardlines \etocstandarddisplaystyle -\etocobeytoctocdepth +\etocobeytoctocdepth \etocobeydepthtags \let\Etoc@tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth \let\Etoc@tocdepthset \@empty % @@ -13257,7 +13596,7 @@ v1.08j [2017/09/21]^ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{3210}% +\CheckSum{3309}% \csname check@checksum\endcsname \Finale -- cgit v1.2.3