diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.dtx | 747 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.ins | 14 |
2 files changed, 583 insertions, 178 deletions
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index 2f0abe59445..70cda35fe26 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx @@ -1,13 +1,13 @@ % -*- coding: utf-8; -*- %<*none> -{\def\doctimestamp {Time-stamp: <09-04-2015 17:33:38 CEST>}% +{\def\doctimestamp {Time-stamp: <17-04-2015 22:17:33 CEST>}% \def\getdtxtimestamp #1 <#2 #3 #4>{#2 at #3 #4}% \xdef\etocdtxtimestamp {\expandafter\getdtxtimestamp\doctimestamp }}% %</none> %<*!readme> %% %% Package: etoc -%% Version: 1.08d (2015/04/09) +%% Version: 1.08e (2015/04/17) %% License: LPPL 1.3c or later (see etoc.dtx) %% Copyright (C) 2012-2015 Jean-Francois Burnol %% <jfbu at free dot fr> @@ -17,9 +17,9 @@ %% %</!readme> %<*insfile> -\def\etocpkgdate {2015/04/09} -\def\etocdocdate {2015/04/09} -\def\etocpkgversion {v1.08d} +\def\etocpkgdate {2015/04/17} +\def\etocdocdate {2015/04/17} +\def\etocpkgversion {v1.08e} \def\etocpkgdescription {Completely customisable TOCs (jfB)} %</insfile> %<*none> @@ -36,7 +36,7 @@ \catcode32=13\catcode`\\=12^^Brelax^^A ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A {% Package: etoc -% Version: 1.08d (2015/04/09) +% Version: 1.08e (2015/04/17) % License: LPPL 1.3c or later % Copyright (C) 2012-2015 Jean-Francois Burnol <jfbu at free dot fr> % Copyright (C) 2014-2015 Christine Roemer <Christine_Roemer at t-online dot de> @@ -71,7 +71,7 @@ %<*readme> <!-- --> - Source: etoc.dtx (v1.08d 2015/04/09) + Source: etoc.dtx (v1.08e 2015/04/17) Author: Jean-Francois Burnol Author: Christine Roemer et al. (German tranlation) Info: Completely customisable TOCs @@ -135,9 +135,9 @@ It is also possible to run latex or pdflatex directly on etoc.dtx. At least three ways to produce etoc.pdf (method (3) is preferred): -1. latex etoc.dtx (four times), then dvips, then ps2pdf -2. pdflatex etoc.dtx (four times) -3. latex etoc.tex (four times), then dvipdfmx +1. latex etoc.dtx (thrice), then dvips, then ps2pdf +2. pdflatex etoc.dtx (thrice) +3. latex etoc.tex (thrice), then dvipdfmx Method (3) produces the smallest pdf files. Options can be set in etoc.tex: @@ -197,6 +197,32 @@ etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi. RECENT CHANGES ============== +v1.08e \[2015/04/17\] +--------------------- + +The command `\etocchecksemptiness` tells etoc to not print, from +that point on, the headings of the local tables of contents if +they have empty contents. This is mainly for class authors who +might want to have their `\section` or `\chapter` automatically do +a `\localtableofcontents`. Could prove also useful for batch +conversions of documents. Thanks to Paul Gaborit who asked for +such a feature. + +The command `\etocnotocifnotoc` extends this behaviour to global +TOCs: indeed why should documents with no sectioning units take +this as an excuse not to use package etoc ? + +The command `\etocifwasempty{yes}{no}` can be used for +suitable extra action. + +A `\tableofcontents\ref{foo}` now expects foo to be a label to a +_local_ TOC. The use with foo a label to a _global_ TOC is not +supported anymore as it had no utility and made the code more +complex. + +The syntax `\localtableofcontents\ref{foo}` is now accepted as a +synonym to the earlier syntax `\tableofcontents\ref{foo}`. + v1.08d \[2015/04/09\] --------------------- @@ -296,7 +322,7 @@ Daniel Büttner, Claudia Dahl, Christian Otto and Christine Römer (FSU Jena). My grateful thanks to all! %</readme> %<*tex>------------------------------------------------------------------------- -%% run latex four times on this file etoc.tex then dvipdfmx on etoc.dvi +%% run latex thrice on this file etoc.tex then dvipdfmx on etoc.dvi %% to produce the documentation etoc.pdf, with source code included. %% %% possible dvipdfmx warnings may be ignored, but in case of a too @@ -348,9 +374,9 @@ Jena). My grateful thanks to all! %% etoc.sty, etoc.tex, etoc-DE.tex and README.md %% %% At least three ways to produce etoc.pdf (method (3) is preferred): -%% (1) latex etoc.dtx (four times), then dvips, then ps2pdf -%% (2) pdflatex etoc.dtx (four times) -%% (3) latex etoc.tex (four times), then dvipdfmx +%% (1) latex etoc.dtx (thrice), then dvips, then ps2pdf +%% (2) pdflatex etoc.dtx (thrice) +%% (3) latex etoc.tex (thrice), then dvipdfmx %% %% Method (3) produces the smallest pdf files. %% Options can be set in etoc.tex (and etoc-DE.tex): @@ -716,6 +742,16 @@ Jena). My grateful thanks to all! \addto\captionsngerman {\renewcommand\partname{Teil}} } +% TEMPORARY 2015/04/16 +\usepackage{etex} +% With the new LaTeX format (dated 2015/01/01) but released to CTAN +% around 2015/03/31, and which will be in TL2015, package etoolbox +% Package: etoolbox 2015/03/19 v2.1d e-TeX tools for LaTeX (JAW) +% does not load etex.sty, but this currently breaks package forest +% Package: forest 2014/03/07 v1.05 Drawing (linguistic) trees +% because of the missing \locbox macro +% END + \usepackage{tikz} \usetikzlibrary{trees} % added for "cyclic" grow function 2013/03/02 \usepackage{forest} % switched from tikz-qtree to forest 2013/09/09 @@ -1024,7 +1060,13 @@ etoc-page etoc-skip-first-pre-fix etoc-num-ber etoc-if-first +etoc-x-if-first etoc-if-num-bered +etoc-x-if-num-bered +etoc-if-was-empty +etoc-x-if-was-empty +etoc-checks-empti-ness +etoc-no-toc-if-no-toc etoc-the-name etoc-the-num-ber etoc-the-page @@ -1113,7 +1155,8 @@ etoc-left-rule-col-or-cmd etoc-right-rule-col-or-cmd etoc-bot-tom-rule-col-or-cmd etoc-bkg-col-or-cmd -etoc-framed-mp-hook} +etoc-framed-mp-hook +} \hyphenation{next-toc-with-tags} \frenchspacing @@ -1200,9 +1243,9 @@ etoc-framed-mp-hook} nodes={concept}, concept color=orange!60, root concept/.append style={font=\huge, text width = 6cm}, - level 1/.append style={level distance=7cm, sibling angle=360/8},% 8 hard-coded mais je pourrais aussi le calculer + level 1/.append style={level distance=7cm, sibling angle=360/9},% 9 hard-coded mais je pourrais aussi le calculer level 1 concept/.append style={font=\Large, text width = 3cm}, - level 2/.append style={level distance=12.5cm, sibling angle=360/35},% 35 hard coded mais je pourrais aussi le calculer + level 2/.append style={level distance=12.5cm, sibling angle=360/39},% 39 hard coded mais je pourrais aussi le calculer % distance par rapport au CENTRE ! (avec le code tel qu'en ce moment) ] \the\treetok @@ -1310,7 +1353,9 @@ manner: they are made available via the \csb{etocname}, \etoc appears to be (at least partially) compatible with the |article|, |book|, |report|, |scrartcl|, |scrbook|, |scrreprt| and -|memoir| classes. Starting with release |1.07k| it is possible to +|memoir| classes. + +Starting with release |1.07k| it is possible to use \etoc concurrently with package |tocloft|. \section{License} @@ -1321,7 +1366,7 @@ use \etoc concurrently with package |tocloft|. \etocLicense\endgroup -\clearpage +% \clearpage \etocsettocdepth {subsection} @@ -1673,6 +1718,7 @@ layout is a bit like the one of the \hyperref[toc:main]{main document \etocsettagdepth {globalcmds} {subsection} \etocsettagdepth {custom} {none} \etocsettagdepth {tips} {none} +\etocsettagdepth {etocandworld}{none} \etocsettagdepth {code} {none} \etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{} @@ -1723,6 +1769,7 @@ The code: \etocsettagdepth {globalcmds} {subsection} \etocsettagdepth {custom} {none} \etocsettagdepth {tips} {none} +\etocsettagdepth {etocandworld}{none} \etocsettagdepth {code} {none} \etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{} @@ -3348,10 +3395,10 @@ example was motivated on |2015/03/11| by % #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}} \renewcommand*{\appendchildtree}[3]{% -% this is to construct "t1 child [branch color= #3]{t2}" from #1=t1 and #2=t2 +% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2 % t1 and t2 are two toks variable (not macros) % #3 = for example teal!60 - \edef\tmpstuff {\the#1 child [branch color = #3]{\the#2}}% + \edef\tmpstuff {\the#1 child [#3]{\the#2}}% #1\expandafter {\tmpstuff }% } @@ -3365,18 +3412,21 @@ example was motivated on |2015/03/11| by % This updates the global tree with the data from the previous % part and all its children sections. Moved here because for some parts the % sections are not displayed due to depth tags. - {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... - \fi + {\ifnum\value{partco}=3 + \appendchildtree\treetok\parttok {branch color= green!50,level distance=10cm}% + \else +\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi\fi } {\stepcounter{partco}% % customize manually some TikZ set-up (should be done inside the TikZ thing I guess) \def\tmpoption {}% \def\tmprotate {}% first - \ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi - \ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi + %\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi + %\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi % define the part node \edef\partnode{node \tmpoption {\unexpanded\expandafter{\etocthelinkednumber}. @@ -3384,9 +3434,9 @@ example was motivated on |2015/03/11| by % this is a starting point which will be filled it by the section children \parttok\expandafter{\partnode}} {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... \fi } @@ -3410,13 +3460,14 @@ example was motivated on |2015/03/11| by \etocsetnexttocdepth{section} % use of depth tags to cut out some sections. \etocsettagdepth {preamble} {none} -\etocsettagdepth {overview} {section} +\etocsettagdepth {overview} {part} \etocsettagdepth {arbitrarily}{part} \etocsettagdepth {surprising} {section} \etocsettagdepth {linestyles} {part} -\etocsettagdepth {globalcmds} {section} +\etocsettagdepth {globalcmds} {part} \etocsettagdepth {custom} {section} -\etocsettagdepth {tips} {section} +\etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {section} \tikzset{ @@ -3436,8 +3487,8 @@ example was motivated on |2015/03/11| by nodes={concept}, concept color=orange!60, root concept/.append style={text width=4cm, font=\Large}, - level 1/.append style={level distance=5cm,sibling angle=45, text width=3cm}, - level 2/.append style={level distance=8cm,sibling angle=25, text width=3cm}, + level 1/.append style={level distance=5cm,sibling angle=40, text width=3cm}, + level 2/.append style={level distance=7cm,sibling angle=30, text width=3cm}, level 1 concept/.append style={font=\normalsize}, ] \the\treetok @@ -3467,10 +3518,10 @@ appears \vpageref{toc:mindmap}. #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}} \renewcommand*{\appendchildtree}[3]{% -% this is to construct "t1 child [branch color= #3]{t2}" from #1=t1 and #2=t2 +% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2 % t1 and t2 are two toks variable (not macros) % #3 = for example teal!60 - \edef\tmpstuff {\the#1 child [branch color = #3]{\the#2}}% + \edef\tmpstuff {\the#1 child [#3]{\the#2}}% #1\expandafter {\tmpstuff }% } @@ -3484,18 +3535,21 @@ appears \vpageref{toc:mindmap}. % This updates the global tree with the data from the previous % part and all its children sections. Moved here because for some parts the % sections are not displayed due to depth tags. - {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... - \fi + {\ifnum\value{partco}=3 + \appendchildtree\treetok\parttok {branch color= green!50,level distance=10cm}% + \else +\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi\fi } {\stepcounter{partco}% % customize manually some TikZ set-up (should be done inside the TikZ thing I guess) \def\tmpoption {}% \def\tmprotate {}% first - \ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi - \ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi + %\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi + %\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi % define the part node \edef\partnode{node \tmpoption {\unexpanded\expandafter{\etocthelinkednumber}. @@ -3503,9 +3557,9 @@ appears \vpageref{toc:mindmap}. % this is a starting point which will be filled it by the section children \parttok\expandafter{\partnode}} {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... \fi } @@ -3529,13 +3583,14 @@ appears \vpageref{toc:mindmap}. \etocsetnexttocdepth{section} % use of depth tags to cut out some sections. \etocsettagdepth {preamble} {none} -\etocsettagdepth {overview} {section} +\etocsettagdepth {overview} {part} \etocsettagdepth {arbitrarily}{part} \etocsettagdepth {surprising} {section} \etocsettagdepth {linestyles} {part} -\etocsettagdepth {globalcmds} {section} +\etocsettagdepth {globalcmds} {part} \etocsettagdepth {custom} {section} -\etocsettagdepth {tips} {section} +\etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {section} \tikzset{ @@ -3555,8 +3610,8 @@ appears \vpageref{toc:mindmap}. nodes={concept}, concept color=orange!60, root concept/.append style={text width=4cm, font=\Large}, - level 1/.append style={level distance=5cm,sibling angle=45, text width=3cm}, - level 2/.append style={level distance=8cm,sibling angle=25, text width=3cm}, + level 1/.append style={level distance=5cm,sibling angle=40, text width=3cm}, + level 2/.append style={level distance=7cm,sibling angle=30, text width=3cm}, level 1 concept/.append style={font=\normalsize}, ] \the\treetok @@ -3579,7 +3634,9 @@ example), this code snippet will write it out to file with extension \immediate\write\TOCasTree{\the\treetok}% \end{verbatim} The author can then copy it from there and customize it manually to get a -suitable tikz picture. +suitable tikz picture. See also +\centeredline{\url{http://tex.stackexchange.com/a/232792}} +for an elaboration of this. \section{The TOC as a table} @@ -3797,6 +3854,71 @@ To return to the default, use \csb{etoclocaldefs}. Note that both \csb{etocglobaldefs} and \csb{etoclocaldefs} actions are local to the environment or group where they are used. +\section{Not displayed empty TOCs} + +\subsection{The command \csbhyp{etocchecksemptiness}} +\label{etocchecksemptiness} + +The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check for +each local table of contents if it is in fact empty; in that case nothing gets +printed at all.\footnote{Thanks to Paul Gaborit who asked for +such a feature.} This +can be useful to authors of \LaTeX{} classes who for example wish to have a +|\chapter| command doing systematically a \csa{localtableofcontents}, or for +people producing files via automatic conversions and some of those might have +sectioning commands and others not. + +«Emptiness» means that no \csa{contentsline} command would get executed within +the scope of the local table of contents --- empty line styles by themselves do +not make the TOC empty. \etoc always executes the \csb{etocaftertochook} +command; and the test for emptiness itself executes everything else found in +the |.toc| file. See \autoref{sec:addingtotoc} in this context. + +The suppression of the heading (more precisely of the toc display style +elements) may be effective only for the final \LaTeX{} runs. For example in +the situation of a \csa{tableofcontents}|\ref{foo}| where the label |foo| is +not yet recognized, the heading (but not the contents) is printed and the TOC +is declared non-empty. Or, if one adds a \localtoc to a document, on the next +run, the test for emptiness will in fact apply to the next one, and the last +local TOC of the document will have its contents temporarily unknown to \etoc, +hence will be declared non empty, and the heading will be printed. + +For a finalized document compiled with initially no auxiliary files, the first +\LaTeX{} run will declare all local TOCs non empty and print for each of them a +heading (and no contents naturally). The second \LaTeX{} run will then +correctly decide which local TOC is empty or not. + + +\subsection{The \csbhyp{etocnotocifnotoc} command} +\label{etocnotocifnotoc} + +The user can then extend the emptiness-checking to the global TOCs with +\csb{etocnotocifnotoc}. May I respectfully give the advice then to rather do +none of |\usepackage{etoc}| nor \toc ? |;-)|. Well, there is always the case +of batch conversions of documents having or not sectioning units. + +\subsection{The \csbhyp{etocifwasempty} command} +\label{etocifwasempty} +\label{etocxifwasempty} + +The command \csb{etocifwasempty}\marg{YES}\marg{NO} executes \meta{YES} if +the previous TOC was found to be empty and \meta{NO} if its was not so. This +may serve to act appropriately after a truly empty TOC. If +\csb{etocchecksemptiness} has not been issued, this conditional always +executes the \meta{NO} branch. + +This command is robust, and \csb{etocxifwasempty} is its expandable +version. + +\fbox{Do not forget the second argument: at least an empty pair of braces |{}| + must be present.} + +This conditional may wrongly say that the local TOC is empty or not empty +until \LaTeX{} compilations stabilize. But if it says that a local TOC is +empty, this does mean that \etoc considered the just encountered local table +of contents to be empty (for that run) and thus printed nothing (not even a +|\par|). + \clearpage \etocdepthtag.toc {linestyles} @@ -4824,6 +4946,7 @@ The code used: }}} \subsection{Labels and references} +\label{ssec:labelref} The commands (starred or not) to actually display the table of contents can be followed with optional labels or references:\par @@ -4836,13 +4959,20 @@ can be followed with optional labels or references:\par \toc \csa{label}|\{toc:here\}|\\ \toc \csa{ref}|\{toc:far\}| \\ \toc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\ - \localtoc \csa{label}|\{toc:here\}|\\ + \localtoc \csa{label}|\{toc:here\}|\\ + \localtoc \csa{ref}|\{toc:far\}| \\ + \localtoc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\ \hbox{}{\itshape\ttfamily\ \ \ \ similarly with\ }% \csa{etocmulticol}{\itshape\ttfamily\ etc . . . } }}} -\medskip The commands for local tables of +\medskip + +New with |1.08e|: \localtoc \csa{ref}|{toc:far}| as synonym for \toc +\csa{ref}|{toc:far}|. + +The commands for local tables of contents do \emph{not} react to a \csa{ref} following them. When re-displaying another toc, only its contents are transferred: @@ -5515,6 +5645,7 @@ get: \etocsettagdepth {globalcmds} {paragraph} \etocsettagdepth {custom} {part} \etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {none} \renewcommand\etoctoprule {\hrule height 3pt\relax } \renewcommand\etoctoprulecolorcmd {\color{blue}} @@ -5577,6 +5708,7 @@ get: \etocsettagdepth {globalcmds} {paragraph} \etocsettagdepth {custom} {part} \etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {none} \renewcommand\etoctoprule {\hrule height 3pt\relax } \renewcommand\etoctoprulecolorcmd {\color{blue}} @@ -5675,7 +5807,12 @@ Note: rather than |\toks| registers it would be easier here to use \eTeX{} \endgroup \end{verbatim} -\subsection{Compatibility with other packages} +\clearpage +\etocdepthtag.toc {etocandworld} + +\part{\etoc and the outside world} + +\section{Compatibility with other packages} \label{etocaftertochook} The contents of the |.toc| file (if it already exists) are read into memory by @@ -5790,7 +5927,7 @@ documentation they do not typeset a TOC title. They should \emph{not} be used in case \csb{etocglobaldefs} was issued before, except if its scope has been terminated since then, or \csb{etoclocaldefs} has cancelled its influence. -\subsection{\TeX nical matters} +\section{\TeX nical matters} The \csb{etocname}, \csb{etocnumber}, \csb{etocpage} commands are protected against premature expansion. They contain suitable |hyperref| links if package @@ -5808,7 +5945,7 @@ The commands such as \csb{etocsetstyle}, \csb{etocsetlevel}, \csb{etocruledstyle}, \csb{etocframedstyle} obey \LaTeX{}'s groups. All TOCs are typeset inside groups. -\subsection{Errors and catastrophes} +\section{Errors and catastrophes} After using \csa{etocsetstyle} for one level, the remaining uncustomized levels use the \etoc default styles (those @@ -5917,9 +6054,9 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. nodes={concept}, concept color=orange!60, root concept/.append style={font=\huge, text width = 6cm}, - level 1/.append style={level distance=7cm, sibling angle=360/8},% 8 hard-coded mais je pourrais aussi le calculer + level 1/.append style={level distance=7cm, sibling angle=360/9},% 8 hard-coded mais je pourrais aussi le calculer level 1 concept/.append style={font=\Large, text width = 3cm}, - level 2/.append style={level distance=12.5cm, sibling angle=360/35},% 35 hard coded mais je pourrais aussi le calculer + level 2/.append style={level distance=12.5cm, sibling angle=360/39},% 39 hard coded mais je pourrais aussi le calculer % distance par rapport au CENTRE ! (avec le code tel qu'en ce moment) ] \the\treetok @@ -6122,7 +6259,7 @@ vorgeschlagen werden (die durch die \hyperref[toc:main]{Hauptinhaltsangabe} in diesem Dokument gezeigt werden) keinen Gebrauch von Umgebungen. Tatsächlich nutzt in dieser Gebrauchsanweisung nur die \hyperref[toc:a]{Inhaltsangabe} zu Beginn von \autoref{part:linestyles} und in \autoref{toc:allsubsections} -e\texttt{numerate}-Umgebungen, um Zeilenstile anzugeben. +\texttt{enumerate}-Umgebungen, um Zeilenstile anzugeben. \section{Zeilenstile und Stile der Inhaltsangabe (toc display style)} @@ -6381,6 +6518,7 @@ anders programmiert sind. \etocsettagdepth {globalcmds} {subsection} \etocsettagdepth {custom} {none} \etocsettagdepth {tips} {none} +\etocsettagdepth {etocandworld}{none} \etocsettagdepth {code} {none} \etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{} @@ -6431,6 +6569,7 @@ Der Code: \etocsettagdepth {globalcmds} {subsection} \etocsettagdepth {custom} {none} \etocsettagdepth {tips} {none} +\etocsettagdepth {etocandworld}{none} \etocsettagdepth {code} {none} \etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{} @@ -8031,10 +8170,10 @@ page}.} % #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}} \renewcommand*{\appendchildtree}[3]{% -% this is to construct "t1 child [branch color= #3]{t2}" from #1=t1 and #2=t2 +% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2 % t1 and t2 are two toks variable (not macros) % #3 = for example teal!60 - \edef\tmpstuff {\the#1 child [branch color = #3]{\the#2}}% + \edef\tmpstuff {\the#1 child [#3]{\the#2}}% #1\expandafter {\tmpstuff }% } @@ -8048,18 +8187,21 @@ page}.} % This updates the global tree with the data from the previous % part and all its children sections. Moved here because for some parts the % sections are not displayed due to depth tags. - {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... - \fi + {\ifnum\value{partco}=3 + \appendchildtree\treetok\parttok {branch color= green!50,level distance=10cm}% + \else +\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi\fi } {\stepcounter{partco}% % customize manually some TikZ set-up (should be done inside the TikZ thing I guess) \def\tmpoption {}% \def\tmprotate {}% first - \ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi - \ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi + %\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi + %\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi % define the part node \edef\partnode{node \tmpoption {\unexpanded\expandafter{\etocthelinkednumber}. @@ -8067,9 +8209,9 @@ page}.} % this is a starting point which will be filled it by the section children \parttok\expandafter{\partnode}} {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... \fi } @@ -8093,13 +8235,14 @@ page}.} \etocsetnexttocdepth{section} % use of depth tags to cut out some sections. \etocsettagdepth {preamble} {none} -\etocsettagdepth {overview} {section} +\etocsettagdepth {overview} {part} \etocsettagdepth {arbitrarily}{part} \etocsettagdepth {surprising} {section} \etocsettagdepth {linestyles} {part} -\etocsettagdepth {globalcmds} {section} +\etocsettagdepth {globalcmds} {part} \etocsettagdepth {custom} {section} -\etocsettagdepth {tips} {section} +\etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {section} \tikzset{ @@ -8119,8 +8262,8 @@ page}.} nodes={concept}, concept color=orange!60, root concept/.append style={text width=4cm, font=\Large}, - level 1/.append style={level distance=5cm,sibling angle=45, text width=3cm}, - level 2/.append style={level distance=8cm,sibling angle=25, text width=3cm}, + level 1/.append style={level distance=5cm,sibling angle=40, text width=3cm}, + level 2/.append style={level distance=7cm,sibling angle=30, text width=3cm}, level 1 concept/.append style={font=\normalsize}, ] \the\treetok @@ -8150,10 +8293,10 @@ hier \vpageref{toc:mindmap}. #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}} \renewcommand*{\appendchildtree}[3]{% -% this is to construct "t1 child [branch color= #3]{t2}" from #1=t1 and #2=t2 +% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2 % t1 and t2 are two toks variable (not macros) % #3 = for example teal!60 - \edef\tmpstuff {\the#1 child [branch color = #3]{\the#2}}% + \edef\tmpstuff {\the#1 child [#3]{\the#2}}% #1\expandafter {\tmpstuff }% } @@ -8167,18 +8310,21 @@ hier \vpageref{toc:mindmap}. % This updates the global tree with the data from the previous % part and all its children sections. Moved here because for some parts the % sections are not displayed due to depth tags. - {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... - \fi + {\ifnum\value{partco}=3 + \appendchildtree\treetok\parttok {branch color= green!50,level distance=10cm}% + \else +\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi\fi } {\stepcounter{partco}% % customize manually some TikZ set-up (should be done inside the TikZ thing I guess) \def\tmpoption {}% \def\tmprotate {}% first - \ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi - \ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi + %\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi + %\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi % define the part node \edef\partnode{node \tmpoption {\unexpanded\expandafter{\etocthelinkednumber}. @@ -8186,9 +8332,9 @@ hier \vpageref{toc:mindmap}. % this is a starting point which will be filled it by the section children \parttok\expandafter{\partnode}} {\ifcase\pseudomodthree{\value{partco}}% - \or \appendchildtree\treetok\parttok {teal!60}% first - \or \appendchildtree\treetok\parttok {yellow!80}% second - \else\appendchildtree\treetok\parttok {green!50}% third and next ... + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... \fi } @@ -8212,13 +8358,14 @@ hier \vpageref{toc:mindmap}. \etocsetnexttocdepth{section} % use of depth tags to cut out some sections. \etocsettagdepth {preamble} {none} -\etocsettagdepth {overview} {section} +\etocsettagdepth {overview} {part} \etocsettagdepth {arbitrarily}{part} \etocsettagdepth {surprising} {section} \etocsettagdepth {linestyles} {part} -\etocsettagdepth {globalcmds} {section} +\etocsettagdepth {globalcmds} {part} \etocsettagdepth {custom} {section} -\etocsettagdepth {tips} {section} +\etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {section} \tikzset{ @@ -8238,8 +8385,8 @@ hier \vpageref{toc:mindmap}. nodes={concept}, concept color=orange!60, root concept/.append style={text width=4cm, font=\Large}, - level 1/.append style={level distance=5cm,sibling angle=45, text width=3cm}, - level 2/.append style={level distance=8cm,sibling angle=25, text width=3cm}, + level 1/.append style={level distance=5cm,sibling angle=40, text width=3cm}, + level 2/.append style={level distance=7cm,sibling angle=30, text width=3cm}, level 1 concept/.append style={font=\normalsize}, ] \the\treetok @@ -8265,7 +8412,8 @@ ausgegeben zur Dateierweiterung \end{verbatim} Der Autor kann sie von dort aus kopieren und manuell anpassen, um ein geignetes TikZ-Bild zu erhalten. - +Siehe auch +\centeredline{\url{http://tex.stackexchange.com/a/232792}} \section{Das TOC als eine Tabelle} \label{sec:tocastable} @@ -8488,7 +8636,73 @@ Um zur Standardeinstellung zurückzukehren, nehmen Sie \csb{etocglobaldefs} and \csb{etoclocaldefs}, lokal für die Umgebung oder Gruppe sind, in der sie verwendet werden. - +\begin{otherlanguage}{english} +\section{Not displayed empty TOCs} + +\subsection{The command \csbhyp{etocchecksemptiness}} +\label{etocchecksemptiness} + +The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check for +each local table of contents if it is in fact empty; in that case nothing gets +printed at all.\footnote{Thanks to Paul Gaborit who asked for +such a feature.} This +can be useful to authors of \LaTeX{} classes who for example wish to have a +|\chapter| command doing systematically a \csa{localtableofcontents}, or for +people producing files via automatic conversions and some of those might have +sectioning commands and others not. + +«Emptiness» means that no \csa{contentsline} command would get executed within +the scope of the local table of contents --- empty line styles by themselves do +not make the TOC empty. \etoc always executes the \csb{etocaftertochook} +command; and the test for emptiness itself executes everything else found in +the |.toc| file. See \autoref{sec:addingtotoc} in this context. + +The suppression of the heading (more precisely of the toc display style +elements) may be effective only for the final \LaTeX{} runs. For example in +the situation of a \csa{tableofcontents}|\ref{foo}| where the label |foo| is +not yet recognized, the heading (but not the contents) is printed and the TOC +is declared non-empty. Or, if one adds a \localtoc to a document, on the next +run, the test for emptiness will in fact apply to the next one, and the last +local TOC of the document will have its contents temporarily unknown to \etoc, +hence will be declared non empty, and the heading will be printed. + +For a finalized document compiled with initially no auxiliary files, the first +\LaTeX{} run will declare all local TOCs non empty and print for each of them a +heading (and no contents naturally). The second \LaTeX{} run will then +correctly decide which local TOC is empty or not. + + +\subsection{The \csbhyp{etocnotocifnotoc} command} +\label{etocnotocifnotoc} + +The user can then extend the emptiness-checking to the global TOCs with +\csb{etocnotocifnotoc}. May I respectfully give the advice then to rather do +none of |\usepackage{etoc}| nor \toc ? |;-)|. Well, there is always the case +of batch conversions of documents having or not sectioning units. + +\subsection{The \csbhyp{etocifwasempty} command} +\label{etocifwasempty} +\label{etocxifwasempty} + +The command \csb{etocifwasempty}\marg{YES}\marg{NO} executes \meta{YES} if +the previous TOC was found to be empty and \meta{NO} if its was not so. This +may serve to act appropriately after a truly empty TOC. If +\csb{etocchecksemptiness} has not been issued, this conditional always +executes the \meta{NO} branch. + +This command is robust, and \csb{etocxifwasempty} is its expandable +version. + +\fbox{Do not forget the second argument: at least an empty pair of braces |{}| + must be present.} + +This conditional may wrongly say that the local TOC is empty or not empty +until \LaTeX{} compilations stabilize. But if it says that a local TOC is +empty, this does mean that \etoc considered the just encountered local table +of contents to be empty (for that run) and thus printed nothing (not even a +|\par|). + +\end{otherlanguage} \clearpage \etocdepthtag.toc {linestyles} @@ -9507,13 +9721,19 @@ unwichtig, ob letztere mit Sternchen versehen sind oder nicht.\par \toc \csa{label}|\{toc:here\}|\\ \toc \csa{ref}|\{toc:far\}| \\ \toc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\ - \localtoc \csa{label}|\{toc:here\}|\\ + \localtoc \csa{label}|\{toc:here\}|\\ + \localtoc \csa{ref}|\{toc:far\}| \\ + \localtoc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\ \hbox{}{\itshape\ttfamily\ \ \ \ \ }% \csa{etocmulticol}{\itshape\ttfamily, etc. funktionieren ähnlich} }}} +\medskip + +Neu mit |1.08b|: \localtoc\csa{ref}|{toc:far}| als Synonym für +\toc\csa{ref}|{toc:far}|. -\medskip Ein \csa{ref}"=Befehl, der auf einen Befehl zur Erzeugung eines lokalen +Ein \csa{ref}"=Befehl, der auf einen Befehl zur Erzeugung eines lokalen Inhaltsverzeichnisses folgt, hat \emph{keinen} Einfluss auf diesen. Wird ein anderes Inhaltsverzeichnis erneut dargestellt, so wird nur dessen Inhalt angepasst. Sowohl das Aussehen des Inhaltsverzeichnisses als auch die @@ -10007,12 +10227,12 @@ vorkommen (Siehe \autoref{part:surprising} für andere Verwendungen dieser Techn %%\etocmarkbothnouc{List of all subsections} %% le mark (\markright) est fait par \subsection -\etocmulticol[3]{\subsection{{Alle Unterabschnitte in diesem Dokument}}\label{toc:allsubsections}} +\etocmulticol[3]{\subsection{Alle Unterabschnitte in diesem Dokument}\label{toc:allsubsections}} \endgroup -\subsection{Sta\-ti\-sti\-ken anzeigen}\label{ssec:statistics} +\subsection{Statistiken anzeigen}\label{ssec:statistics} Jeder Teil dieses Dokuments beginnt mit einem Paragraphen, der sagt, wieviele Kapitel und Unterkapitel er hat. Nun, jeder von diesen Paragraphen ist ein @@ -10197,6 +10417,7 @@ es kann leicht recycelt) erhalten wir: \etocsettagdepth {globalcmds} {paragraph} \etocsettagdepth {custom} {part} \etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {none} \renewcommand\etoctoprule {\hrule height 3pt\relax } \renewcommand\etoctoprulecolorcmd {\color{blue}} @@ -10259,6 +10480,7 @@ es kann leicht recycelt) erhalten wir: \etocsettagdepth {globalcmds} {paragraph} \etocsettagdepth {custom} {part} \etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} \etocsettagdepth {code} {none} \renewcommand\etoctoprule {\hrule height 3pt\relax } \renewcommand\etoctoprulecolorcmd {\color{blue}} @@ -10368,7 +10590,12 @@ zum Beispiel \autoref{sec:mindmap}. \endgroup \end{verbatim} -\subsection{Kompatibilität mit anderen Paketen} +\clearpage +\etocdepthtag.toc {etocandworld} + +\part{\etoc und die Außenwelt} + +\section{Kompatibilität mit anderen Paketen} \label{etocaftertochook} % JFBU modifiziert Januar 23, 2015 @@ -10486,11 +10713,11 @@ Die {\color{niceone}|tableof|}-Befehle \csa{tableof}, global) nach den Standards der Dokumentklasse setzen, gehorchend den \etoc-Tiefenauszeichnungen, wie erklärt in der |tableof|-Dokumentation, sie setzen keinen TOC-Titel. Sie sollten -\emph{nicht} verwendet werden im Fall, wenn |tableof| vorher +\emph{nicht} verwendet werden im Fall, wenn \csa{etocglobaldefs} vorher ausgegeben wurde; es sei denn, ihr Skopus wurde da beendet oder \csb{etoclocaldefs} hat seine Einflussnahme abgebrochen. -\subsection{\TeX -nische Sachen} +\section{\TeX -nische Sachen} Die \csa{etocname}, \csa{etocnumber}, \csa{etocpage} Befehle sind gegen vorzeitige Expansion geschützt. Sie enthalten geeignete |hyperref|-Links, wenn @@ -10507,7 +10734,7 @@ Befehle wie \csb{etocsetstyle}, \csb{etocsetlevel}, \csb{etocsettocstyle}, \csb{etocmulticolstyle}, \csb{etocruledstyle}, \csb{etocframedstyle} folgen Gruppierungen von \LaTeX. Alle TOCs werden in Gruppierungen gesetzt. -\subsection{Fehler und Katastrophen} +\section{Fehler und Katastrophen} Nach der Verwendung von \csa{etocsetstyle}für eine Ebene nehmen die restlichen, nicht angepassten Ebenen die Standardstile von \etoc (diejenigen, die aktiviert @@ -10610,7 +10837,33 @@ Paketversion ist \texttt{\etocDEpkgversion} von \texttt{\etocDEpkgdate}. \begin{multicols}{2} \begin{jfverbatim} -v1.08d [2015/04/09]^ +v1.08e [2015/04/17]^ + + The command \etocchecksemptiness tells etoc to not print, from + that point on, the headings of the local tables of contents if + they have empty contents. This is mainly for class authors who + might want to have their \section or \chapter automatically do + a \localtableofcontents. Could prove also useful for batch + conversions of documents. Thanks to Paul Gaborit who asked for + such a feature. + + The command \etocnotocifnotoc extends this behaviour to global + TOCs: indeed why should documents with no sectioning units take + this as an excuse not to use package etoc ? + + The command \etocifwasempty{yes}{no} can be used for + suitable extra action. + + A \tableofcontents\ref{foo} now expects foo to be a label to a + _local_ TOC. The use with foo a label to a _global_ TOC is not + supported anymore as it had no utility and made the code more + complex. + + The syntax \localtableofcontents\ref{foo} is now accepted as a + synonym to the earlier syntax \tableofcontents\ref{foo}. + + +~v1.08d [2015/04/09]^ Translation into German of the additions made to the documentation for the 1.08x series of releases. @@ -10899,7 +11152,7 @@ v1.08d [2015/04/09]^ This documentation has been compiled without inclusion of the source code. To produce the English documentation with source code included:\endgraf \ \ \ \ run etex on etoc.dtx or etoc.ins to produce etoc.tex,\endgraf - \ \ \ \ then four times latex on etoc.tex, then dvipdfmx on etoc.dvi.\endgraf + \ \ \ \ then thrice latex on etoc.tex, then dvipdfmx on etoc.dvi.\endgraf \medskip To produce the German documentation with source code included, run etex on etoc.dtx or etoc.ins to produce etoc-DE.tex, then edit etoc-DE.tex @@ -11034,6 +11287,11 @@ v1.08d [2015/04/09]^ \newif\ifEtoc@stoptoc \newif\ifEtoc@notactive \newif\ifEtoc@mustclosegroup +\newif\ifEtoc@emptytoc % 1.08e +\newif\ifEtoc@checksemptiness % 1.08e. Default is 'no checks'. +\newcommand*\etocchecksemptiness {\Etoc@checksemptinesstrue } +\newif\ifEtoc@notocifnotoc % 1.08e +\newcommand*\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } \def\etoc@{\etoc@} % \end{macrocode} % |1.07g| uses a second counter; this could be avoided, but ok, let's not be @@ -11059,7 +11317,7 @@ v1.08d [2015/04/09]^ \chardef\Etoc@@four@@ 4 \chardef\Etoc@@five@@ 5 \chardef\Etoc@@six@@ 6 -\let\Etoc@localtop\Etoc@@minustwo@@ +%%\let\Etoc@localtop\Etoc@@minustwo@@ % 1.08e does it at each local TOC. \def\Etoc@@minustwo@{minustwo} \def\Etoc@@minusone@{minusone} \def\Etoc@@zero@ {zero} @@ -11730,19 +11988,25 @@ v1.08d [2015/04/09]^ % conditionals back in 2011/2012 when I started LaTeX programming, and the % code was a remnant of extra cautious attitude. Also, now % \csa{etoc@@startlocaltoc} is expandable if it does nothing. +% +% |2015/04/16|: |1.08e| removes a \csa{ifEtoc@notactive} test as |\ifnum| can +% be positive only once anyhow; although the \csa{ifEtoc@notactive} boolean +% could be faster than an |\ifnum|, it adds to it as long as the local toc id +% is not yet found. +% +% I replace (|1.08e|) the |\Etoc@global|'s for |\Etoc@localtop| by |\global|'s. % \begin{macrocode} \def\etoc@@startlocaltoc#1#2{% \ifEtoc@localtoc - \ifEtoc@notactive \ifnum #1=#2\relax - \ifEtoc@jj \Etoc@global\let\Etoc@localtop\Etoc@@minusone@@ \fi - \ifEtoc@j \Etoc@global\let\Etoc@localtop\Etoc@@zero@@ \fi - \ifEtoc@ \Etoc@global\let\Etoc@localtop\Etoc@@one@@ \fi - \ifEtoc@i \Etoc@global\let\Etoc@localtop\Etoc@@two@@ \fi - \ifEtoc@ii \Etoc@global\let\Etoc@localtop\Etoc@@three@@ \fi - \ifEtoc@iii \Etoc@global\let\Etoc@localtop\Etoc@@four@@ \fi - \ifEtoc@iv \Etoc@global\let\Etoc@localtop\Etoc@@five@@ \fi - \ifEtoc@v \Etoc@global\let\Etoc@localtop\Etoc@@six@@ \fi + \ifEtoc@jj \global\let\Etoc@localtop\Etoc@@minusone@@ \fi + \ifEtoc@j \global\let\Etoc@localtop\Etoc@@zero@@ \fi + \ifEtoc@ \global\let\Etoc@localtop\Etoc@@one@@ \fi + \ifEtoc@i \global\let\Etoc@localtop\Etoc@@two@@ \fi + \ifEtoc@ii \global\let\Etoc@localtop\Etoc@@three@@ \fi + \ifEtoc@iii \global\let\Etoc@localtop\Etoc@@four@@ \fi + \ifEtoc@iv \global\let\Etoc@localtop\Etoc@@five@@ \fi + \ifEtoc@v \global\let\Etoc@localtop\Etoc@@six@@ \fi \global\Etoc@notactivefalse \global\Etoc@vfalse \global\Etoc@ivfalse @@ -11753,42 +12017,163 @@ v1.08d [2015/04/09]^ \global\Etoc@jfalse \global\Etoc@jjfalse \fi - \fi \fi } \let\etoc@startlocaltoc\@gobble % \end{macrocode} +% |2015/03/16|: |1.08e| tests if a local table of contents turns out empty. The +% \csa{Etoc@localtop} here does not have the same meaning as when set-up by +% the regular \csa{etoc@@startlocaltoc}. It is off by 1 (in general). +% +% After some hesitation I opted for making and obeying the test always (*) for +% local tables of contents, and do it also for global tables of contents but +% for the latter the user must issue \csa{etocnotocifnotoc} for the emptiness +% test to be obeyed. The emptiness tests are to be trusted only when the +% compilations have stabilized. +% +% (*) finally the user must issue \csa{etocchecksemptiness} once. +% +% |\Etoc@tocid| is the number of the toc (possibly gotten via a |\ref| +% following a \csa{tableofcontents}), or it is |\z@| if the emptiness test is +% from a global toc. Until the compilations stabilize, some local TOCs can get +% printed at wrong locations naturally and emptiness tests can not be trusted +% either. Releases earlier than |1.08e| authorized +% \csa{tableofcontents}|\ref{foo}| with |foo| the label of a \emph{global} +% toc. But as it was impossible (without much complications) to discriminate, +% until auxiliary files have stabilized, between a |\ref| to a local toc whose +% id is not yet in the |.toc| file and a |\ref| to a global toc whose id will +% in the end definitely not be in the |.toc| file, I decided that this silly +% possibility should not be supported anymore. This allowed to remove a few +% tokens from \csa{Etoc@tableofcontents} as well. And it also allowed +% improvements to \csa{Etoc@localtableofcontents}. +% \begin{macrocode} +\def\Etoc@setemptytocbool {% + \global\Etoc@stoptocfalse + \global\Etoc@emptytoctrue + \global\let\Etoc@level\Etoc@minf + \begingroup + \def\etoc@startlocaltoc##1{% + \ifnum##1=\Etoc@tocid\relax + \global\let\Etoc@localtop\Etoc@level + \global\Etoc@notactivefalse + \fi }% + \let\contentsline\Etoc@testingcontentsline + \Etoc@storetocdepth + \the\Etoc@toctoks + \Etoc@resettocdepth + \endgroup +} +\DeclareRobustCommand*\etocifwasempty + {\ifEtoc@emptytoc\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi } +\expandafter +\let\expandafter\etocxifwasempty\csname etocifwasempty \endcsname +\def\Etoc@testingcontentsline #1{% + \ifEtoc@stoptoc + \else + \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@ + \else + \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname + \ifEtoc@notactive + \else + \ifnum\Etoc@level>\c@tocdepth + \else + \global\Etoc@stoptoctrue + \ifnum\Etoc@level>\Etoc@localtop\global\Etoc@emptytocfalse\fi + \fi\fi + \fi\fi + \Etoc@gobblesixorfive\relax\relax\relax +} +% \end{macrocode} % |1.07g| suppresses the printing of |--unknown etoc ref: run latex again--| as -% sometimes one uses |\localtableofcontents| to prepare something else, and one +% 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 |\etocaftertochook| to help with -% |\invisiblelocaltableofcontents| (and then I did |\etocsetnexttocdepth|). -% |1.07h| makes the hook used by |\etocsetnexttocdepth| private. +% 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. % % |2014/03/14|: |1.08b| suppresses a space token from an unprotected end of -% line at the end after the replacement text of |\etoc@startlocaltoc| (bug +% line at the end after the replacement text of \csa{etoc@startlocaltoc} (bug % dating back to |1.03 2012/11/23|). I didn't see it due to the originally % badly formatted source of |\Etoc@next|. +% +% |2015/03/16|: |1.08e| lets \csa{localtableofcontents} do a first scan of the +% |.toc| file (as stored in |\Etoc@toctoks|) to determine if the table of +% contents will in fact end up empty. In that case, nothing is typeset. The +% command \csa{etocaftertochook} is still executed though. Other ways were +% envisioned (like delimited macros) to determine this potential emptiness, but +% in the end I opted for execution of the |.toc| file with suitable definitions +% for \csa{contentsline} and \csa{etoc@startlocaltoc}. Notice though that if +% emptiness would result from empty line styles, this can not be detected. +% Emptiness means ``no executed \csa{contentsline}''. +% +% For this detection of emptiness, assignments (here and in +% \csa{Etoc@testingcontentsline}) are made globally, I think this is the best +% (just in case some portions of the |.toc| file turn out to be inside some +% groups --- perhaps for some silly color assignments, etc... --- whose +% boundaries do not necessarily respect unit levels). +% +% The flag |\Etoc@tocwithid| discriminates between a \localtoc and a +% \toc|\ref{foo}|; the latter could so far possibly refer to a local or also to +% a global table of contents but release |1.08e| has deprecated the latter use +% as it complicated the code, for something truly silly. Thus |\ref{foo}| must +% be have the |foo| be the label of a local TOC now. +% +% In the case of a |\ref|ed-to toc whose label was just added hence is not yet +% in the |.aux| file, |\Etoc@tocid| is |0|. \etoc used to issue a warning to +% run latex again and did no printing at all. Release |1.08e| in such cases +% prints the heading (this may gain one compilation step). Emptiness test is +% not executed as it would necessarily turn out positive and can not be +% trusted anyhow. The TOC is declared non empty, which it probably is... +% +% Emptiness detection for local tables of contents (either from a +% \csa{localtableofcontents} or from a \csa{tableofcontents}|\ref{localtoc}|) +% can be trusted only when the |.toc| file has stabilized.The emptiness status +% of a local TOC whose Id is not yet in the |.toc| is by necessity undecided +% yet (and not to be trusted really as the numbering may have changed; only +% when compilation runs settle is the emptiness status to be trusted). The +% code declares the TOC non empty, as it will be in 95\% of use cases. +% +% Dropping support for \toc|\ref{globaltoc}| means here that when a TOC id is +% not found in the |.toc| file we can assume it definitely has to be a local +% TOC needing more compilations. The emptiness status is undecided, the code +% declares the TOC non empty. % \begin{macrocode} \def\Etoc@localtableofcontents#1{% - \edef\Etoc@tmp{#1}% - \ifnum\Etoc@tmp<\@ne - \PackageWarning{etoc}% - {Unknown toc id: run LaTeX to get references right}% - \let\Etoc@next\@gobble - \else - \let\Etoc@next\@firstofone + \edef\Etoc@tocid{#1}% + \global\Etoc@emptytocfalse + \ifnum\Etoc@tocid<\@ne + \PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% + % versions < 1.08e did not do any printing, 1.08e prints the toc heading. + \global\Etoc@notactivetrue + \global\Etoc@stoptoctrue % do only heading + \Etoc@localtoctrue % needed for stoptoc obedience + \Etoc@tableofcontents + \expandafter\Etoc@gobbletoetoc@ % skip all the rest \fi - \Etoc@next - {% 1.08b removes a space token from unprotected line ending - \edef\etoc@startlocaltoc##1{\noexpand\etoc@@startlocaltoc{##1}{#1}}% + \global\Etoc@notactivetrue + \ifEtoc@checksemptiness \Etoc@setemptytocbool \fi + \ifEtoc@emptytoc + \ifEtoc@notactive + \PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% + % emptiness undecided. Declare it non empty. + \global\Etoc@emptytocfalse + \global\Etoc@stoptoctrue % do only heading + \Etoc@localtoctrue + \Etoc@tableofcontents + \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ + \else + %% \PackageWarning{etoc}{This toc is apparently empty}% + \fi + \else \Etoc@localtoctrue - \let\Etoc@localtop\Etoc@@minustwo@@ \global\Etoc@stoptocfalse \global\Etoc@notactivetrue + \global\let\Etoc@localtop\Etoc@@minustwo@@ + \edef\etoc@startlocaltoc##1{\noexpand\etoc@@startlocaltoc{##1}{\Etoc@tocid}}% \Etoc@tableofcontents - }% + \fi + \@gobble\etoc@ \endgroup\ifEtoc@mustclosegroup\endgroup\fi \Etoc@aftertochook % 1.07h \etocaftertochook % 1.07g @@ -11808,33 +12193,52 @@ v1.08d [2015/04/09]^ \def\Etoc@label#1{\label{#1}\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \@firstofone{\def\Etoc@again} {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} % \end{macrocode} -% Why |\global| for |\Etoc@notactivefalse|? and not for -% |\Etoc@localtocfalse|. Must think about this, a pity I did not -% document it when I was young and intelligent ... +% |1.08e| adds test for emptiness. And uses another coding style for +% conditional branching. Easier to read. Not tested for efficiency. +% +% Also, |\ref{foo}| expects |foo| to be a label to a \emph{local} TOC. Earlier +% versions accepted a reference to a global TOC, I have removed the support +% from \csa{Etoc@tableofcontents}. +% +% The syntax \csa{localtableofcontents}|\ref{foo}| is now accepted. % \begin{macrocode} +\def\Etoc@dothis #1#2\etoc@ {\fi #1} \def\Etoc@t@bleofcontents{% - \ifx\Etoc@nexttoken\label - \def\Etoc@next{\expandafter\Etoc@label\@gobble}% - \else - \ifx\Etoc@nexttoken\@sptoken - \let\Etoc@next\Etoc@again - \else - \ifEtoc@tocwithid - \def\Etoc@next{\Etoc@localtableofcontents{\c@etoc@tocid}}% - \else + \ifx\Etoc@nexttoken\label + \Etoc@dothis{\expandafter\Etoc@label\@gobble}% + \fi + \ifx\Etoc@nexttoken\@sptoken + \Etoc@dothis{\Etoc@again}% + \fi \ifx\Etoc@nexttoken\ref - \def\Etoc@next{\expandafter\Etoc@ref\@gobble}% + \Etoc@dothis{\Etoc@tocwithidfalse\expandafter\Etoc@ref\@gobble}% + \fi + \ifEtoc@tocwithid + \Etoc@dothis{\Etoc@localtableofcontents{\c@etoc@tocid}}% + \fi + \global\Etoc@notactivefalse + \global\Etoc@emptytocfalse + \ifEtoc@checksemptiness + \let\Etoc@tocid\z@ + \global\let\Etoc@localtop\Etoc@minf + \Etoc@setemptytocbool + \fi + \ifEtoc@emptytoc + \ifEtoc@notocifnotoc\else + \Etoc@localtocfalse + \global\Etoc@stoptocfalse + \Etoc@tableofcontents + \fi \else - \def\Etoc@next{\Etoc@localtocfalse - \global\Etoc@notactivefalse - \Etoc@tableofcontents - \endgroup - \ifEtoc@mustclosegroup\endgroup\fi - \Etoc@aftertochook % 1.07h - \etocaftertochook % 1.07g - }% + \Etoc@localtocfalse + \global\Etoc@stoptocfalse + \Etoc@tableofcontents \fi - \fi\fi\fi\Etoc@next} + \endgroup\ifEtoc@mustclosegroup\endgroup\fi + \Etoc@aftertochook % 1.07h + \etocaftertochook % 1.07g + \@gobble\etoc@ + } % \end{macrocode} % |1.07g| for consistency Etoc@ prefix added. % @@ -11864,7 +12268,6 @@ v1.08d [2015/04/09]^ \let\etocaftercontentshook \@empty \def\etoctableofcontents{% \Etoc@openouttoc - \Etoc@par \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents % \end{macrocode} % No need for the |tableof| extra group level, even it is better to get rid of @@ -11882,7 +12285,6 @@ v1.08d [2015/04/09]^ \let\tableofcontents\etoctableofcontents \newcommand*\localtableofcontents{% \Etoc@openouttoc - \Etoc@par \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents \let\tof@begingroup\@empty \let\tof@endgroup \@empty @@ -11906,6 +12308,17 @@ v1.08d [2015/04/09]^ % for safety to move the things for the second invocation of % |\Etoc@toctoc| after the |\fi\fi\fi|. I could define an |\afterfififi| % macro, but it should be ok as it is done here. +% +% Let's note for the record that |1.08e| moved the |\Etoc@par| to +% \csa{Etoc@tableofcontents}. This was needed for the implementation of the +% emptiness test. It might change some things as the \csa{refstepcounter} is +% now done before the (possible) |\par|. These must be fringe cases though. +% Most sane people will have left an empty line above their +% \csa{tableofcontents} anyhow in the source. And inline toc have a no-op +% |\Etoc@par|. +% +% |1.08e| suppresses the possibility to do a \csa{tableofcontents}|\ref{foo}| +% with |foo| the label of a global TOC. Just do \csa{tableofcontents}. % \begin{macrocode} \long\def\Etoc@gobbletoetoc@ #1\etoc@ {} \newcommand\etocsettocstyle[2]{% @@ -11915,6 +12328,7 @@ v1.08d [2015/04/09]^ \else\expandafter \Etoc@gobbletoetoc@ % skip all \fi + \Etoc@par % moved here 1.08e for matters of emptiness test \etocbeforetitlehook % 1.07m \Etoc@storetocdepth % 1.07g \let\Etoc@savedcontentsline\contentsline % moved up here 1.08 @@ -11931,15 +12345,6 @@ v1.08d [2015/04/09]^ \ifEtoc@parskip\parskip\z@skip\fi %1.07d \Etoc@aftertitlehook \Etoc@toctoc - \ifEtoc@tocwithid\else - \ifEtoc@localtoc - \ifEtoc@notactive - \Etoc@localtocfalse - \global\Etoc@notactivefalse - \Etoc@toctoc - \fi - \fi - \fi \etocaftercontentshook #2\@nobreakfalse % 1.07d: \@nobreakfalse moved here \Etoc@resettocdepth % 1.07g. moved here from before #2 by 1.08 @@ -12745,7 +13150,7 @@ v1.08d [2015/04/09]^ {Unknown sectioning unit #1, \protect\etocsetnextocdepth\space ignored}} {\edef\Etoc@aftertochook {\global\c@tocdepth\the\c@tocdepth\space \let\noexpand\Etoc@aftertochook\noexpand\@empty }% - \global\c@tocdepth\csname Etoc@#1@@\endcsname}% + \global\c@tocdepth\csname Etoc@#1@@\endcsname}% }% % \end{macrocode} % |1.07h|. In order for the |.toc| file to be usable without error even @@ -12787,7 +13192,7 @@ v1.08d [2015/04/09]^ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{3025} +\CheckSum{3160} \csname check@checksum\endcsname \Finale diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins index 608df4c5f68..fd0b1a0bf84 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.ins +++ b/Master/texmf-dist/source/latex/etoc/etoc.ins @@ -1,6 +1,6 @@ %% %% Package: etoc -%% Version: 1.08d (2015/04/09) +%% Version: 1.08e (2015/04/17) %% License: LPPL 1.3c or later (see etoc.dtx) %% Copyright (C) 2012-2015 Jean-Francois Burnol %% <jfbu at free dot fr> @@ -8,17 +8,17 @@ %% <Christine_Roemer at t-online dot de> %% and collaborators for the translation into German of the documentation %% -\def\etocpkgdate {2015/04/09} -\def\etocdocdate {2015/04/09} -\def\etocpkgversion {v1.08d} +\def\etocpkgdate {2015/04/17} +\def\etocdocdate {2015/04/17} +\def\etocpkgversion {v1.08e} \def\etocpkgdescription {Completely customisable TOCs (jfB)} %% Run etex on this file to extract from etoc.dtx: %% etoc.sty, etoc.tex, etoc-DE.tex and README.md %% %% At least three ways to produce etoc.pdf (method (3) is preferred): -%% (1) latex etoc.dtx (four times), then dvips, then ps2pdf -%% (2) pdflatex etoc.dtx (four times) -%% (3) latex etoc.tex (four times), then dvipdfmx +%% (1) latex etoc.dtx (thrice), then dvips, then ps2pdf +%% (2) pdflatex etoc.dtx (thrice) +%% (3) latex etoc.tex (thrice), then dvipdfmx %% %% Method (3) produces the smallest pdf files. %% Options can be set in etoc.tex (and etoc-DE.tex): |