summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/etoc/etoc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/etoc/etoc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/etoc/etoc.dtx4992
1 files changed, 2034 insertions, 2958 deletions
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx
index a7ebf849b55..38d77969347 100644
--- a/Master/texmf-dist/source/latex/etoc/etoc.dtx
+++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx
@@ -1,33 +1,32 @@
% -*- coding: utf-8; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
% N.B.: this dtx file is NOT for use with \DocInput. The latex source of the
-% user manual isn't prefixed with percent signs.
+% user manual is not prefixed with percent signs.
%<*none>
-\def\etocdtxtimestamp {Time-stamp: <09-09-2016 at 21:49:18 CEST>}%
+\def\etocdtxtimestamp {Time-stamp: <25-09-2016 at 19:33:27 CEST>}%
%</none>
%<*!readme>
%%
%% Package: etoc
-%% Version: 1.08g (2015/08/29 -- doc 2016/09/09)
-%% License: LPPL 1.3c or later (see etoc.dtx)
-%% Copyright (C) 2012-2015 Jean-Francois Burnol
+%% Version: 1.08h-2016/09/25
+%% License: LPPL 1.3c
+%% Copyright (C) 2012-2016 Jean-Francois Burnol
%% <jfbu at free dot fr>
-%% Copyright (C) 2014-2015 Christine Roemer
+%% Copyright (C) 2014-2016 Christine Roemer
%% <Christine_Roemer at t-online dot de>
%% and collaborators for the translation into German of the documentation
%%
%</!readme>
%<*insfile>
-\def\etocpkgdate {2015/08/29}
-\def\etocdocdate {2016/09/09}
-\def\etocpkgversion {v1.08g}
+\def\etocpkgdate {2016/09/25}
+\def\etocdocdate {2016/09/25}
+\def\etocpkgversion {v1.08h}
\def\etocpkgdescription {Completely customisable TOCs (JFB)}
%</insfile>
%<*none>
-% Now the date and version which are specific to the German translation.
-% Replace \let by suitable \def's in case this lags behing English version.
-\let\etocDEpkgdate \etocpkgdate
-\def\etocDEdocdate {2015/08/29}
-\let\etocDEpkgversion\etocpkgversion
+\def\etocDEpkgdate {25.09.2016}
+\def\etocDEdocdate {25.09.2016}
+\def\etocDEDEdocdate {09.04.2015}%
+\def\etocDEDEpkgversion {v1.08d}%
% Definition of \etocLicense
% --------------------------
\begingroup
@@ -36,30 +35,29 @@
\catcode32=13\catcode`\\=12^^Brelax^^A
^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
{% Package: etoc
-% Version: 1.08g (2015/08/29 -- doc 2016/09/09)
-% 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>
+% Version: 1.08h-2016/09/25
+% License: LPPL 1.3c
+% Copyright (C) 2012-2016 Jean-Francois Burnol <jfbu at free dot fr>
+% Copyright (C) 2014-2016 Christine Roemer <Christine_Roemer at t-online dot de>
% and collaborators for the translation into German of the documentation
%
% This Work may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either
-% version 1.3c of this license or (at your option) any later
-% version. This version of this license is in
+% conditions of the LaTeX Project Public License, in its
+% version 1.3c. This version of this license is in
% http://www.latex-project.org/lppl/lppl-1-3c.txt
% and the latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
-% LaTeX version 2005/12/01 or later.
+% LaTeX version 2005/12/01 or later.
%
% The Authors of this Work are:
-% Jean-Francois Burnol <jfbu at free dot fr>
+% Jean-Francois Burnol <jfbu at free dot fr>
% for the source code and English documentation, and
% Christine Roemer <Christine_Roemer at t-online dot de> and collaborators
% for the translation into German of the documentation.
-%
+%
% This Work consists of the main source file etoc.dtx and the derived
-% files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf,
+% files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf,
% etoc.dvi, etoc-DE.dvi, README.md.
%
% Running etex (or latex or pdflatex) on etoc.dtx extracts etoc.sty,
@@ -71,11 +69,11 @@
%<*readme>
<!-- -->
- Source: etoc.dtx (v1.08g 2015/08/29 -- doc 2016/09/09)
+ Source: etoc.dtx (v1.08h-2016/09/25)
Author: Jean-Francois Burnol
Author: Christine Roemer et al. (German tranlation)
Info: Completely customisable TOCs
- License: LPPL 1.3c or later
+ License: LPPL 1.3c
Copyright (C) 2012-2016 Jean-Francois Burnol.
Copyright (C) 2014-2016 Christine Roemer and collaborators for
the translation into German of the documentation.
@@ -133,28 +131,19 @@ Else, to extract the package (.sty) and driver (.tex) files from etoc.dtx:
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):
+To produce etoc.pdf one can run pdflatex (thrice) directly on etoc.dtx or on
+the file etoc.tex which was extracted from previous step.
-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:
- scrdoc class options (paper size, font size, ...)
- with or without source code,
- with dvipdfmx or with latex+dvips or pdflatex.
-To produce etoc-DE.pdf (German documentation) run etex on etoc.ins
-or etoc.dtx to produce etoc-DE.tex, then compile etoc-DE.tex with
-latex (thrice) then dvipdmx, or set first to 0 `\Withdvipdfmx` in
-etoc-DE.tex to allow compilation with pdflatex.
-
-Um etoc-DE.pdf zu erzeugen ist latex dreimal mit etoc-DE.tex laufen
-zu lassen, dann dvipdfmx mit etoc-DE.dvi. Im Falle von Problemen
-mit dvipdfmx ist `\Withdvidpdfmx` auf 0 in etoc-DE.tex zu setzen,
-dann ist pdflatex dreimal mit etoc-DE.tex laufen zu lassen.
+Release 1.08h sets pdflatex as default in etoc.tex (prior it was
+latex+dvipdfmx as it produces smaller PDFs) in order to allow
+inclusion via the use of package `attachfile` of about 25 code
+samples as file attachment annotations.
Installation:
@@ -170,9 +159,8 @@ LICENSE
=======
This Work may be distributed and/or modified under the
-conditions of the LaTeX Project Public License, either
-version 1.3c of this license or (at your option) any later
-version. This version of this license is in
+conditions of the LaTeX Project Public License, in its
+version 1.3c. This version of this license is in
> <http://www.latex-project.org/lppl/lppl-1-3c.txt>
@@ -197,6 +185,24 @@ etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi.
RECENT CHANGES
==============
+v1.08h \[2016/09/25\]
+---------------------
+
+New functioning of `\etocsetnexttocdepth`: the tocdepth counter is
+modified only at the time of the table of contents, not before.
+This fixes an issue which arose when `\etocsetnexttocdepth` was used
+multiple times with no intervening table of contents.
+
+The PDF documentation includes about 25 LaTeX code snippets also
+as file attachment annotations, additionally to their verbatim
+typesetting. The ordering of the documentation contents has been
+slightly re-organized.
+
+A previous documentation-only update on 2016/09/09 added a new
+section with the (approximate) translation into etoc lingua of the
+book class toc style, for easy customizability.
+
+
v1.08g \[2015/08/29\]
---------------------
@@ -243,111 +249,18 @@ for the 1.08x series of releases.
Thanks to Christine Römer!
-v1.08c \[2015/03/30\]
----------------------
-
-- removed a few unneeded `\long` from the code.
-- removed use of `\arabic` at one location of the code, as it may get
- redefined by some language modules for `babel` or `polyglossia`.
-
-v1.08b \[2015/03/18\]
----------------------
-
-Bug fixes:
-
-- extra space token removed from `\localtableofcontents` (showed
- only for inline TOCs.)
-- `\etocpartname` (a macro used by the package own default line
- styles) was defined to be `\partname`, but this is not compatible
- at least with `babel+french` context. Now simply expands to Part.
-- some problems fixed in the German documentation.
-- \[2015/03/28\] some more problems fixed in the documentation. Added
- mention of `\etocarticlestyle` and `\etocbookstyle`.
-
-v1.08a \[2015/03/13\]
----------------------
-
-`\etocname`, `\etocnumber` and `\etocpage` are now the robust
-variants of `\etocthelinkedname`, `\etocthelinkednumber` and
-`\etocthelinkedpage`. This should arguably have been done since
-the addition of the latter to etoc with v1.07f \[2013/03/07\].
-The earlier robust commands `\etocname` etc... contained the
-hyperlink destination only in an unexpanded form.
-
-The documentation has a brand new title page and a new section
-*The TOC as a TikZ mind map* both illustrating further uses of
-etoc to display tables of contents as trees in an automatic
-manner.
-
-v1.08 \[2015/03/10\]
---------------------
-
-`\etocskipfirstprefix` may now appear anywhere in the `<start>`
-part of a level style.
-
-New commands `\etociffirst`, `\etocxiffirst`, `\etocxifnumbered`,
-`\etocglobaldefs` and `\etoclocaldefs`.
-
-It is now possible to issue line style specifications directly
-with `&` and `\\` tokens, in order to typeset a TOC as a tabular
-or longtable with the opening for example in the first argument of
-`\etocsettocstyle` and the closing in its second argument.
-
-It is mandatory for such uses to issue `\etocglobaldefs` which
-tells etoc to proceed globally for certain definitions. This is
-also useful in the context of the inline environments of package
-enumitem.
-
-On this occasion, various old parts of the code have been improved.
-
-v1.07n \[2015/03/05\]
----------------------
-
-No more use of `\toks@` when etoc constructs `\etocthelinkedname`
-etc... Thus `\toks@` can be put in the line styles in order to
-accumulate information. Only useful if it is certain nothing else
-will change `\toks@` either.
-
-In the documentation: list of main commands now in alphabetic order.
-
-v1.07m \[2015/01/23\]
----------------------
-
-Reading of .toc file is delayed to `\begin{document}` to account for
-possible Babel active characters used therein. Thanks to Denis
-Bitouzé who reported a Babel related problem.
-
-Improved global toc display emulation under KOMA-script classes.
-
-New command `\etocbeforetitlehook`. New command `\etocdisplay`.
-
-v1.07l \[doc of 2014/04/29\]
-----------------------------
-
-Added to the documentation an example of use of `\etocthelinkedname`
-together with an enumitem inline itemize\* environment; moved main
-TOC to immediately after the title, and license to the first pages.
-
-Incorporation of the translation into German done on the initiative
-of Christine Römer by Felix Baral-Weber, Jenny Rothkrämer-Vogt,
-Daniel Büttner, Claudia Dahl, Christian Otto and Christine Römer (FSU
-Jena). My grateful thanks to all!
%</readme>
%<*tex>-------------------------------------------------------------------------
-%% 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
-%% old dvipdfmx, it may be preferable to use pdflatex. For this set
-%% \Withdvipdfmx to 0 first here or run directly pdflatex on etoc.dtx.
+%% run pdflatex thrice on this file etoc.tex to produce the documentation
+%% etoc.pdf, with source code included.
%%
-\chardef\Withdvipdfmx 1 % replace 1 by 0 for using latex+dvips or pdflatex
+\chardef\Withdvipdfmx 0 % replace 0 by 1 for using latex+dvipdfmx
\chardef\NoSourceCode 0 % replace 0 by 1 for the doc *without* the source code
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile {etoc.tex}[Driver for etoc documentation]%
\PassOptionsToClass {a4paper,fontsize=11pt,twoside}{scrdoc}
\PassOptionsToPackage {ngerman,english}{babel}
-\chardef\ForEnglish 1 % (ForEnglish and ForDeutsch flags can NOT both be 1 ..)
+\chardef\ForEnglish 1 % (\ForEnglish and \ForDeutsch flags can't be BOTH 1 ...)
\chardef\ForDeutsch 0 %
\input etoc.dtx
%%% Local Variables:
@@ -355,26 +268,20 @@ Jena). My grateful thanks to all!
%%% End:
%</tex>-------------------------------------------------------------------------
%<*DEtex>-----------------------------------------------------------------------
-%% run latex thrice on this file etoc-DE.tex then dvipdfmx on etoc-DE.dvi
-%% to produce the German documentation etoc-DE.pdf (without source code).
+%% run pdflatex thrice on this file etoc-DE.tex to produce the German
+%% documentation etoc-DE.pdf (without source code).
%%
-%% possible dvipdfmx warnings may be ignored, but in case of a too
-%% old dvipdfmx, it may be preferable to use pdflatex. For this set
-%% \Withdvipdfmx to 0 first here.
+%% Um etoc-DE.pdf zu erzeugen ist pdflatex dreimal mit etoc-DE.tex laufen
+%% zu lassen.
%%
-%% Um etoc-DE.pdf zu erzeugen ist latex dreimal mit etoc-DE.tex laufen
-%% zu lassen, dann dvipdfmx mit etoc-DE.dvi. Im Falle von Problemen
-%% mit dvipdfmx ist \Withdvidpdfmx auf 0 zu setzen, dann ist pdflatex
-%% dreimal mit etoc-DE.tex laufen zu lassen.
-%%
-\chardef\Withdvipdfmx 1 % replace 1 by 0 for using latex+dvips or pdflatex
+\chardef\Withdvipdfmx 0 % replace 0 by 1 for using latex+dvipdfmx
\chardef\NoSourceCode 1 % replace 1 by 0 for the doc *with* the source code
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile {etoc-DE.tex}[Driver for etoc German documentation]%
%% or with german rather than ngerman in the two lines below
\PassOptionsToClass {a4paper,fontsize=11pt,twoside,ngerman}{scrdoc}
\PassOptionsToPackage {english,ngerman}{babel}
-\chardef\ForEnglish 0 % (can NOT be both 1..)
+\chardef\ForEnglish 0 % (\ForEnglish and \ForDeutsch flags can't be BOTH 1 ...)
\chardef\ForDeutsch 1 %
\input etoc.dtx
%%% Local Variables:
@@ -385,26 +292,20 @@ Jena). My grateful thanks to all!
%% 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 (thrice), then dvips, then ps2pdf
-%% (2) pdflatex etoc.dtx (thrice)
-%% (3) latex etoc.tex (thrice), then dvipdfmx
+%% To produce etoc.pdf run pdflatex (thrice) on etoc.tex.
%%
-%% Method (3) produces the smallest pdf files.
%% Options can be set in etoc.tex (and etoc-DE.tex):
-%% - scrdoc class options (paper size, font size, ...)
-%% - with or without source code,
-%% - with dvipdfmx or with latex/pdflatex.
+%% - scrdoc class options (paper size, font size, ...)
+%% - with or without source code,
+%% - with dvipdfmx or with latex/pdflatex.
%%
-%% To produce the German documentation etoc-DE.pdf run tex on etoc.ins
-%% or etoc.dtx to produce etoc-DE.tex, then compile etoc-DE.tex with
-%% latex (thrice) then dvipdmx, or edit the suitable toggle in
-%% etoc-DE.tex to allow compilation to proceed with pdflatex.
+%% Release 1.08h sets pdflatex as default in etoc.tex (prior it was
+%% latex+dvipdfmx as it produces smaller PDFs) in order to allow
+%% inclusion via the use of package `attachfile` of about 25 code
+%% samples as file attachment annotations.
%%
-%% Um etoc-DE.pdf zu erzeugen ist latex dreimal mit etoc-DE.tex laufen
-%% zu lassen, dann dvipdfmx mit etoc-DE.dvi. Im Falle von Problemen
-%% mit dvipdfmx ist \Withdvidpdfmx auf 0 in etoc-DE.tex zu setzen,
-%% dann ist pdflatex dreimal mit etoc-DE.tex laufen zu lassen.
+%% Um etoc-DE.pdf zu erzeugen ist pdflatex dreimal mit etoc-DE.tex
+%% laufen zu lassen.
%%
%% Installation:
%%
@@ -486,11 +387,11 @@ Jena). My grateful thanks to all!
\Msg{*^^J}%
\Msg{*\space\space\space\space etoc.sty^^J}%
\Msg{*^^J}%
-\Msg{* To produce the documentation with source code included run latex^^J}%
-\Msg{* thrice on file etoc.tex and then dvipdfmx on etoc.dvi^^J}%
+\Msg{* To produce the documentation with source code included run pdflatex^^J}%
+\Msg{* thrice on file etoc.tex^^J}%
\Msg{*^^J}%
-\Msg{* To produce the German documentation run latex thrice on file^^J}%
-\Msg{* etoc-DE.tex and then dvipdfmx on etoc-DE.dvi^^J}%
+\Msg{* To produce the German documentation run pdflatex thrice on file^^J}%
+\Msg{* etoc-DE.tex^^J}%
\Msg{*^^J}%
\Msg{* Happy TeXing!^^J}%
\Msg{*^^J}%
@@ -1036,7 +937,8 @@ pdfpagemode=UseOutlines}
\pgftransformreset
\ifnum\tikztreelevel=1
% \pgftransformrotate{55+((\pgfkeysvalueof{/tikz/sibling angle})*(\tikznumberofcurrentchild)}%
- \pgftransformrotate{-55+((\pgfkeysvalueof{/tikz/sibling angle})*(\tikznumberofcurrentchild)}%
+% -90 Dimanche 25 septembre 2016 à 17:18:50. Non finalement zero. Non -36
+ \pgftransformrotate{-36+((\pgfkeysvalueof{/tikz/sibling angle})*(\tikznumberofcurrentchild)}%
\pgftransformxshift{\the\tikzleveldistance}%
\fi
\ifnum\tikztreelevel=2
@@ -1251,6 +1153,29 @@ etoc-framed-mp-hook
% for illustration only. Not to be recommended in general.
\setcounter{secnumdepth}{4}
+% Vendredi 16 septembre 2016
+% pour rendre accessibles les exemples
+% Fait package filecontentsdef le Samedi 17.
+\usepackage{filecontentsdef}
+
+%\ifnum\Withdvipdfmx=1
+%% I have an issue that with \thesubsection or \the\value{section} in code
+%% snippet filename, the file is not correctly attached, it appears in the pdf
+%% interface but with a wrong filename and one can not obtain the file from
+%% the pdf (tested on Acrobat Reader 11 Vendredi 16 septembre 2016).
+% \usepackage[dvipdfmx]{attachfile2}
+%\else
+ \usepackage{attachfile}% no op with dvipdfmx
+%\fi
+%
+\def\CEST{+02'00'}\def\CET{+01'00'}
+\def\ExtractDateStamp #1<#2-#3-#4 at #5:#6:#7 #8>%
+ {D:#4#3#2#5#6#7\csname#8\endcsname}
+\edef\DateForSamples {\expandafter\ExtractDateStamp\etocdtxtimestamp}
+\attachfilesetup{icon=Paperclip, mimetype=application/x-tex, appearance=false,
+ author={Jean-François Burnol}, date=\DateForSamples}% print=false ?
+% attention Paperclip pas PaperClip !!
+
\begin{document}%\layout
\rmfamily
\thispagestyle{empty}
@@ -1296,7 +1221,8 @@ etoc-framed-mp-hook
{% define the section node
\edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
\unexpanded\expandafter{\etocthelinkedname}}}}%
- \appendtotok\parttok\childnode }
+ \ifnum\value{partco}<9 % pour 1.08h
+ \appendtotok\parttok\childnode \fi}
{}
\etocsetnexttocdepth{section}
@@ -1336,7 +1262,8 @@ etoc-framed-mp-hook
% calculer
% je passe de 6 à 7cm pour doc du 2015/12/11, mais je dois aussi écarter un
% peu level2
- level 1/.append style={level distance=7cm, sibling angle=360/9},% 9 hard-coded mais je pourrais aussi le calculer
+ level 1/.append style={level distance=7cm, sibling
+ angle=360/10},% passage de 9 à 10 pour 1.08h, je pourrais aussi le calculer
level 1 concept/.append style={font=\Large, text width =
3cm},
% ancienne version circulaire
@@ -1345,7 +1272,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.25cm},% was 2.57cm
+ distance=2.37cm},% was 2.57cm
]
\the\treetok
\end{tikzpicture}}\endgroup }
@@ -1367,8 +1294,7 @@ etoc-framed-mp-hook
\etoctoclines
\etocmarkboth\contentsname
\etocmulticolstyle[1]
- {\pdfbookmark[1]{Table of contents}{MAINTOC}%
- \noindent
+ {\noindent
\bfseries\Large
\leaders\hrule height1pt\hfill
\MakeUppercase{Table of Contents}\let\thefootnote\empty
@@ -1376,6 +1302,25 @@ etoc-framed-mp-hook
with timestamp ``\etocdtxtimestamp''.}\setcounter{footnote}{0}%
}
+\pdfbookmark[1]{Table of contents}{MAINTOC}%
+
+\begin{framed}
+ Starting with |1.08h|, about 25 code samples (especially the longer
+ ones) are incorporated into the PDF file (thanks to \textsc{Scott
+ Pakin}'s \href{http://www.ctan.org/pkg/attachfile}{attachfile}
+ package) as \emph{file attachement annotations}. Each file is represented
+ by an icon after the verbatim rendering of the corresponding code.
+ Clicking suitably on the icon will open a dialog to open or save the
+ file contents. This is much better than copy-paste which loses
+ indentation. There is also in some viewer a \emph{Comment pane} which can
+ be opened on the right side of the main window and which provides a
+ convenient clickable list of all these \emph{attachments annotations}.
+
+ PDF viewers unable to make these attachments accessible to the
+ user may replace the clickable icons by some blank space.
+\end{framed}
+% https://helpx.adobe.com/acrobat/using/comments.html
+
\begingroup
\etocsetlevel{subsection}{3}
\etocsetlevel{subsubsection}{6}
@@ -1386,6 +1331,7 @@ etoc-framed-mp-hook
\clearpage
\phantomsection\addcontentsline{toc}{section}{\abstractname}
+
\begin{abstract}
The \etoc package gives to the user complete control on how
the entries of the table of contents should be constituted
@@ -1455,8 +1401,8 @@ manner: they are made available via the \csb{etocname},
|article|, |book|, |report|, |scrartcl|, |scrbook|, |scrreprt| and
|memoir| classes.
-Starting with release |1.07k| it is possible to
-use \etoc concurrently with package |tocloft|.
+% Starting with release |1.07k| it is possible to
+% use \etoc concurrently with package |tocloft|.
\section{License}
@@ -1510,11 +1456,13 @@ an economy of use of the poor brain.
% happily use directly a |\list| command;
Next in ease of use, perhaps, is the method explained
-\hyperref[sec:firstexample]{later in this part} (\autoref{sec:firstexample}).
-For this some knowledge of |\leftskip|, |\rightskip|, etc... is necessary. And a
-slight elaboration of this method, whose code is to be found in
-\autoref{ssec:tocwithdepthtags}, allows to mimick very well, if so desired, the
-standard looks.
+\hyperref[sec:firstexample]{later in this part}
+(\autoref{sec:firstexample}). For this some knowledge of |\leftskip|,
+|\rightskip|, etc... is necessary. And a slight elaboration of this
+method, whose code is to be found in \autoref{ssec:tocwithdepthtags},
+allows to mimick very well, if so desired, the standard looks. An even
+closer emulation of the |book| class design is now included in this
+documentation as \autoref{sec:thirdexample}.
As will be amply illustrated in this manual, \etoc is quite
versatile (especially as it allows to re-define at any point in
@@ -1564,13 +1512,15 @@ TOCs, some other commands, such as language changing
commands, which do not expect to see their scope limited in
this way inside a group (\LaTeX's environments create groups).
-Therefore the built-in ``line styles'' proposed by \etoc as an example (and
-which are illustrated\footnote{with a twist, subsections having been downgraded
- to the subsubsection style\dots} by the \hyperref[toc:main]{main table of
- contents} in this document) do not make use of environments. Actually, in this
-user manual, only the \hyperref[toc:a]{table of contents} at the start of
-\autoref{part:linestyles} and the \autoref{toc:allsubsections} (which is a TOC!)
-have their line styles expressed in terms of enumerate environments.
+Therefore the built-in ``line styles'' proposed by \etoc as an example
+(and which are illustrated\footnote{with a twist, subsections having
+ been downgraded to the subsubsection style\dots} by the
+\hyperref[toc:main]{main table of contents} in this document) do not
+make use of environments. Actually, in this user manual, only the
+\hyperref[toc:a]{table of contents} at the start of
+\autoref{part:linestyles}, the \autoref{toc:allsubsections} (which is a
+TOC!) and examples from \autoref{etocthelink} have their line
+styles expressed in terms of enumerate or itemize environments.
\section{Line styles and toc display style}
@@ -1680,19 +1630,8 @@ document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used
and not even the heading.} the local TOC will exist only through its clones
elsewhere in the document.
-We could use the line styles defined by \etoc, with \csb{etocdefaultlines}, or
-the default document class styles with \csb{etocstandardlines}, but we were a
-bit more ambitious here and wanted to design our own. The technique is a simple
-one: each heading is in its own paragraph, which may extend on multiple lines;
-it is responsible for setting its own |\leftskip|.
-
-
-
-\begingroup
-\parindent 0pt
-\parfillskip 0pt
-\leftskip 0cm
-\rightskip 1cm
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
\etocsetstyle {section}
{}
{\leavevmode\leftskip 0cm\relax}
@@ -1718,7 +1657,16 @@ it is responsible for setting its own |\leftskip|.
\autoref{part:overview} (\nameref{part:overview})}
\tableofcontents \ref {toc:overview}
\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+We could have used the line styles defined by \etoc, with
+\csb{etocdefaultlines}, or the default document class styles with
+\csb{etocstandardlines}, but we were a bit more ambitious here and wanted to
+design our own. The technique is a simple one: each heading is in its own
+paragraph, which may extend on multiple lines; it is responsible for setting
+its own |\leftskip|.
This is a simple design which does not make provisions for page breaks
which should be discouraged in-between a section and a subsection
@@ -1736,36 +1684,11 @@ which provides a TOC with parts and paragraphs. Both allow multi-line
headings and employ a technique for putting page numbers in the right margin
which was inspired from what \LaTeX2e's |\@dottedtocline| macro does.
+Here is how it was produced:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-\begin{verbatim}
-\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
-\etocsetstyle {section}
- {}
- {\leavevmode\leftskip 0cm\relax}
- {\bfseries\normalsize\makebox[.5cm][l]{\etocnumber.}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\mdseries\etocpage}}\par}
- {}
-\etocsetstyle {subsection}
- {}
- {\leavevmode\leftskip .5cm\relax }
- {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\etocpage}}\par}
- {}
-\etocsetstyle {subsubsection}
- {}
- {\leavevmode\leftskip 1.5cm\relax }
- {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\etocpage}}\par}
- {}
-\etocruledstyle[1]{\bfseries \Large My first \etoc: TOC of
- \autoref{part:overview} (\nameref{part:overview})}
-\tableofcontents \ref {toc:overview}
-\endgroup
-\end{verbatim}
\section{A second example}
\label{sec:secondexample}
@@ -1777,6 +1700,7 @@ is done via the technique of \emph{depth tags}, described in
layout is a bit like the one of the \hyperref[toc:main]{main document
TOC}, although the line styles are coded very differently.
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begingroup
\newcommand*{\DotsAndPage}
{\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}%
@@ -1811,282 +1735,75 @@ layout is a bit like the one of the \hyperref[toc:main]{main document
{\par\medskip}
\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {none}
-\etocsettagdepth {arbitrarily}{none}
-\etocsettagdepth {surprising} {none}
+%\etocsettagdepth {overview} {none}% not needed explicitely, keeps value
+%\etocsettagdepth {arbitrarily}{none}
+%\etocsettagdepth {examples} {none}
+%\etocsettagdepth {surprising} {none}
\etocsettagdepth {linestyles} {subsection}
\etocsettagdepth {globalcmds} {subsection}
\etocsettagdepth {custom} {none}
-\etocsettagdepth {tips} {none}
-\etocsettagdepth {etocandworld}{none}
-\etocsettagdepth {code} {none}
+%\etocsettagdepth {tips} {none}
+%\etocsettagdepth {etocandworld}{none}
+%\etocsettagdepth {code} {none}
\etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{}
\etocsetnexttocdepth {subsection}
\tableofcontents
\endgroup
+\end{filecontentsdef}
+\filecontentsexec\foo
The code:
-\begin{verbatim}
-\begingroup
-\newcommand*{\DotsAndPage}
-{\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}%
- \hfill\nobreak
- \makebox[\rightskip][r]{\bfseries\normalsize\etocpage}\par}
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-\etocsetstyle {part}
-{\parindent 0pt
- \nobreak
- \etocskipfirstprefix}
-{\pagebreak[3]\bigskip}
-{\large\rmfamily\bfseries\scshape\centering
- \etocifnumbered{Part \etocnumber{} -- }{}\etocname\par}
-{}
+\section{A Beautiful Thesis example}
-\etocsetstyle {section}
-{\leftskip 0pt \rightskip .75cm \parfillskip-\rightskip
- \nobreak\medskip
- \etocskipfirstprefix}
-{\leftskip 0pt \rightskip .75cm \parfillskip-\rightskip
- \pagebreak[1]\smallskip}
-{\normalsize\rmfamily\bfseries\scshape
- \etocnumber. \etocname\DotsAndPage }
-{\parfillskip 0pt plus 1fil\relax }
-
-\etocsetstyle {subsection}
-{\leftskip1cm\rightskip .75cm \parfillskip 0pt plus 1fil\relax
- \nobreak\smallskip}
-{}
-{\footnotesize\sffamily\mdseries\itshape
- \etocname{} (\etocnumber, p. \etocpage). }
-{\par\medskip}
-
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {none}
-\etocsettagdepth {arbitrarily}{none}
-\etocsettagdepth {surprising} {none}
-\etocsettagdepth {linestyles} {subsection}
-\etocsettagdepth {globalcmds} {subsection}
-\etocsettagdepth {custom} {none}
-\etocsettagdepth {tips} {none}
-\etocsettagdepth {etocandworld}{none}
-\etocsettagdepth {code} {none}
-
-\etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{}
-\etocsetnexttocdepth {subsection}
-\tableofcontents
-\endgroup
-\end{verbatim}
-
-\section{A third example: emulating the book class}\label{sec:thirdexample}
-
-As explained in \autoref{subs:compat}: without explicit use of an
-\csb{etocsetstyle} command the package will leave to the document class the
-hand regarding the ``toc line styles''. It is sometimes asked by users (for
-example those using \etoc for its \csb{localtableofcontents}) how to stay
-close to but not completely identical with the design implemented by the
-standard classes, such as |book|. I can recommend package |tocloft| for this,
-as it is compatible with \etoc (see \autoref{subs:tocloft}) and thus \etoc will
-obey the |tocloft| customizations (as long as no use has been made of
-\csa{etocsetstyle}). It is also possible to modify only the style for, say,
-sections and leave the parts, chapters, subsections as in the document class,
-via the technique from \autoref{sec:anothercompat}.
-
-But for complete control, here is a translation of the |book| class code into
-\etoc lingua. It is then easy to modify the relevant lengths or adjust the
-used fonts. I thank \textsc{Denis Bitouzé} for prompting me to include this in
-the \etoc manual, as it resulted from some conversation we had about this. The
-code is not 100\% faithful to the |book| class, and particularly its rendering
-of (multi-line) non-numbered units differs (... I think, as I copied pasted as
-is the code from where I had stored it and did not do much thinking about it
-again). Some proficiency in low-level \TeX\ and \LaTeX\ macros is needed to
-understand what the code says, but for modifying fonts or some lengths such
-in-depth understanding is not needed.
-
-With some extra code one can \emph{automatically adjust the widths} assigned
-to typesetting sectioning numbers in order to prevent overflows, even with for
-example \MakeUppercase{\romannumeral 38}; but this is a more advanced feature
-which I have moved to \autoref{sec:thirdexampleextra}.
+Here is a relatively simple example of use of the package
+functionalities.
+Let us set up some line styles. We choose a style for sections and
+sub-sections which would be suitable for, respectively, sections and
+sub-sections in an average length memoir. The line style specifications have
+some redundancy for clarity, and do not care about what to do at possible page
+breaks. Also, they do not worry about potential multi-column use.
-First we set up some lengths. I use macro registers, not real \LaTeX\ lengths.
-When using |em|'s however, this means that one must pay attention to when the
-actual dimension assignment is made, as this will then depend upon the current
-font settings. In the code below, at the location where the \csa{TOCnumwidthB}
-and \csa{TOCnumwidthC} will be used, the |1em| from their specification will
-be matched to the normal medium series font, not the bold font; this is
-deliberate so that one can compare more readily with the other dimensions;
-besides, with the \csa{TOCcomputenumwidths} from
-\autoref{sec:thirdexampleextra} these macros will actually hold a dimension
-using |pt| as dimensional unit.
-\begin{verbatim}
-% it will be easy to globally shift the TOC horizontally if needed
-\def\TOCleftmargin {0pt}
-\def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begingroup % we start a group to keep the style changes local
+\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
+\newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm}
-% this is for dotted leaders
-\newbox\TOCleaderbox
-\def\TOCleaderboxwidth {0.7777em}% about like what standard classes do
+\etocsetstyle{section} % will pretend to be a Chapter
+{\addvspace{1ex}\parfillskip0pt
+ \leftskip\tocleftmargin % (already done in title)
+ \rightskip\the\tocrightmargin plus 1fil
+ \parindent0pt\color{cyan}} % (already done)
+{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
+{\llap{Chapter\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
+ \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
+{}
-% vertical spacing
-\def\TOCverysmallvskip {0pt plus .2pt}
-\def\TOCmedvskip {1em plus 1pt}
-\def\TOCbigvskip {2.25em plus 1pt}
+\etocsetstyle{subsection} % will pretend to be a Section
+{}
+{\mdseries\large\addvspace{.5ex}\leavevmode}
+{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
+ \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
+{}
-% the ``numwidths'' for typesetting the numbering of division units.
-% I don't recall exactly how (and for which fonts) these figures were chosen.
-% They quickly prove too small if using Roman numerals (as do too the book
-% class defaults even though they are a bit larger).
-\def\TOCnumwidthB {1.5em} % chapter
-\def\TOCnumwidthC {2.278em}% section, I think default is 2.3em
-\def\TOCnumwidthD {3.056em}% analog in standard class is 3.2em
-\def\TOCnumwidthE {3.833em}% analog in standard class is 4.1em
-\def\TOCnumwidthF {4.611em}% analog in standard class is 5em
-\def\TOCnumwidthG {5.389em}% analog in standard class is 6em
-\end{verbatim}
-The code for the ``global toc style''.
-\begin{verbatim}
-\makeatletter
-\etocsettocstyle
- {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
- \parindent\z@ \leftskip\z@skip \rightskip \z@skip
- \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
- \chapter *{\noindent\kern\TOCleftmargin\relax % uses "pt"...
- \contentsname
- \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
- \rightskip \TOCrightmargin\relax
- \parfillskip -\rightskip % or a smaller value if desired
- \leftskip \TOCleftmargin \relax }
- {\if@restonecol \twocolumn \fi\cleardoublepage}%
-\makeatother
-\end{verbatim}
-The code for the |part| and |chapter| line styles:
-\begin{verbatim}
-\makeatletter
-\etocsetstyle{part}
- {}
- {\addpenalty {-\@highpenalty}%
- \addvspace \TOCbigvskip
- \leavevmode
- {\large \bfseries % use a group to limit font change
- \interlinepenalty\@M
- \etocifnumbered{\etocnumber\hspace{1em}}{}%
- \etocname
- \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par
- \nobreak
- }
- {}
- {}
-\etocsetstyle{chapter}
- {\advance\leftskip\TOCnumwidthB\relax}
- {\addpenalty {-\@highpenalty }%
- \vskip \TOCmedvskip\relax
- \leavevmode
- {\interlinepenalty\@M
- \etocifnumbered
- {\llap{\makebox[\TOCnumwidthB][l]{\bfseries\etocnumber}}}
- {\advance\leftskip-\TOCnumwidthB\relax}%
- \bfseries\etocname
- \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
- \penalty \@highpenalty
- }
- {}
- {\advance\leftskip-\TOCnumwidthB\relax}
-\makeatother
-\end{verbatim}
-The remaining divisions share the same code, here abstracted into a macro:
-\begin{verbatim}
-\makeatletter
-\newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro
-\etocsetstyle{#1}
- {\advance\leftskip#2\relax}
- {\vskip \TOCverysmallvskip\relax
- \leavevmode
- {\interlinepenalty\@M
- \etocifnumbered
- {\llap{\makebox[#2][l]{\etocnumber}}}{\advance\leftskip-#2\relax}%
- \etocname
- \nobreak\leaders \copy\TOCleaderbox
- \hfil\makebox[-\parfillskip][r]{\etocpage}%
- \par }%
- }
- {}
- {\advance\leftskip-#2\relax}%
-}
-\makeatother
-\TOCsetlinestyle {section} {\TOCnumwidthC}
-\TOCsetlinestyle {subsection} {\TOCnumwidthD}
-\TOCsetlinestyle {subsubsection}{\TOCnumwidthE}
-\TOCsetlinestyle {paragraph} {\TOCnumwidthF}
-\TOCsetlinestyle {subparagraph} {\TOCnumwidthG}
-\end{verbatim}
-Note Bene: the code deliberately handles the non-numbered sectioning units
-unlike the way of the standard document classes (particularly regarding the
-alignment of multi-line headings.)
+\def\tmptitle{My Beautiful Thesis}
+\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
+ \leavevmode\leaders\hrule height 1pt\hfill\
+ \huge\textit{\tmptitle}\par}{\bigskip}
-In practice, typically one will want to use \csb{localtableofcontents}, hence
-we need to change a bit the global toc style for using |\section*| rather than
-|\chapter*| for example. When the time comes for these local ``minitocs'' one
-can do something like the following (of course all of that can be stored
-inside a macro, whose definition can be located in the preamble.)
+\tableofcontents \ref{toc:overview}
+\endgroup
+\end{filecontentsdef}
-For some reason this code has some hard-coded |2.25em| and |4.5em| which were
-not abstracted into macros or lengths.
+\filecontentsexec\foo
-The code inserts horizontal rules above and below the TOC contents in a
-non-separable by pagebreak way.
-\begin{verbatim}
-\makeatletter
-\etocsettocstyle
- {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
- \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
- \parindent\z@
- \dimen@ 2.25em % soon to be \leftskip
- \section *{\kern\dimen@ % \dimen@ works here by sheer luck
- \contentsname
- \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
- \parskip \z@skip
- \vspace{-1.25\baselineskip}% somewhat ad hoc
- \leftskip 2.25em
- \rightskip 4.5em
- \advance\rightskip-\TOCrightmargin\relax
- \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
- \rightskip 4.5em
- \parfillskip -\TOCrightmargin\relax }
- {\nobreak\vskip-.5\baselineskip
- \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
- \bigskip
- \if@restonecol \twocolumn \fi }
-\makeatother
-\end{verbatim}
-We then need to specify the line styles:
-\begin{verbatim}
-\makeatletter
-\etocsetstyle{section}
- {\advance\leftskip\TOCnumwidthC\relax}
- {\addpenalty \@secpenalty
- \etociffirst{}{\addvspace{\TOCmedvskip}}%
- \leavevmode
- {\interlinepenalty\@M
- \bfseries\etocifnumbered
- {\llap{\makebox[\TOCnumwidthC][l]{\etocnumber}}}
- {\advance\leftskip-\TOCnumwidthC}%
- \etocname\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
- \penalty \@highpenalty }
- {}
- {\advance\leftskip-\TOCnumwidthC\relax}
-\makeatother
-\TOCsetlinestyle {subsection} {\TOCnumwidthD}
-\TOCsetlinestyle {subsubsection}{\TOCnumwidthE}
-\TOCsetlinestyle {paragraph} {\TOCnumwidthF}
-\TOCsetlinestyle {subparagraph} {\TOCnumwidthG}
-\end{verbatim}
-As mentioned previously, this handles non-numbered (multi-line) sectioning
-units somewhat differently from what happens in the standard document classes.
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-See \autoref{sec:thirdexampleextra} for more.
-% ATTENTION Vendredi 09 septembre 2016 à 21:48:15
-\clearpage
\section{Linked list of the main package commands}
\begingroup\raggedcolumns
@@ -2180,6 +1897,7 @@ current value of the |tocdepth| counter is obeyed. As an
example the table of contents of
\autoref{part:custom} is in a \hyperref[toc:d]{float} which appears
\vpageref{toc:d}.
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begin{figure}[ht!]
\centering
\begingroup
@@ -2191,24 +1909,13 @@ example the table of contents of
\hyperref[toc:c]{I am from far away}}}}
\tableofcontents \label{toc:d} \ref{toc:c}
\endgroup
-%% \centeredline{The original is \hyperref[toc:c]{there}.}
\end{figure}
+\end{filecontentsdef}
+\filecontentsexec\foo
We used this:
-\begin{verbatim}
-\begin{figure}[ht!]
- \centering
- \begingroup
- \etocstandardlines
- \renewcommand{\etocbkgcolorcmd}{\color{green!5}}
- \renewcommand{\etocbelowtocskip}{0pt\relax}
- \fboxsep1ex
- \etocframedstyle [1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
- \hyperref[toc:c]{I am from far away}}}}
- \tableofcontents \label{toc:d} \ref{toc:c}
- \endgroup
-\end{figure}
-\end{verbatim}
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
Important: one should not use elsewhere \toc|\ref{toc:d}|. To clone again, one
must use a reference to the original label: \toc|\ref{toc:c}|.
@@ -2271,7 +1978,9 @@ table of contents of all the paragraphs from the document!
\label{etocsetnexttocdepth}
The |tocdepth| counter has no bearing on what gets written to the |.toc| file;
-its action is only on the actual typesetting of the table of contents: in the
+its action is only on the actual typesetting of the table of
+contents.\footnote{In the standard classes (at least), it also influences the
+ \csa{listoftables} and \csa{listoffigures}, via \csa{@dottedtocline}.} In the
standard classes there is only one |\tableofcontents| possible, whereas with
\etoc, arbitrarily many are allowed, so one may change |tocdepth| to the
appropriate value (which decides the finest sectioning level displayed) again
@@ -2298,6 +2007,15 @@ The simplest course is thus to have after |\begin{document}| and before the
where needed, \csb{etocsetnexttocdepth} before |\tableofcontents| or
|\localtableofcontents|.
+% pas traduit
+ \csa{etocsetnexttocdepth} used to modify the |tocdepth| counter immediately.
+ In case two or more such commands were issued in a row with no TOC being
+ typeset, this could break the correct restoring of the |tocdepth| counter
+ after the TOC. Starting with |1.08h|, the |tocdepth| counter is modified
+ only at the time the TOC is typeset, not earlier, thus fixing that
+ issue.\footnote{Thanks to D.B. for signaling the problem.}
+%
+
\subsection{The hyperref option \emph{bookmarksdepth}}
\label{ssec:bookmarksdepth}
@@ -2426,9 +2144,93 @@ After \csb{etocignoredepthtags}, the |.toc| depth tags are ignored (but
\csb{etocobeydepthtags} which makes \etoc react to the found tags in the
|.toc| file.
+\section{The commands \csbhyp{etocglobaldefs} and \csbhyp{etoclocaldefs}}
+\label{etocglobaldefs}
+\label{etoclocaldefs}
+
+In \LaTeX{} the meaning of a command defined via |\newcommand\foo{...}| inside
+an environment (or group) vanishes from \TeX's memory on exit from this
+environment (or group). At times however it is needed to make definitions with
+global scope, for this \TeX{} has the primitive prefix |\global|.
+
+By default \etoc's definitions of \csb{etocname} etc... are local. This causes
+problems in certain contexts such as TOC as tables (\autoref{sec:tocastable}, \autoref{ssec:tocastableold}) and also
+with |enumitem| \emph{inline} variants of its standard environments, because
+the command |\item| then closes a group (see \autoref{etocthelink}).
+
+After \csa{etocglobaldefs}, \etoc will make its definitions of \csb{etocname}
+etc... have global scope. For normal use this is not necessary. It does not hurt
+either to activate it systematically.
+
+To return to the default, use \csa{etoclocaldefs}. Note that both
+\csa{etocglobaldefs} and \csa{etoclocaldefs} actions are local to the
+environment or group where they are used.
+
+
+\section{Not displayed empty TOCs}
+
+\subsection{The \csbhyp{etocchecksemptiness} command}
+\label{etocchecksemptiness}
+
+The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check whether
+local tables of contents are empty and in case of emptiness to print nothing
+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|).
\section{Adding commands to the \texorpdfstring{\texttt{.toc}}{.toc} file}
\label{sec:addingtotoc}
@@ -2509,97 +2311,471 @@ I use the following trick: either in the preamble using
case of all |hyperref| options).
+\clearpage
+\etocdepthtag.toc {examples}
+\part{Examples}\label{part:examples}
-\section{Two Examples}
+\thispartstats %% (pas de sous-section)
-\subsection{A Beautiful Thesis example}
+\etocstandardlines
+\etocsettocstyle {}{\medskip}
+\localtableofcontents
-Here is another relatively simple example of use of the package
-functionalities.
-Let us set up some line styles. We choose a style for sections and
-sub-sections which would be suitable for, respectively, sections and
-sub-sections in an average length memoir. The line style specifications have
-some redundancy for clarity, and do not care about what to do at possible page
-breaks. Also, they do not worry about potential multi-column use.
+We present some additional examples. To understand all code snippets in detail,
+one will possibly need to have first browsed through \autoref{part:linestyles}
+and \autoref{part:globalcmds}.
+
+\section{Testing the compatibility mode}
+As a further example we now print the local table of contents
+of \autoref{part:globalcmds}. First we will test the compatibility mode.\footnote{the
+present document uses the |scrartcl| class, and we check here that
+the \etoc compatibility mode does respect the customizing done via the
+class commands.} The original was invisibly defined with a label at the
+beginning of \autoref{part:globalcmds}.
\begin{verbatim}
-\begingroup % we start a group to keep the style changes local
-\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
-\newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm}
+\KOMAoptions{toc=left}
+\etocstandarddisplaystyle % necessary for the display to obey toc=left
+\etocstandardlines
+\tableofcontents \ref{toc:globalcmds}
+\end{verbatim}
+\KOMAoptions{toc=left}
+\etocstandarddisplaystyle
+\etocstandardlines
+\tableofcontents \ref{toc:globalcmds}
-\etocsetstyle{section} % will pretend to be a Chapter
-{\addvspace{1ex}\parfillskip0pt
- \leftskip\tocleftmargin % (already done in title)
- \rightskip\the\tocrightmargin plus 1fil
- \parindent0pt\color{cyan}} % (already done)
-{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
-{\llap{Chapter\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+\section{Another compatibility mode}\label{sec:anothercompat}
-\etocsetstyle{subsection} % will pretend to be a Section
-{}
-{\mdseries\large\addvspace{.5ex}\leavevmode}
-{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+As explained in \autoref{subs:compat}, the commands
+\csa{etocstandardlines} and \csa{etocstandarddisplaystyle} tell \etoc to,
+essentially, act as an observer. The document class layout for the table of
+contents is then perfectly obeyed. There is no way to customize this standard
+layout (change fonts, margins, vertical spacings, etc...) from within the
+package. For this, use some package dedicated to this task; because \etoc either
+is (temporarily perhaps) in compatibility mode with no customization on its part
+possible, or the user has specified the layout in \csa{etocsetstyle} commands
+(and \csa{etocsettocstyle}) and is (supposedly...) in complete control.
-\def\tmptitle{My Beautiful Thesis}
-\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
- \leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{\tmptitle}\par}{\bigskip}
+Well, there is actually an alternative. It is possible to use the
+\csa{etocsetstyle} commands to recreate an artificial compatibility mode, in
+order to achieve effects like the following, all things being otherwise equal to
+the document class defaults:
+\begin{enumerate}[noitemsep]
+\item get the |hyperref| link to encapsulate only the names, but not the numbers
+ of each entry of the table of contents,
+\item use the document class style for chapters and sections, but modify it only
+ for subsections,
+\item do either of the above only for some portions of the table of contents.
+\end{enumerate}
-\tableofcontents \ref{toc:overview}
-\endgroup
-\end{verbatim}
+Here is how to proceed. One puts in the preamble:
+\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}}{}%
+ % for the scrbook or scrartcl classes:
+ \etocsetstyle{part}{}{}
+ {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ % identical in book/article/scrbook/scrartcl classes:
+ \etocsetstyle{chapter}{}{} %%% only for book and scrbook
+ {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ \etocsetstyle{section}{}{}
+ {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ \etocsetstyle{subsection}{}{}
+ {\savedsubsectionline{\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
+to put the commands inside a macro, or even inside a group.\footnote{and if
+moreover one just wants to keep the same layout as in the default, one may
+question why using \etoc... there is \emph{one} good reason: numbers and names
+are separately \texttt{hyperref} links, whereas normally there is only one link
+holding both the number and the name corresponding to one toc entry.} With these
+commands
+\etoc will construct a TOC completely identical to what would have been done by
+one of the document class: |article|, |book|, |scrartcl|, |scrbook|. \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|).}
+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
+not links anymore, but the names still are. Or one may decide to use \csa{etocthename}
+and keep an hyperlinked number with
+\csa{etocnumber}.
+Here is a subtler example where one only marginally modifies the
+sections (adding color to the number and removing the |hyperref| link) and keeps
+the subsections as in the default, \emph{except} for those of one specific
+section, for which the layout is completely modified:
+\MyQuasiStandardTOC{\ref{toc:overview}}
+\bigskip
+This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was:
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\etocsetstyle{section}{}
+ {\ifnum\etocthenumber=4
+ \etocsetstyle{subsection}
+ {\par\nopagebreak\begingroup
+ \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
+ \parindent 0pt \normalfont\normalsize\rmfamily\itshape
+ % \columnsep1em
+ % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
+ % \begin{multicols}{2}%
+ \etocskipfirstprefix}
+ {\allowbreak\,--\,}
+ {\etocname\ \textup{(\etocnumber)}}
+ {.\par\endgroup}%
+ % {.\par\end{multicols}\end{minipage}\par\endgroup}%
+ \else
+ \etocsetstyle{subsection}
+ {}{}
+ {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}
+ {}%
+ \fi}
+ {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
+ {}%
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
+Notice the page head-mark added by this standard TOC. Sections and subsections
+are printed exactly as in the default (except for the subsections of one
+specific user-chosen section and except for the color of the section numbers),
+with no need to specify explicitely any length, font or other formatting
+instructions. But we had to examine the |scrartcl| sources to determine what to
+use for \csa{leftskip} and \csa{rightskip} for our customized section
+entries.
-\begingroup
-\newlength{\tocleftmargin}
-\setlength{\tocleftmargin}{5cm}
-\newlength{\tocrightmargin}
-\setlength{\tocrightmargin}{1cm}
+\section{Emulating the book class}\label{sec:thirdexample}
+
+As explained in \autoref{subs:compat}: without explicit use of an
+\csb{etocsetstyle} command the package will leave to the document class the
+hand regarding the ``toc line styles''. It is sometimes asked by users (for
+example those using \etoc for its \csb{localtableofcontents}) how to stay
+close to but not completely identical with the design implemented by the
+standard classes, such as |book|. I can recommend package |tocloft| for this,
+as it is compatible with \etoc (see \autoref{subs:tocloft}) and thus \etoc will
+obey the |tocloft| customizations (as long as no use has been made of
+\csa{etocsetstyle}). It is also possible to modify only the style for, say,
+sections and leave the parts, chapters, subsections as in the document class,
+via the technique from \autoref{sec:anothercompat}.
+
+But for complete control, here is a translation of the |book| class code into
+\etoc lingua. It is then easy to modify the relevant lengths or adjust the
+used fonts. I thank \textsc{Denis Bitouzé} for prompting me to include this in
+the \etoc manual, as it resulted from some conversation we had about this. The
+code is not 100\% faithful to the |book| class, and particularly its rendering
+of (multi-line) non-numbered units differs (... I think, as I copied pasted as
+is the code from where I had stored it and did not do much thinking about it
+again). Some proficiency in low-level \TeX\ and \LaTeX\ macros is needed to
+understand what the code says, but for modifying fonts or some lengths such
+in-depth understanding is not needed.
+
+With some extra code one can \emph{automatically adjust the widths} assigned
+to typesetting sectioning numbers in order to prevent overflows, even with for
+example \MakeUppercase{\romannumeral 38}; but this is a more advanced feature
+which I have moved to \autoref{sec:thirdexampleextra}.
+
+First we set up some lengths. I use macro registers, not real \LaTeX\ lengths.
+When using |em|'s however, this means that one must pay attention to when the
+actual dimension assignment is made, as this will then depend upon the current
+font settings. In the code below, at the location where the \csa{TOCnumwidthB}
+and \csa{TOCnumwidthC} will be used, the |1em| from their specification will
+be matched to the normal medium series font, not the bold font; this is
+deliberate so that one can compare more readily with the other dimensions;
+besides, with the \csa{TOCcomputenumwidths} from
+\autoref{sec:thirdexampleextra} these macros will actually hold a dimension
+using |pt| as dimensional unit.
+
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+% it will be easy to globally shift the TOC horizontally if needed
+\def\TOCleftmargin {0pt}
+\def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg
+
+% this is for dotted leaders
+\newbox\TOCleaderbox
+\def\TOCleaderboxwidth {0.7777em}% about like what standard classes do
+
+% vertical spacing
+\def\TOCverysmallvskip {0pt plus .2pt}
+\def\TOCmedvskip {1em plus 1pt}
+\def\TOCbigvskip {2.25em plus 1pt}
+
+% the ``numwidths'' for typesetting the numbering of division units.
+% I don't recall exactly how (and for which fonts) these figures were chosen.
+% They quickly prove too small if using Roman numerals (as do too the book
+% class defaults even though they are a bit larger).
+\def\TOCnumwidthB {1.5em} % chapter
+\def\TOCnumwidthC {2.278em}% section, I think default is 2.3em
+\def\TOCnumwidthD {3.056em}% analog in standard class is 3.2em
+\def\TOCnumwidthE {3.833em}% analog in standard class is 4.1em
+\def\TOCnumwidthF {4.611em}% analog in standard class is 5em
+\def\TOCnumwidthG {5.389em}% analog in standard class is 6em
+
+% The code for the ``global toc style''.
+
+\newcommand*\TOCglobalstyle {%
+\etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \parindent\z@ \leftskip\z@skip \rightskip \z@skip
+ \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
+ \chapter *{\noindent\kern\TOCleftmargin\relax % uses "pt"...
+ \contentsname
+ \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
+ \rightskip \TOCrightmargin\relax
+ \parfillskip -\rightskip % or a smaller value if desired
+ \leftskip \TOCleftmargin \relax }
+ {\if@restonecol \twocolumn \fi\cleardoublepage}%
+%
+\etocsetstyle{part}
+ {}
+ {\addpenalty {-\@highpenalty}%
+ \addvspace \TOCbigvskip
+ \leavevmode
+ {\large \bfseries % use a group to limit font change
+ \interlinepenalty\@M
+ \etocifnumbered{\etocnumber\hspace{1em}}{}%
+ \etocname
+ \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par
+ \nobreak
+ }
+ {}
+ {}%
+%
+\etocsetstyle{chapter}
+ {\advance\leftskip\TOCnumwidthB\relax}
+ {\addpenalty {-\@highpenalty }%
+ \vskip \TOCmedvskip\relax
+ \leavevmode
+ {\interlinepenalty\@M
+ \etocifnumbered
+ {\llap{\makebox[\TOCnumwidthB][l]{\bfseries\etocnumber}}}
+ {\advance\leftskip-\TOCnumwidthB\relax}%
+ \bfseries\etocname
+ \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
+ \penalty \@highpenalty
+ }
+ {}
+ {\advance\leftskip-\TOCnumwidthB\relax}%
+%
+ \TOCsetlinestyle {section} {\TOCnumwidthC}%
+ \TOCsetlinestyle {subsection} {\TOCnumwidthD}%
+ \TOCsetlinestyle {subsubsection}{\TOCnumwidthE}%
+ \TOCsetlinestyle {paragraph} {\TOCnumwidthF}%
+ \TOCsetlinestyle {subparagraph} {\TOCnumwidthG}%
+}% end of \TOCglobalstyle
+
+%The common code for line styles is abstracted into a macro:
+
+\newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro
+\etocsetstyle{#1}
+ {\advance\leftskip#2\relax}
+ {\vskip \TOCverysmallvskip\relax
+ \leavevmode
+ {\interlinepenalty\@M
+ \etocifnumbered
+ {\llap{\makebox[#2][l]{\etocnumber}}}{\advance\leftskip-#2\relax}%
+ \etocname
+ \nobreak\leaders \copy\TOCleaderbox
+ \hfil\makebox[-\parfillskip][r]{\etocpage}%
+ \par }%
+ }
+ {}
+ {\advance\leftskip-#2\relax}%
+}
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
+Nota Bene: the code deliberately handles the non-numbered sectioning units
+unlike the way of the standard document classes (particularly regarding the
+alignment of multi-line headings.)
+
+The whole thing was encapsulated in \csa{TOCglobalstyle}, because we also want
+a \csa{TOClocalstyle} for local tables of contents which typically will want
+to use |\section*| rather than |\chapter*| and not insert page marks in the
+headers. The \csa{TOClocalstyle} is to be issued once, after the main document
+TOC, or rather before using \csa{localtableofcontents}. If one wants a full
+TOC at end of document one will naturally have to issue again
+\csa{TOCglobalstyle} there.
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\makeatletter
+\newcommand*\TOClocalstyle {%
+\etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
+ \parindent\z@
+ \dimen@ 2.25em % for left indenting
+ \section *{\kern\dimen@ % use of \dimen@ works here by sheer luck
+ \contentsname
+ % un-comment this if marks are wanted:
+ %\@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}%
+ }% end of \section
+ \parskip \z@skip
+ \vspace{-1.25\baselineskip}% somewhat ad hoc
+ \leftskip 2.25em
+ \rightskip 4.5em
+ \advance\rightskip-\TOCrightmargin\relax
+ \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
+ \rightskip 4.5em
+ \parfillskip -\TOCrightmargin\relax }
+ {\nobreak\vskip-.5\baselineskip
+ \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
+ \bigskip
+ \if@restonecol \twocolumn \fi }%
+%
\etocsetstyle{section}
-{\addvspace{1ex}\parfillskip0pt
- \leftskip\tocleftmargin
- \rightskip\the\tocrightmargin plus 1fil
- \parindent0pt\color{cyan}}
-{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
-{\llap{Chapter\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+ {\advance\leftskip\TOCnumwidthC\relax}
+ {\addpenalty \@secpenalty
+ \etociffirst{}{\addvspace{\TOCmedvskip}}%
+ \leavevmode
+ {\interlinepenalty\@M
+ \bfseries\etocifnumbered
+ {\llap{\makebox[\TOCnumwidthC][l]{\etocnumber}}}
+ {\advance\leftskip-\TOCnumwidthC}%
+ \etocname\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
+ \penalty \@highpenalty }
+ {}
+ {\advance\leftskip-\TOCnumwidthC\relax}%
+% the rest is identical with code for global tocs:
+ \TOCsetlinestyle {subsection} {\TOCnumwidthD}%
+ \TOCsetlinestyle {subsubsection}{\TOCnumwidthE}%
+ \TOCsetlinestyle {paragraph} {\TOCnumwidthF}%
+ \TOCsetlinestyle {subparagraph} {\TOCnumwidthG}%
+}% end of \TOClocalstyle
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
+As mentioned previously, this handles non-numbered (multi-line) sectioning
+units somewhat differently from what happens in the standard document classes.
-\etocsetstyle{subsection}
-{}
-{\mdseries\large\addvspace{.5ex}\leavevmode}
-{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+For some reason this code has some hard-coded |2.25em| and |4.5em| which were
+not abstracted into macros or lengths. The code inserts horizontal rules above
+and below the TOC contents in a non-separable by pagebreak way.
-\def\tmptitle{My Beautiful Thesis}
+See \autoref{sec:thirdexampleextra} for more.
-\etocsettocstyle{\color{cyan}\parindent0pt\leftskip\tocleftmargin
- \leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{\tmptitle}\par}{\bigskip}
+\section{A framed display}
-\tableofcontents \ref{toc:overview}
-% And again, for the fun of it:
-% \def\tmptitle{My Very Beautiful Thesis}
-% \tableofcontents \ref{toc:c}
+We now opt for a ``framed'' style, using the package default
+line styles and some colors added (it has been put in a float which appears
+\vpageref{toc:b}).
+
+%
+% (13 octobre 2013)
+% \footnote{inside the |figure| environment and before the
+% framed toc, which uses |multicols|, we added \csa{normalcolor} as work-around
+% to an interaction bug (related to the \csa{color\{red\}} command we added to
+% the |.toc| file) between |multicols|, |color| and the |figure|
+% environment. This bug has nothing to do with \etoc.}
+% RETIRÉ le 28 avril 2015 pour 1.08f
+
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+\etocdefaultlines
+\begingroup
+\renewcommand{\etoccolumnsep}{2em}
+\renewcommand{\etocinnerleftsep}{1.5em}
+\renewcommand{\etocinnerrightsep}{1.5em}
+% specify a background color for the toc contents
+\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
+% set up the top and bottom rules
+\renewcommand{\etoctoprule}{\hrule height 1pt}
+\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
+\renewcommand{\etocbottomrule}{\hrule height 1pt}
+\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
+% set up the left and right rules
+\renewcommand{\etocleftrule}{\vrule width 5pt}
+\renewcommand{\etocrightrule}{\vrule width 5pt}
+\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
+\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
+% use \fcolorbox to set up a colored frame for the title
+\fboxrule1pt
+\renewcommand{\etocbelowtocskip}{0pt\relax}
+\etocframedstyle {\normalsize\rmfamily\itshape
+ \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
+ This is a table of contents \`a la \etoc, but just for
+ the sections and subsections in this part. As it is put
+ in a frame, it has to be small enough to fit on
+ one page. It has the label |toc:b|.}}}
+\begin{figure}[ht!]
+ \centering
+\tableofcontents \label{toc:b} \ref{toc:globalcmds}
+\end{figure}
\endgroup
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
+\filecontentsexec\filecontentsheremacro
-\subsection{A TOC with a background color}\label{ssec:again}
+%\begin{figure}[ht!]
+% \centering
+% plus nécessaire ?
+%\normalcolor % work-around to a bug involving color and multicols (and figure)
+% \tableofcontents \label{toc:b} \ref{toc:globalcmds}
+% \end{figure}
+% \endgroup
-Let us now try out some more sophisticated line styles. The
-display will use the \csa{etocframedstyle} package command, which
-requires that the produced table of contents fits on a single
-page.
-We wrap it up in a \hyperref[toc:floating]{figure environment} showing up
-\vpageref{toc:floating}.
+% Il y a un color leak du framed mais uniquement lorsqu'il est mis dans le
+% float. 2013/10/13, qui révèle un bug (?? NON) du style framed je vais regarder
+% mais bon. Le leak apparaît avec ruled aussi, et même avec juste multicolstyle
+% MAIS PAS EN UNE SEULE COLONNE (même framed ou ruled). il semble qu'il y aie
+% donc un problème d'interaction avec multicol là. à voir. Pas le temps
+% maintenant.
+
+% 2013/10/14
+% il s'agit en fait d'un bug de color+multicols+figure qui n'a rien à voir avec
+% etoc:
+% http://tex.stackexchange.com/questions/138783/color-leak-from-multicols-within-a-figure
+% J'ai trouvé le work-around qui consiste simplement à ajouter un \normalcolor
+% _avant_ le multicols à l'intérieur de figure
+
+\section{Another TOC with a background color}\label{ssec:again}
+
+Let us now try out some more sophisticated line styles. The display will use
+the \csa{etocframedstyle} package command, which requires that the produced
+table of contents fits on a single page. We wrap it up in a
+\hyperref[toc:floating]{figure environment} showing up
+\vpageref{toc:floating}.
+This design uses the \etoc `framed' style with a background color. The frame
+borders have been set to have the same color as the one serving as background
+for the entire thing. It would be advantageous to use rather inside
+\csb{etocsettocstyle} commands from a package like |tcolorbox| as this allows
+sophisticated breakable boxes (with |TikZ/pgf| for decoration.)
+
+The details of the line styles used here are a bit involved, they were written
+by the author at some early stage of this documentation and have only been
+slightly revised to use more \LaTeX-commands and less \TeX-primitives. Similar
+code is used also for \hyperref[toc:clone]{this other toc}.
+
+% archivage de commentaires
+% v1.07l on the occasion of traduction into German documentation:
+ % APRIL 26, 2014 Improvement in the section style for better placement of
+ % page number when the section name is more than one line long. Use of
+ % \makebox rather than \hbox, to be more LaTeX like.
+% attention car \ref{toc:floating} fera référence au compteur de
+% toutes les toc, pas visibletoc.
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\begin{figure}[htbp!]\centering
\colorlet{subsecnum}{black}
\colorlet{secbackground}{green!30}
@@ -2624,26 +2800,30 @@ We wrap it up in a \hyperref[toc:floating]{figure environment} showing up
\newcommand\shiftedwhiterule[2]{%
\hbox to \linewidth{\color{white}%
\hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#2}
+ \vskip#2}
-\etocsetstyle{subsubsection}{\etocskipfirstprefix}
+\etocsetstyle{subsubsection}
+{\etocskipfirstprefix}
{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
-\leftskip2.3cm\hangindent1cm\rightskip.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
-\nointerlineskip\vskip3pt}
+ \leftskip2.3cm\hangindent1cm\rightskip.5cm\relax
+ \makebox[1cm][l]{\color{subsecnum}\etocnumber}%
+ \color{black}\etocname
+ \nobreak\leaders\hbox to.2cm{\hss.}\hfill
+ \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
+ \nointerlineskip\vskip3pt}
{}
-\etocsetstyle{subsection}{\etocskipfirstprefix}
+\etocsetstyle{subsection}
+{\etocskipfirstprefix}
{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
-\leftskip1.5cm\hangindent.8cm\rightskip.5cm\noindent
-\hbox to .75cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
-\nointerlineskip\vskip3pt}
+ \leftskip1.5cm\hangindent.8cm\rightskip.5cm\relax
+ \makebox[.75cm][l]{\color{subsecnum}\etocnumber}%
+ \color{black}\etocname
+ \nobreak\leaders\hbox to.2cm{\hss.}\hfill
+ \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
+ \nointerlineskip\vskip3pt}
{}
\newcommand{\coloredstuff}[2]{%
@@ -2656,51 +2836,78 @@ We wrap it up in a \hyperref[toc:floating]{figure environment} showing up
\vskip3pt}}%
\par\nointerlineskip}
-% v1.07l on the occasion of traduction into German documentation:
- % APRIL 26, 2014 Improvement in the section style for better placement of
- % page number when the section name is more than one line long. Use of
- % \makebox rather than \hbox, to be more LaTeX like.
\etocsetstyle{section}
-{\coloredstuff{blue}
- {\hfil \bfseries\large Contents of Part One\hfil}}
+{\coloredstuff{blue}{\hfil \bfseries\large Contents of Part One\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{blue}
{\leftskip1.5cm\rightskip.5cm\parfillskip-\rightskip
\makebox[0pt][r]{\makebox[.5cm][l]{\etocnumber}}%
- \etocname\hfill{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}}%
+ \etocname\nobreak\hfill\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}%
\vskip6pt}
{}
-
-% attention car \ref{toc:floating} fera référence au compteur de
-% toutes les toc, pas visibletoc.
-
\etocframedstyle[1]{}
\tableofcontents \label{toc:floating} \ref{toc:overview}
\vspace{-\baselineskip}
\centeredline{|\tableofcontents \ref{toc:overview}|
-(\emph{cf.} \autoref{ssec:again} and \hyperref[toc:clone]{this other toc})}
+(\emph{cf.} \hyperref[toc:clone]{this other toc})}
\end{figure}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
+
+\filecontentsexec\filecontentsheremacro
+
+% , and the
+% reader is referred to its \hyperref[ssec:tocclone]{subsection} for the
+% coding used.
-The actual design is not pre-built in \etoc; it uses its `framed' style with a
-background color. The frame borders have been set to have the same color as the
-one serving as background for the entire thing. This design (with other colors)
-is in use also for \hyperref[toc:clone]{this other toc}, and the
-reader is referred to its \hyperref[ssec:tocclone]{subsection} for the
-coding used.
+\section{A (crazy) inline display}
-% 11 octobre 2013 ceci était une section avant:
-% (17 octobre, je m'aperçois qu'à cause des différents chgts, des
-% sous-sections devenant des sections etc... \thisspecialstats ici ne
-% faisait pas du tout des statistiques; vaut mieux supprimer et faire
-% simplement \localtableofcontents pour maintenir le même layout.)
+Let us finally make some crazy inline display of the table of
+contents of this entire document. We will typeset the subsections as
+footnotes... This kind of style is suitable for a hyperlinked
+document, probably not for print! (although I like it, but my personal tastes in
+many matters do not seem to be widely shared).
-% les \clearpage sont embêtants; surtout si je prétends qu'on peut
-% recompiler facilement sous d'autres conditions...
+%%%% Note: 27 april 2014
-% on va plutôt faire un \vspace suffisant, cela sera un moindre mal
+%%%% except for a miraculous situation depending from the quantity of previous
+%%%% material this TOC will have links extending accross pagebreaks, which
+%%%% dvipdfmx does not know how to handle completely. Apart from that the output
+%%%% is ok, thus no need to try seriously to avoid them.
+
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begingroup
+\newsavebox{\forsubsections}
+\etocsetstyle{part}{\upshape. \etocskipfirstprefix}
+ {. \upshape}
+ {\bfseries\etocname:~~}
+ {}
+\etocsetstyle{section}{\itshape\etocskipfirstprefix}
+ {, }
+ {\mdseries\etocname}
+ {}
+\etocsetstyle{subsection}
+ {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
+ {; }
+ {\etocname}
+ {\end{lrbox}\footnote{\unhbox\forsubsections.}}
+\etocsetstyle{subsubsection}
+ { (\itshape\etocskipfirstprefix}
+ {, }
+ {\etocname}
+ {\/\upshape)}
+\etocsettocstyle{Here is the inline table of contents. }{.\par}
+\tableofcontents \label{toc:crazyinline}
+\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+
+The code used:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-%\vspace{1cm}
\clearpage
\etocdepthtag.toc {surprising}
@@ -2804,7 +3011,7 @@ it here we just wrote:\par\smallskip
Here are the implementation details:
\begingroup
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
< in the preamble >
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
@@ -2826,8 +3033,8 @@ Here are the implementation details:
Here is the numbered and linked list of all tables of contents which are
displayed within this document: \tableofcontents.
\endgroup
-\end{verbatim}
-
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\endgroup
After |\etocsetstyle{visibletoc}{..}{..}{..}{..}|, all future TOCs (not in
@@ -2885,7 +3092,7 @@ to the |.toc| file, corresponding to a fictitious document
unit with name `|exercise|'. A
four-column list, including the sections, can then be
typeset with the following code:
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocsetnexttocdepth{2} % sections are at level 1 and will show up
\begingroup
\etocsetlevel{exercise}{2} % but:
@@ -2902,8 +3109,8 @@ typeset with the following code:
\setlength{\columnseprule}{.4pt}
\tableofcontents
\endgroup
-\end{verbatim}
-
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{A TOC with a fancy layout}
@@ -3183,126 +3390,6 @@ Another technique for doing this kind of things is explained in
\repeat
\endgroup
-\section{Another compatibility mode}\label{sec:anothercompat}
-
-As explained in \autoref{subs:compat}, the commands
-\csa{etocstandardlines} and \csa{etocstandarddisplaystyle} tell \etoc to,
-essentially, act as an observer. The document class layout for the table of
-contents is then perfectly obeyed. There is no way to customize this standard
-layout (change fonts, margins, vertical spacings, etc...) from within the
-package. For this, use some package dedicated to this task; because \etoc either
-is (temporarily perhaps) in compatibility mode with no customization on its part
-possible, or the user has specified the layout in \csa{etocsetstyle} commands
-(and \csa{etocsettocstyle}) and is (supposedly...) in complete control.
-
-Well, there is actually an alternative. It is possible to use the
-\csa{etocsetstyle} commands to recreate an artificial compatibility mode, in
-order to achieve effects like the following, all things being otherwise equal to
-the document class defaults:
-\begin{enumerate}[noitemsep]
-\item get the |hyperref| link to encapsulate only the names, but not the numbers
- of each entry of the table of contents,
-\item use the document class style for chapters and sections, but modify it only
- for subsections,
-\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:
-\begin{verbatim}
-\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}}{}%
- % for the scrbook or scrartcl classes:
- \etocsetstyle{part}{}{}
- {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- % identical in book/article/scrbook/scrartcl classes:
- \etocsetstyle{chapter}{}{} %%% only for book and scrbook
- {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- \etocsetstyle{section}{}{}
- {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- \etocsetstyle{subsection}{}{}
- {\savedsubsectionline{\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{verbatim}
-Of course if the document has only one table of contents then there is no need
-to put the commands inside a macro, or even inside a group.\footnote{and if
-moreover one just wants to keep the same layout as in the default, one may
-question why using \etoc... there is \emph{one} good reason: numbers and names
-are separately \texttt{hyperref} links, whereas normally there is only one link
-holding both the number and the name corresponding to one toc entry.} With these
-commands
-\etoc will construct a TOC completely identical to what would have been done by
-one of the document class: |article|, |book|, |scrartcl|, |scrbook|. \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|).}
-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
-not links anymore, but the names still are. Or one may decide to use \csa{etocthename}
-and keep an hyperlinked number with
-\csa{etocnumber}.
-
-Here is a subtler example where one only marginally modifies the
-sections (adding color to the number and removing the |hyperref| link) and keeps
-the subsections as in the default, \emph{except} for those of one specific
-section, for which the layout is completely modified:
-\MyQuasiStandardTOC{\ref{toc:overview}}
-\bigskip
-This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was:
-\begin{verbatim}
-\etocsetstyle{section}{}
- {\ifnum\etocthenumber=4
- \etocsetstyle{subsection}
- {\par\nopagebreak\begingroup
- \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
- \parindent 0pt \normalfont\normalsize\rmfamily\itshape
- % \columnsep1em
- % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
- % \begin{multicols}{2}%
- \etocskipfirstprefix}
- {\allowbreak\,--\,}
- {\etocname\ \textup{(\etocnumber)}}
- {.\par\endgroup}%
- % {.\par\end{multicols}\end{minipage}\par\endgroup}%
- \else
- \etocsetstyle{subsection}
- {}{}
- {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}
- {}%
- \fi}
- {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
- {}%
-\end{verbatim}
-
-Notice the page head-mark added by this standard TOC. Sections and subsections
-are printed exactly as in the default (except for the subsections of one
-specific user-chosen section and except for the color of the section numbers),
-with no need to specify explicitely any length, font or other formatting
-instructions. But we had to examine the |scrartcl| sources to determine what to
-use for \csa{leftskip} and \csa{rightskip} for our customized section
-entries.
-
\section{The TOC as a tree}\label{tocastree}
@@ -3341,6 +3428,8 @@ its synonym \csb{etocnopar}.} This is the later job of a |forest| environment
which will be given the contents of |\treetok|.
+% anciens commentaires extraits du code avant incorporation à filecontentsdef
+
% 7 mars: j'utilise \etocthelinkedname défini à partir de 1.07f
% mais bien sûr je sais que ça ne marche pas (sauf dans l'arbre pour le lien de
% la section du bas) dans un QTree. Mais ça marche parfaitement dans un arbre
@@ -3350,72 +3439,21 @@ which will be given the contents of |\treetok|.
% avec les hyperliens, ça marche out of the box (une fois que j'ai appris un peu
% de sa syntaxe et de celle de TikZ).
-\newcommand*\PrepareSectionNode{%
- \tmptok {\centering\bfseries}%
- \appendtotok\tmptok\etocthelinkedname
- \edef\foresttreenode{ [{\noexpand\parbox{2cm}{\the\tmptok}}}%
-}
-
% 7 mars: j'utilise maintenant \etocthelinkedname
-\newcommand*{\PrepareSubsectionNode}{%
- \tmptok {\raggedright}% j'ai essayé aussi avec \sloppy
- \appendtotok\tmptok\etocthelinkedname
- \edef\foresttreenode{ [{\noexpand\parbox{6cm}{\the\tmptok}}}%
-}
-
-\etocsetstyle{section}
- {\etocskipfirstprefix}
- {\appendtotok\treetok{ ]}}
- {\PrepareSectionNode \appendtotok\treetok\foresttreenode}
- {\appendtotok\treetok{ ]}}
-
-\etocsetstyle{subsection}
- {\etocskipfirstprefix}
- {\appendtotok\treetok{ ]}}
- {\PrepareSubsectionNode \appendtotok\treetok\foresttreenode}
- {\appendtotok\treetok{ ]}}
-
-\etocsettocstyle
- {\treetok{[{\hyperref[part:overview]{Overview}}}}
- {\global\appendtotok\treetok{ ]}}
-
% 11 octobre
% forest ne veut pas @\the\treetok avec un \treetok vide, donc
% il faut lui donner une valeur par défaut.
-\treetok{[{run latex again}]}
% 12 octobre
% pour que varioref fonctionne bien, je dois mettre la \tableofcontents
% au plus près de l'environnement forest
-\begin{figure}[th!]\centering
- \etocsetnexttocdepth{subsection}
- \tableofcontents \label{toc:forest}\ref{toc:overview}
- \hypersetup{hidelinks}%
- \bracketset{action character=@}
- \begin{forest}
- for tree={anchor=center,child anchor=west,
- grow'=east,draw,thick,
- edge={draw,thick,dashed,color=teal}},
- where={level()==1}{circle,thick,fill=blue!5,
- before computing xy={l=3cm}}{},
- where={level()==2}{fill=red!5,
- before computing xy={l=6cm}}{},
- % je trouve ce truc pour une position absolue. OK!
- rectangle, thick, fill=cyan!5, inner sep=6pt,
- @\the\treetok
- \end{forest}
- \centeredline{A table of contents displayed as a |forest| tree.}
-\end{figure}
-
+\let\appendtotok\relax
-The resulting tree has been put in a \hyperref[toc:forest]{float}, which
-appears \vpageref[above]{toc:forest}. Here is the
-code used for its production:
-\begin{verbatim}
-\newtoks\treetok
-\newtoks\tmptok
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+% \newtoks\treetok % put this (uncommented) preferably in the preamble
+% \newtoks\tmptok % (idem)
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter
@@ -3472,8 +3510,14 @@ code used for its production:
@\the\treetok
\end{forest}
\end{figure}
-\end{verbatim}
+\end{filecontentsdef}
+\filecontentsexec\foo
+The resulting tree has been put in a \hyperref[toc:forest]{float}, which
+appears \vpageref[above]{toc:forest}. Here is the
+code used for its production:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
Why |\hypersetup{hidelinks}|? as explained in
\autoref{ssec:hidelinks}, I prefer the links in TOCs not to be
colorized, nor framed, so this document inserts a command
@@ -3524,9 +3568,11 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
\csa{subsectiontok} will be needed.
-\begin{verbatim}
-% \newtoks\treetok % already done earlier
-\newtoks\sectiontok \newtoks\subsectiontok \newcommand*{\treenode}{}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+% \newtoks\treetok % put this (uncommented) preferably in the preamble
+% \newtoks\sectiontok
+% \newtoks\subsectiontok
+\newcommand*{\treenode}{}
\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
\edef\tmp{\the#1 child {\the#2}}%
@@ -3553,46 +3599,9 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
{\treetok{\node {\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ;}}
-% moved to the inside of the figure environment for correct \pageref{toc:molecule}
-% \etocsetnexttocdepth{subsection}
-% \tableofcontents \label{toc:molecule} \ref{toc:overview}
-\end{verbatim}
-
-% \newtoks\sectiontok
-% \newtoks\subsectiontok
-\newcommand*\treenode {}
-
-\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
- \edef\tmp{\the#1 child {\the#2}}%
- #1\expandafter{\tmp}%
-}
-
-\newcommand*{\preparetreenode}{%
- \tmptok\expandafter{\etocthelinkednumber}%
- \edef\treenode{node {\the\tmptok}}%
-}
-
-\etocsetstyle{section}
- {\etocskipfirstprefix}
- {\appendchildtree\treetok\sectiontok}
- {\preparetreenode
- \sectiontok\expandafter{\treenode}}
- {\appendchildtree\treetok\sectiontok}
-
-\etocsetstyle{subsection}
- {\etocskipfirstprefix}
- {\appendchildtree\sectiontok\subsectiontok}
- {\preparetreenode
- \subsectiontok\expandafter{\treenode}}
- {\appendchildtree\sectiontok\subsectiontok}
-
-\etocsettocstyle
- {\treetok{\node {\hyperref[part:overview]{Overview}}}}
- {\global\appendtotok\treetok{ ;}}
-
-\begin{figure}[th!]\centering
-\etocsetnexttocdepth{subsection}
- \tableofcontents \label{toc:molecule}\ref{toc:overview}
+\begin{figure}[thbp!]\centering
+ \etocsetnexttocdepth{subsection}
+ \tableofcontents \label{toc:molecule} \ref{toc:overview}
\hypersetup{hidelinks}%
\begin{tikzpicture}
[grow cyclic,
@@ -3603,36 +3612,22 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
(\tikzparentnode) --(\tikzchildnode)}]
\the\treetok
\end{tikzpicture}
- \centeredline{A table of contents as a ``molecule.''}
\end{figure}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
+
+\filecontentsexec\filecontentsheremacro
% Pour que \pageref fonctionne correctement, je dois mettre
% le \tableofcontents dans la figure.
The |\tableofcontents| command appears just above the
-|tikzpicture| environment in a figure float (for the label of the
-table of contents to certainly
-refer to the same page as the one where the picture will actually be printed).
+|tikzpicture| environment in a figure float (to make sure that the label of the
+table of contents
+refers to the same page as the one where the picture will actually be printed).
We thus get the table of contents as a ``\hyperref[toc:molecule]{molecule}'',
which
-appears \vpageref[above]{toc:molecule}. Here is the code actually
-producing it:
-\begin{verbatim}
-\begin{figure}[th!]\centering
- \etocsetnexttocdepth{subsection}
- \tableofcontents \label{toc:molecule} \ref{toc:overview}
- \hypersetup{hidelinks}%
- \begin{tikzpicture}
- [grow cyclic,
- level 1/.style={level distance=4cm,sibling angle=72},
- level 2/.style={level distance=2cm,sibling angle=60},
- every node/.style={ball color=red,circle,text=SkyBlue},
- edge from parent path={[dashed,very thick,color=cyan]
- (\tikzparentnode) --(\tikzchildnode)}]
- \the\treetok
- \end{tikzpicture}
-\end{figure}
-\end{verbatim}
+appears \vpageref[above]{toc:molecule}.
This \hyperref[toc:molecule]{TikZ TOC} is fully hyperlinked, like the
previous
@@ -3692,133 +3687,19 @@ example was motivated on |2015/03/11| by
\url{http://tex.stackexchange.com/q/232816/4686} and this led to the
\hyperref[toc:mindmaptitlepage]{title page} which is a further example.}
+% car dans le filecontentsdef je dois faire comme si pour verbatim
+% mais aussi l'exécuter, donc il me faut annuler définitions précédents pour
+% contourner messages d'erreurs de LaTeX.
-\begingroup
-%\newtoks\treetok
-%\newtoks\parttok
-
-\newcommand*\partnode {} % just to check we don't overwrite something
-%\newcommand*\childnode {}
-
-\newcommand*\tmprotate {} % just to check we don't overwrite something
-\newcommand*\tmpoption {} % just to check we don't overwrite something
-\newcommand*\tmpstuff {} % just to check we don't overwrite something
-
-% \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
-% #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
-
-\renewcommand*{\appendchildtree}[3]{%
-% 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 [#3]{\the#2}}%
- #1\expandafter {\tmpstuff }%
-}
-
-% \newcounter{partco}
-
-% 1,2,3,4,5,... -> 1,2,3,1,2,3,1,2,3
-% \def\pseudomodthree #1{\numexpr #1 + 3 - 3*((#1+1)/3)\relax}
-
-\etocsetstyle{part}
- {\etocskipfirstprefix}
-% 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.
- {\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
-% define the part node
- \edef\partnode{node \tmpoption
- {\unexpanded\expandafter{\etocthelinkednumber}.
- \unexpanded\expandafter{\etocthelinkedname}}\tmprotate }%
-% 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 {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
- }
-
-\etocsetstyle{section}
- {}
- {}
- {% define the section node
- \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
- \unexpanded\expandafter{\etocthelinkedname}}}}%
- % append it to the current \parttok
- \appendtotok\parttok\childnode
- }
- {}
-
-\etocsettocstyle
- {\setcounter{partco}{0}%
- \treetok{\node [root concept]{\textbf{The \etoc documentation}}}}
- {\global\appendtotok\treetok{ ;}}
-% The \global above is mandatory because etoc always typesets TOC inside a group
-
-\etocsetnexttocdepth{section}
-% use of depth tags to cut out some sections.
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {section}
-\etocsettagdepth {linestyles} {part}
-\etocsettagdepth {globalcmds} {part}
-\etocsettagdepth {custom} {section}
-\etocsettagdepth {tips} {part}
-\etocsettagdepth {etocandworld}{part}
-\etocsettagdepth {code} {section}
-
-\tikzset{
- branch color/.style={
- concept color=#1!white,
- every child/.append style={concept color=#1!white!30!white, font=\normalsize},
- }
-}%
-
-\begin{figure}[thp!]
-\tableofcontents\label{toc:mindmap}%
-\centeredline{\resizebox{.85\paperwidth}{!}%
-{\begin{tikzpicture}[mindmap,
- grow cyclic,
- text width=2cm,
- align=flush center,
- nodes={concept},
- concept color=orange!60,
- root concept/.append style={text width=4cm, font=\Large},
- 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
-\end{tikzpicture}}}
-\end{figure}
-\endgroup
-
-It is difficult to get everything to fit on one page. However \csa{resizebox}
-comes to the rescue. And it preserves hyperlinks. Nevertheless for this
-example I excluded some sections from the display, using the technique of the
-\etoc \hyperref[etocdepthtag.toc]{depth tags}. The fully hyperlinked TOC
-appears \vpageref{toc:mindmap}.
+\let\appendchildtree\relax
+\let\childnode\relax
+\let\appendtotok\relax
+\expandafter\let\csname c@partco\endcsname\relax
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begingroup
-\newtoks\treetok
-\newtoks\parttok
+% \newtoks\treetok % done in preamble
+% \newtoks\parttok
\newcommand*\partnode {} % just to check we don't overwrite something
\newcommand*\childnode {}
@@ -3898,7 +3779,8 @@ appears \vpageref{toc:mindmap}.
\etocsettagdepth {preamble} {none}
\etocsettagdepth {overview} {part}
\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {section}
+\etocsettagdepth {examples} {section}
+\etocsettagdepth {surprising} {part}
\etocsettagdepth {linestyles} {part}
\etocsettagdepth {globalcmds} {part}
\etocsettagdepth {custom} {section}
@@ -3931,8 +3813,17 @@ appears \vpageref{toc:mindmap}.
\end{tikzpicture}}}
\end{figure}
\endgroup
-\end{verbatim}
+\end{filecontentsdef}
+\filecontentsexec\foo
+
+It is difficult to get everything to fit on one page. However \csa{resizebox}
+comes to the rescue. And it preserves hyperlinks. Nevertheless for this
+example I excluded some sections from the display, using the technique of the
+\etoc \hyperref[etocdepthtag.toc]{depth tags}. The fully hyperlinked TOC
+appears \vpageref{toc:mindmap}.
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
An interesting alternative is to use \etoc rather to convert the entire TOC
into a TikZ tree (perhaps excluding some parts) and print it out to a file
from which it can be recovered and manipulated directly by the author of the
@@ -3981,44 +3872,7 @@ conditions and a few caveats:
Here is an example of a TOC as a |longtable|, as is possible relatively
simply now with |1.08|. The code follows.
-\begingroup
-\etocglobaldefs % necessary for \etocthename etc... to survive &
-
-% observe the locations of the \\
-\etocsetstyle{part}
- {}
- {\\\hline}
- {\strut\etocnumber &\bfseries\etocname &\etocpage }
- {}
-
-\etocsetstyle{section}
- {}
- {\etociffirst{\etocifnumbered{\\\hline}{\\\hline\hline}}{\\}}
- {\etocnumber&\etocname &\etocpage }
- {}
-
-\etocsetstyle{subsection}
- {}
- {\\}
- {&\makebox[1cm][c]{\etocnumber}%
- \parbox[t]{\dimexpr6cm-\tabcolsep\relax}{\sloppy\itshape\etocname\strut}%
- &\itshape\etocpage }
- {}
-
-\etocsettocstyle
- {\hypersetup{hidelinks}%
- \begin{longtable}{|>{\bfseries}c|p{7cm}|r|}
- \hline
- \multicolumn{3}{|c|}{\Large\bfseries\strut\MakeUppercase{\contentsname}}%
- }
- {\\\hline\end{longtable}}
-
-\etocsetnexttocdepth {subsection}
-
-\tableofcontents
-\endgroup
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}-A.tex}{\foo}
\begingroup
\etocglobaldefs % necessary for \etocname etc... to survive &
@@ -4055,8 +3909,12 @@ simply now with |1.08|. The code follows.
\tableofcontents
\endgroup
-\end{verbatim}
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}-A.tex}
Examining the code above the reader will wonder why the |\\| are
always given first in \meta{prefix+contents} and not, as is more
intuitive, rather last. In some favorable cases (but almost never
@@ -4101,29 +3959,7 @@ For the hardliner's old way of obtaining the exact same result, see
Here is also a much simpler example. It is a local table of
contents.
-\begin{center}
-\etocsetstyle{section}
- {}
- {\etociffirst{\\\hline\hline}{\\\hline}}
- {\etocname&
- \etocnumber&
- \etocpage }
- {}
-
-\etocsettocstyle
- {\hypersetup{hidelinks}\begin{tabular}{|p{4cm}|c|c|}\hline
- \multicolumn{1}{|c|}{\bfseries Section}&
- \bfseries number&
- \bfseries page}
- {\\\hline\end{tabular}}
-
-\etocglobaldefs % MANDATORY !!
-\etocsetnexttocdepth{1}
-
-\tableofcontents\ref{toc:overview}
-\end{center}
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}-B.tex}{\foo}
\begin{center}
\etocsetstyle{section}
{}
@@ -4143,95 +3979,12 @@ contents.
\tableofcontents\ref{toc:overview}
\end{center}
-\end{verbatim}
-
-\subsection{The commands \csbhyp{etocglobaldefs} and \csbhyp{etoclocaldefs}}
-\label{etocglobaldefs}
-\label{etoclocaldefs}
-
-In \LaTeX{} the meaning of a command defined via |\newcommand\foo{...}| inside
-an environment (or group) vanishes from \TeX's memory on exit from this
-environment (or group). At times however it is needed to make definitions with
-global scope, for this \TeX{} has the primitive prefix |\global|.
-
-By default \etoc's definitions of \csb{etocname} etc... are local. This causes
-problems in certain contexts such as seen here with TOC as tables, but also
-with |enumitem| \emph{inline} variants of its standard environments, because
-the command |\item| then closes a group.
+\end{filecontentsdef}
-After \csb{etocglobaldefs}, \etoc will make its definitions of \csb{etocname}
-etc... have global scope. For normal use this is not necessary. It does not hurt
-either to activate it systematically.
-
-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 \csbhyp{etocchecksemptiness} command}
-\label{etocchecksemptiness}
-
-The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check whether
-local tables of contents are empty and in case of emptiness to print nothing
-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|).
+\filecontentsexec\foo
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}-B.tex}
\section{A TOC self-adjusting widths for its typesetting}
\label{sec:thirdexampleextra}
@@ -4239,8 +3992,9 @@ of contents to be empty (for that run) and thus printed nothing (not even a
This is a continuation of \autoref{sec:thirdexample}. The goal is to adjust
automatically the ``numwidths'' used for typesetting the unit numbers in the
(local) tables of contents.
-\begin{verbatim}
-\newcommand*\TOCcomputenumwidths [1][]{% #1=empty or "local"
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\makeatletter
+\newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent
\begingroup
\def\TOCnumwidthB {0pt}%
\def\TOCnumwidthC {0pt}%
@@ -4250,22 +4004,22 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the
\def\TOCnumwidthG {0pt}%
\etocsetstyle{part}{}{}{}{}%
\etocsetstyle{chapter}{}
- {\setbox0\hbox{\bfseries\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthB\edef\TOCnumwidthB{\the\wd0}\fi}{}%
\etocsetstyle{section}{}
- {\setbox0\hbox{\bfseries\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthC\edef\TOCnumwidthC{\the\wd0}\fi}{}%
\etocsetstyle{subsection}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthD\edef\TOCnumwidthD{\the\wd0}\fi}{}%
\etocsetstyle{subsubsection}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthE\edef\TOCnumwidthE{\the\wd0}\fi}{}%
\etocsetstyle{paragraph}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthF\edef\TOCnumwidthF{\the\wd0}\fi}{}%
\etocsetstyle{subparagraph}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthG\edef\TOCnumwidthG{\the\wd0}\fi}{}%
%
\etocsettocstyle{}
@@ -4285,29 +4039,45 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the
\typeout{Next TOCs will use \TOCnumwidthG\space for subparagraph number width}%
\endgroup
}%
-\end{verbatim}
-One invokes either only once \csa{TOCcomputenumwidths} (with
-a prior |\etocsetnexttocdepth{all}|) or, alternatively multiple times,
-using the optional argument:
+\newcommand*\TOCcomputenumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {}{#1}%
+}%
+\newcommand*\TOCcomputelocalnumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {local}{#1}%
+}%
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
+The optional parameter to \csa{TOCcomputenumwidths} specifies the minimal
+indent. In case nothing is numbered you may wish a higher value than |0.5em|.
+For each local table of contents to have its own width computations, the macro
+\csa{TOCcomputelocalnumwidths} is provided. As the code makes global
+assignments, either use (once) \csa{TOCcomputenumwidths} or do
+\csa{TOCcomputelocalnumwidths} for each local table of contents.
\begin{verbatim}
-\bgroup
- \etocsettocdepth{paragraph}% for example
- \TOCcomputenumwidths [local]%
+ \TOCcomputelocalnumwidths % may use optional argument to replace 0.5em
\localtableofcontents
-\egroup
\end{verbatim}
-Then each local table of contents will compute the various ``numwidths'' to
-match exactly (with an extra |0.5em|), for each sectioning unit (apart from
-|\part| as it has no associated ``numwidth'' in the table of contents code of
-the |book| class), the widest number found. As the code makes global
-assignments, it is either to be used only once, or for each local table of
-contents. Notice that the bold font serves for both chapter and section
-styles, but the code from \autoref{sec:thirdexample} does not use bold for
-sections in the global TOC, only in local TOCs. Thus the
-\csa{TOCcomputenumwidth} will set the parameter \csa{TOCnumwidthC} to a value
-slightly larger than needed in the main TOC. Hence the section style in
-\csa{TOCcomputenumwidths} should possibly insert the |\bfseries| in the box
-only after testing for the optional parameter |local|.
+Notes:
+\begin{enumerate}[nosep]
+\item naturally these are only suggestions. For example one could put
+ everything in single macros \csa{TOCtoc} and \csa{TOClocaltoc} to
+ simultaneously compute the numwidths and then typeset the (local) table of
+ contents.
+\item if you want to adjust the |tocdepth| recall from
+ \autoref{ssec:bookmarksdepth} that it influences |hyperref| hence you may
+ need to use a group |\begingroup...\endgroup|. Or, one can use
+ \csb{etocsetnexttocdepth}\marg{level} but (with the code as here) this must
+ then be issued twice, once for \csa{TOCcomputelocalnumwidths}, once for
+ \csa{localtableofcontents}.
+\item the bold font serves above for both chapter and section numwidth
+ computations, but the code from \autoref{sec:thirdexample} uses |\bfseries|
+ only in local TOCs. Thus the \csa{TOCcomputenumwidth} will set the parameter
+ \csa{TOCnumwidthC} to a value slightly larger than needed in the main TOC.
+ Hence the section style in \csa{TOCcompute@numwidths} should possibly insert
+ the |\bfseries| in the box only after testing for the optional parameter
+ |local|.
+\end{enumerate}
\clearpage
\etocdepthtag.toc {linestyles}
@@ -4379,7 +4149,7 @@ obtained in the following manner:%
\csa{rmfamily} instead.}
\begingroup\small
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocsetstyle{section}
{\begin{enumerate}}
{\normalsize\bfseries\rmfamily\item}
@@ -4398,7 +4168,8 @@ obtained in the following manner:%
{\allowbreak\,--\,}
{\etocname}
{.\hfil\par\endgroup\pagebreak[3]}
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\endgroup
These provisory style definitions rely on the automatic
@@ -4578,8 +4349,10 @@ The \csa{etocthename} macro has
been mentioned before; using it in instructions such as
|\global\let\lastone\etocthename| in an \etoc line style will
define the macro |\lastone| to expand to the last name seen at the
-corresponding level. But no facilities was previously available to
-do the same with the link data.
+corresponding level.
+
+% But no facilities was previously available to
+% do the same with the link data.
The package provides since |1.07f 2013/03/07| \csa{etocthelinkedname} to do
the similar thing, with the link data included. It was used in this
@@ -4590,8 +4363,13 @@ Also provided with the similar goal: \csa{etocthelinkednumber},
added one to the page number) and \csa{etocthelink}\marg{linkname}
which allows to make a link with an arbitrary name.
-All these commands are fragile. In fact starting with |1.08a|, \csa{etocname}
-is exactly the robust variant of \csa{etocthelinkedname}.
+All these commands are fragile.
+
+% je supprime car suggère qu'avant pas robuste, ce qui n'est pas ce que je
+% voulais dire.
+
+% In fact starting with |1.08a|, \csa{etocname}
+% is exactly the robust variant of \csa{etocthelinkedname}.
Obsolete example of \begingroup
\etocsetstyle {section}
@@ -4626,7 +4404,8 @@ Obsolete example of \begingroup
\endgroup
\end{verbatim}
-\etoc |1.08a| offers a simpler way to the same result. And there is no need
+\etoc |1.08a| offers a simpler way to the same result: thanks to
+\csb{etocglobaldefs} there is no need
anymore here for \csa{etocthelinkedname}, \csa{etocname} works.
\begin{verbatim}
Example of
@@ -4703,7 +4482,7 @@ These level assignments can be modified at anytime: see
technique. As one
further example, let's mention here that the \hyperref[toc:main]{main table of
contents} of this document was typeset following these instructions:
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocsettocdepth {subsubsection} % set the initial tocdepth
\etocdefaultlines % use the package default line styles. At this early stage in
% the document they had not yet been modified by \etocsetstyle
@@ -4719,7 +4498,8 @@ contents} of this document was typeset following these instructions:
\etocsetlevel{subsubsection}{4} % anything > tocdepth=3.
\tableofcontents \label{toc:main}
\endgroup
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
In this way, the subsections used the style originally designed for
subsubsections, the subsubsections were not printed. Without this modification,
the appearance would have been very different: the package line styles were
@@ -5099,178 +4879,11 @@ There are also (independently of the document class)
\csb{etocaftertochook} which are initially defined to do nothing and can be
used for some special effects.
-\section{Table of contents for this part}
-
-
-\subsection{Testing the compatibility mode}
-
-As a third example we now print the local table of contents
-for this part. First we will test the compatibility mode.\footnote{the
-present document uses the |scrartcl| class, and we check here that
-the \etoc compatibility mode does respect the customizing done via the
-class commands.} The original was invisibly defined with a label at the
-beginning of this \autoref{part:globalcmds}.
-\begin{verbatim}
-\KOMAoptions{toc=left}
-\etocstandarddisplaystyle % necessary for the display to obey toc=left
-\etocstandardlines
-\tableofcontents \ref{toc:globalcmds}
-\end{verbatim}
-\KOMAoptions{toc=left}
-\etocstandarddisplaystyle
-\etocstandardlines
-\tableofcontents \ref{toc:globalcmds}
-
-\subsection{A framed display}
-
-We now opt for a ``framed'' style, using the package default
-line styles and some colors added (it has been put in a float which appears
-\vpageref{toc:b}).
-
-%
-% (13 octobre 2013)
-% \footnote{inside the |figure| environment and before the
-% framed toc, which uses |multicols|, we added \csa{normalcolor} as work-around
-% to an interaction bug (related to the \csa{color\{red\}} command we added to
-% the |.toc| file) between |multicols|, |color| and the |figure|
-% environment. This bug has nothing to do with \etoc.}
-% RETIRÉ le 28 avril 2015 pour 1.08f
-
-\begin{verbatim}
-\etocdefaultlines
-\begingroup
-\renewcommand{\etoccolumnsep}{2em}
-\renewcommand{\etocinnerleftsep}{1.5em}
-\renewcommand{\etocinnerrightsep}{1.5em}
-% specify a background color for the toc contents
-\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
-% set up the top and bottom rules
-\renewcommand{\etoctoprule}{\hrule height 1pt}
-\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
-\renewcommand{\etocbottomrule}{\hrule height 1pt}
-\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
-% set up the left and right rules
-\renewcommand{\etocleftrule}{\vrule width 5pt}
-\renewcommand{\etocrightrule}{\vrule width 5pt}
-\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
-\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
-% use \fcolorbox to set up a colored frame for the title
-\fboxrule1pt
-\renewcommand{\etocbelowtocskip}{0pt\relax}
-\etocframedstyle {\normalsize\rmfamily\itshape
- \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
- This is a table of contents \`a la \etoc, but just for
- the sections and subsections in this part. As it is put
- in a frame, it has to be small enough to fit on
- one page. It has the label |toc:b|.}}}
-\begin{figure}[ht!]
- \centering
-\tableofcontents \label{toc:b} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
-\end{verbatim}
-
-
-\etocdefaultlines
-\begingroup
-\renewcommand{\etoccolumnsep}{2em}
-\renewcommand{\etocinnerleftsep}{1.5em}
-\renewcommand{\etocinnerrightsep}{1.5em}
-% specify a background color for the toc contents
-\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
-% set up the top and bottom rules
-\renewcommand{\etoctoprule}{\hrule height 1pt}
-\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
-\renewcommand{\etocbottomrule}{\hrule height 1pt}
-\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
-% set up the left and right rules
-\renewcommand{\etocleftrule}{\vrule width 5pt}
-\renewcommand{\etocrightrule}{\vrule width 5pt}
-\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
-\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
-% use \fcolorbox to set up a colored frame for the title
-\fboxrule1pt
-\renewcommand{\etocbelowtocskip}{-.5\baselineskip\relax}
-\etocframedstyle {\normalsize\rmfamily\itshape
- \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
- This is a table of contents \`a la \etoc, but just for
- the sections and subsections in this part. As it is put
- in a frame, it has to be small enough to fit on
- one page. It has the label |toc:b|.}}}
-\begin{figure}[ht!]
- \centering
-%\normalcolor % work-around to a bug involving color and multicols (and figure)
-\tableofcontents \label{toc:b} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
-
-% Il y a un color leak du framed mais uniquement lorsqu'il est mis dans le
-% float. 2013/10/13, qui révèle un bug (?? NON) du style framed je vais regarder
-% mais bon. Le leak apparaît avec ruled aussi, et même avec juste multicolstyle
-% MAIS PAS EN UNE SEULE COLONNE (même framed ou ruled). il semble qu'il y aie
-% donc un problème d'interaction avec multicol là. à voir. Pas le temps
-% maintenant.
-
-% 2013/10/14
-% il s'agit en fait d'un bug de color+multicols+figure qui n'a rien à voir avec
-% etoc:
-% http://tex.stackexchange.com/questions/138783/color-leak-from-multicols-within-a-figure
-% J'ai trouvé le work-around qui consiste simplement à ajouter un \normalcolor
-% _avant_ le multicols à l'intérieur de figure
-
-\subsection{A (crazy) inline display}
-
-Let us finally make some crazy inline display of the table of
-contents of this entire document. We will typeset the subsections as
-footnotes... This kind of style is suitable for a hyperlinked
-document, probably not for print! (although I like it, but my personal tastes in
-many matters do not seem to be widely shared).
-
-%%%% Note: 27 april 2014
-
-%%%% except for a miraculous situation depending from the quantity of previous
-%%%% material this TOC will have links extending accross pagebreaks, which
-%%%% dvipdfmx does not know how to handle completely. Apart from that the output
-%%%% is ok, thus no need to try seriously to avoid them.
-
-\begingroup
-\newsavebox{\forsubsections}
-\etocsetstyle{part}{\upshape. \etocskipfirstprefix}{. \upshape}{\bfseries\etocname:~~}{}
-\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }{\mdseries\etocname}{}
-\etocsetstyle{subsection}
- {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
- {; }
- {\etocname}
- {\end{lrbox}\footnote{\unhbox\forsubsections.}}
-\etocsetstyle{subsubsection}{ (\itshape\etocskipfirstprefix}
- {, }{\etocname}{\/\upshape)}
-\etocsettocstyle{Here is the inline table of contents. }{.\par}
-\tableofcontents \label{toc:crazyinline}
-\endgroup
-
-The code used:
-\begin{verbatim}
-\begingroup
-\newsavebox{\forsubsections}
-\etocsetstyle{part}{\upshape. \etocskipfirstprefix}{. \upshape}
- {\bfseries\etocname:~~}{}
-\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }
- {\mdseries\etocname}{}
-\etocsetstyle{subsection}
- {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
- {; }{\etocname}{\end{lrbox}\footnote{\unhbox\forsubsections.}}
-\etocsetstyle{subsubsection}
- { (\itshape\etocskipfirstprefix}{, }{\etocname}{\/\upshape)}
-\etocsettocstyle{Here is the inline table of contents. }{.\par}
-\tableofcontents
-\endgroup
-\end{verbatim}
-
\clearpage
\etocdepthtag.toc {custom}
-\part{Using and customizing \etoc}
+\part{Using and customizing the \etoc own styles}
\label{part:custom}
\thispartstats
@@ -5421,7 +5034,7 @@ medium series; we modify the \csa{etocfontone} command for that. Also we use dot
leaders which are less spread out than in the package default.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
\fbox{\parbox{.6\linewidth}{
\leftskip 0pt plus .5fil
@@ -5441,29 +5054,10 @@ leaders which are less spread out than in the package default.
\sloppy
\tableofcontents
\endgroup
-\end{verbatim}
-
-\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
- \fbox{\parbox{.6\linewidth}{
- \leftskip 0pt plus .5fil
- \rightskip 0pt plus -.5fil
- \parfillskip 0pt plus 1fil This is the global table of
- contents on two columns, using \etoc default line styles, but with
- sections as chapters, and subsections as sections.
- }}}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
-\etocdefaultlines
-\etocsetnexttocdepth{1}
-
-\begingroup
-\etocsetlevel{section}{0}
-\etocsetlevel{subsection}{1}
-\renewcommand*{\etocfontone}{\normalfont \normalsize}
-\renewcommand*{\etoctoclineleaders}
- {\hbox{\normalfont\normalsize\hbox to 1ex {\hss.\hss}}}
-\sloppy
-\tableofcontents
-\endgroup
+\filecontentsexec\filecontentsheremacro
\section{Customizing \etoc}
@@ -5609,7 +5203,7 @@ this example so we included the title as part of the
\meta{start} code at section level, to get it \emph{inside}
the frame.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
\definecolor{secbackground}{RGB}{0,177,235}
@@ -5680,86 +5274,14 @@ the frame.
\etocframedstyle[1]{}
\tableofcontents \label{toc:clone} \ref{toc:globalcmds}
\endgroup
-\end{verbatim}
-
-\begingroup
-\definecolor{subsecnum}{RGB}{13,151,225}
-\definecolor{secbackground}{RGB}{0,177,235}
-\definecolor{tocbackground}{RGB}{212,237,252}
-
-\renewcommand{\etocbkgcolorcmd}{\color{tocbackground}}
-\renewcommand{\etocleftrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etocrightrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etocbottomrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etoctoprulecolorcmd}{\color{tocbackground}}
-
-\renewcommand{\etocleftrule}{\vrule width 1cm}
-\renewcommand{\etocrightrule}{\vrule width .5cm}
-\renewcommand{\etocbottomrule}{\hrule height 12pt}
-\renewcommand{\etoctoprule}{\hrule height 12pt}
-
-\renewcommand{\etocinnertopsep}{0pt}
-\renewcommand{\etocinnerbottomsep}{0pt}
-\renewcommand{\etocinnerleftsep}{0pt}
-\renewcommand{\etocinnerrightsep}{0pt}
-
-\newcommand\shiftedwhiterule[2]{%
- \hbox to \linewidth{\color{white}%
- \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#2}
-
-\etocsetstyle{subsubsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{\leftskip}{6pt}}
-{\sffamily\footnotesize
-\leftskip2.5cm\hangindent1cm\rightskip1cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
-\nointerlineskip\vskip3pt}
-{}
-
-\etocsetstyle{subsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{1.5cm}{6pt}}
-{\sffamily\small
-\leftskip1.5cm\hangindent1cm\rightskip1cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
-\nointerlineskip\vskip6pt}
-{}
-
-\newcommand{\coloredstuff}[2]{%
- \leftskip0pt\rightskip0pt\parskip0pt
- \fboxsep0pt % \colorbox uses \fboxsep also when no frame!
- \noindent\colorbox{secbackground}
- {\parbox{\linewidth}{%
- \vskip5pt
- {\noindent\color{#1}#2\par}\nointerlineskip
- \vskip3pt}}%
- \par\nointerlineskip}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
+\filecontentsexec\filecontentsheremacro
% v1.07l on the occasion of traduction into German documentation
% APRIL 26, 2014 Improvement in the section style for better placement of
% page number when the section name is more than one line long. Use of
% \makebox rather than \hbox, to be more LaTeX like.
-\etocsetstyle{section}
-{\coloredstuff{white}
- {\hfil \hyperref[toc:b]{\bfseries\large I am a twin of
- that other TOC (click me!)}\hfil}}
-{\vskip3pt\sffamily\small}
-{\coloredstuff{white}
- {\leftskip1.5cm\rightskip.5cm\parfillskip-\rightskip
- \makebox[0pt][r]{\makebox[.5cm][r]{\etocnumber\hspace{.2cm}}}%
- \etocname\hfill\makebox[.5cm][r]{\etocpage\hspace{.2cm}}}%
- \vskip6pt }
-{}
-
-\etocframedstyle[1]{}
-
-\begin{figure}[ht!]\centering
- \tableofcontents \label{toc:clone} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
The TOC has been put in a \hyperref[toc:clone]{float} which appears
\vpageref{toc:clone}. The coding is a bit involved\footnote{and reveals the
@@ -5866,7 +5388,6 @@ this technique):
\etocmulticol[3]{\subsection{All subsections of this document}\label{toc:allsubsections}}
-
\endgroup
\section{Displaying statistics}\label{ssec:statistics}
@@ -5887,7 +5408,7 @@ arises, one must switch from using boxes to using macros, and store the
\autoref{sec:molecule}. We present also this second method.
But first, the code of \csa{thispartstats}:\par
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
\newsavebox\firstnamei \newsavebox\firstnumberi
\newsavebox\lastnamei \newsavebox\lastnumberi
\newsavebox\firstnameii \newsavebox\firstnumberii
@@ -5931,11 +5452,11 @@ But first, the code of \csa{thispartstats}:\par
\localtableofcontents % to be used at the top level of a Part.
\endgroup
}
-\end{verbatim}
-
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
And now, the variant with macros rather than boxes (this variant as it
stands here is for using within a section).
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
\makeatletter
\newcommand*\firstsubname {} \newcommand*\lastsubname {}
\newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {}
@@ -5963,7 +5484,8 @@ stands here is for using within a section).
\endgroup
}
\makeatother
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
\section{Using depth tags}
\label{ssec:tocwithdepthtags}
@@ -5989,84 +5511,19 @@ underneath the numbers contrarily to the code from
lengths (now that this has been done once, it can be recycled easily) we
get:
-\etocsetnexttocdepth {all}
-\begingroup
-\parindent 0pt
-\leftskip 0cm
-\rightskip 0.75cm
-\parfillskip -\rightskip
-\newcommand*{\EndParWithPagenoInMargin}
- {\nobreak\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
- \par}
-\renewcommand*\etoctoclineleaders
- {\hbox{\normalfont\normalsize\hbox to .75ex {\hss.\hss}}}
-\newcommand*{\EndParWithPagenoInMarginAndLeaders}
- {\nobreak\leaders\etoctoclineleaders\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
- \par }
-\etocsetstyle {part}
- {}
- {\leavevmode\leftskip 1cm\relax}
- {\bfseries\large\llap{\makebox[1cm][r]{\etocnumber\ \ }}%
- \etocname\EndParWithPagenoInMargin\smallskip}
- {}
-\etocsetstyle {section}
- {}
- {\leavevmode\leftskip 1.75cm\relax}
- {\bfseries\normalsize\llap{\makebox[.75cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {subsection}
- {}
- {\leavevmode\leftskip 2.75cm\relax }
- {\mdseries\normalsize\llap{\makebox[1cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {subsubsection}
- {}
- {\leavevmode\leftskip 4cm\relax }
- {\mdseries\normalsize\llap{\makebox[1.25cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {paragraph}
- {}
- {\leavevmode\leftskip 5.5cm\relax }
- {\mdseries\normalsize\llap{\makebox[1.5cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {part}
-\etocsettagdepth {linestyles} {part}
-\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}}
-\renewcommand\etocaftercontentshook
- {\medskip\begingroup \color{blue}\hrule height 3pt \endgroup }
-\etocruledstyle [1]{\Large\bfseries
- \fbox{\makebox[8cm]{A TOC using depth tags}}}
-\sloppy
-\tableofcontents
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\etocsetnexttocdepth {all}
\begingroup
\parindent 0pt \leftskip 0cm \rightskip .75cm \parfillskip -\rightskip
\newcommand*{\EndParWithPagenoInMargin}
{\nobreak\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
+ \makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
\par}
\renewcommand*\etoctoclineleaders
{\hbox{\normalfont\normalsize\hbox to .75ex {\hss.\hss}}}
\newcommand*{\EndParWithPagenoInMarginAndLeaders}
{\nobreak\leaders\etoctoclineleaders\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
+ \makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
\par }
\etocsetstyle {part}
{}
@@ -6100,13 +5557,14 @@ get:
{}
\etocsettagdepth {preamble} {none}
\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {part}
-\etocsettagdepth {linestyles} {part}
+%\etocsettagdepth {arbitrarily}{part}% not needed explicitely, keeps value
+%\etocsettagdepth {examples} {part}
+%\etocsettagdepth {surprising} {part}
+%\etocsettagdepth {linestyles} {part}
\etocsettagdepth {globalcmds} {paragraph}
\etocsettagdepth {custom} {part}
-\etocsettagdepth {tips} {part}
-\etocsettagdepth {etocandworld}{part}
+%\etocsettagdepth {tips} {part}
+%\etocsettagdepth {etocandworld}{part}
\etocsettagdepth {code} {none}
\renewcommand\etoctoprule {\hrule height 3pt\relax }
\renewcommand\etoctoprulecolorcmd {\color{blue}}
@@ -6117,8 +5575,12 @@ get:
\sloppy
\tableofcontents
\endgroup
-\end{verbatim}
-\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{Typesetting the TOC as a table (the old way)}
\label{ssec:tocastableold}
@@ -6156,7 +5618,7 @@ external macros inserted in the |.toc| file by other packages.
Note: rather than |\toks| registers it would be easier here to use \eTeX{}
\csa{unexpanded} primitive. See for example \autoref{sec:mindmap}.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\newtoks\toctabletok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}}
@@ -6203,7 +5665,8 @@ Note: rather than |\toks| registers it would be easier here to use \eTeX{}
\tableofcontents
\the\toctabletok
\endgroup
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\clearpage
\etocdepthtag.toc {etocandworld}
@@ -6479,7 +5942,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
{% define the section node
\edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
\unexpanded\expandafter{\etocthelinkedname}}}}%
- \appendtotok\parttok\childnode }
+ \ifnum\value{partco}<9 \appendtotok\parttok\childnode \fi}
{}
\etocsetnexttocdepth{section}
@@ -6488,7 +5951,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
{\setcounter{partco}{0}%
\treetok{\node [root concept]{\normalfont{Das \etoc-Paket}\par {\normalsize\textsc
{Jean-François Burnol}\par \ttfamily jfbu (at) free (dot) fr}\par
- {\normalsize Paketversion:\par \etocDEpkgversion{} (\etocDEpkgdate )\par}}}}
+ {\normalsize Paketversion:\par \etocpkgversion{} (\etocDEpkgdate )\par}}}}
{\global\appendtotok\treetok{ ;}}
\etocinline\tableofcontents\label{toc:mindmaptitlepage}
@@ -6511,11 +5974,11 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
concept color=orange!60,
root concept/.append style={font=\huge, text width = 6cm},
% geändert 2015/11/12 6cm->7cm
- level 1/.append style={level distance=7cm, sibling angle=360/9},
+ level 1/.append style={level distance=7cm, sibling angle=360/10},
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.25cm},% 2.57cm
+ distance=2.37cm},% 2.57cm
]
\the\treetok
\end{tikzpicture}}\endgroup }
@@ -6538,14 +6001,41 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\etoctoclines
\etocmarkboth\contentsname
\etocmulticolstyle[1]
- {\pdfbookmark[1]{Inhaltsverzeichnis}{MAINTOC}%
- \noindent\bfseries\Large
+ {\noindent\bfseries\Large
\leaders\hrule height1pt\hfill
\MakeUppercase{Inhaltsverzeichnis}\let\thefootnote\empty
-\footnote{Erzeugt von der Quelldatei mit Zeitstempel ``\etocdtxtimestamp''.\par
- Übersetzt ins Deutsche von Felix Baral-Weber, Jenny Rothkrämer-Vogt, Daniel
- Büttner, Claudia Dahl, Christian Otto und Christine Römer (FSU Jena).
- Hinweise zur Übersetzung an Christine\_Roemer at t-online dot de.}\setcounter{footnote}{0}}
+ \footnote{Erzeugt von der Quelldatei mit Zeitstempel
+ ``\etocdtxtimestamp''.}\setcounter{footnote}{0}}
+
+\pdfbookmark[1]{Inhaltsverzeichnis}{MAINTOC}%
+
+\begin{otherlanguage}{english}
+\begin{framed}
+ Übersetzt ins Deutsche von Felix Baral-Weber, Jenny Rothkrämer-Vogt,
+ 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
+ Übersetzung an Christine\_Roemer at t-online dot de.
+
+\medskip
+
+ Starting with |1.08h|, about 25 code samples (especially the longer
+ ones) are incorporated into the PDF file (thanks to \textsc{Scott
+ Pakin}'s \href{http://www.ctan.org/pkg/attachfile}{attachfile}
+ package) as \emph{file attachement annotations}. Each file is represented
+ by an icon after the verbatim rendering of the corresponding code.
+ Clicking suitably on the icon will open a dialog to open or save the
+ file contents. This is much better than copy-paste which loses
+ indentation. There is also in some viewer a \emph{Comment pane} which can
+ be opened on the right side of the main window and which provides a
+ convenient clickable list of all these \emph{attachments annotations}.
+
+ PDF viewers unable to make these attachments accessible to the
+ user may replace the clickable icons by some blank space.
+\end{framed}
+\end{otherlanguage}
+
\begingroup
\etocsetlevel{subsection}{3}
\etocsetlevel{subsubsection}{6}
@@ -6666,6 +6156,11 @@ Die Methode wird \hyperref[sec:firstexample]{später}
Code kann man hier (\autoref{ssec:tocwithdepthtags}) finden, die Nachahmung des
Standardaussehens einer Inhaltsangabe.
+\begin{otherlanguage}{english}
+ An even closer emulation of the |book| class design is now included in
+ this documentation as \autoref{sec:thirdexample}.
+\end{otherlanguage}
+
Wie Sie beim Lesen dieser Anleitung noch sehen werden, ist \etoc
ziemlich vielfältig (ganz besonders, weil es erlaubt, die Hierarchie jeder
unterteilenden Einheit des Dokuments zu re-definieren) und man kann damit
@@ -6711,12 +6206,14 @@ könnte neben den Informationen zum Stil einige andere Befehle
beinhalten, die Probleme hervorrufen können
(\LaTeX -Umgebungen schaffen Gruppen.).
-Darum machen die eingebauten "`Zeilenstile"' (line styles), wie sie von \etoc
-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}
-\texttt{enumerate}-Umgebungen, um Zeilenstile anzugeben.
+Darum machen die eingebauten "`Zeilenstile"' (line styles), wie sie von
+\etoc 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}, die in \autoref{toc:allsubsections} und auch
+die in \autoref{etocthelink}, \texttt{enumerate}- oder
+\texttt{itemize}-Umgebungen, um Zeilenstile anzugeben.
\section{Zeilenstile und Stile der Inhaltsangabe (toc display style)}
@@ -6839,18 +6336,8 @@ Und da wir |\invisible...|,\footnote{Das ist eine Abkürzung, um die |tocdepth|
Überschrift nicht auszugeben.} benutzt haben, existiert die lokale
Inhaltsangabe nur durch seine Klone anderswo im Dokument.
-Anhand von \csb{etocdefaultlines} oder dem Stil der Standard"=Dokumentklasse,
-anhand von \csb{etocstandardlines}, könnten wir auch die Zeilenform benutzen,
-die von \etoc definiert wird. Hier waren wir jedoch ein wenig ehrgeiziger und
-wollten unser eigenen Stil anlegen. Die Technik ist einfach: Jede Überschrift
-ist an sich ein eigener Paragraph, der sich über mehrere Zeilen erstrecken kann;
-es ist für seinen |\leftskip| selbst verantwortlich.
-
-\begingroup
-\parindent 0pt
-\parfillskip 0pt
-\leftskip 0cm
-\rightskip 1cm
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
\etocsetstyle {section}
{}
{\leavevmode\leftskip 0cm\relax}
@@ -6872,10 +6359,20 @@ es ist für seinen |\leftskip| selbst verantwortlich.
\etocname\nobreak\hfill\nobreak
\rlap{\makebox[1cm]{\etocpage}}\par}
{}
-\etocruledstyle[1]{\bfseries \Large Mein erstes \etoc: TOC von
+\etocruledstyle[1]{\bfseries \Large My first \etoc: TOC von
\autoref{part:overview} (\nameref{part:overview})}
\tableofcontents \ref {toc:overview}
\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+
+Anhand von \csb{etocdefaultlines} oder dem Stil der Standard"=Dokumentklasse,
+anhand von \csb{etocstandardlines}, könnten wir auch die Zeilenform benutzen,
+die von \etoc definiert wird. Hier waren wir jedoch ein wenig ehrgeiziger und
+wollten unser eigenen Stil anlegen. Die Technik ist einfach: Jede Überschrift
+ist an sich ein eigener Paragraph, der sich über mehrere Zeilen erstrecken kann;
+es ist für seinen |\leftskip| selbst verantwortlich.
Dieses ist ein einfaches Design, das keine Maßnahmen zum Zeilenumbruch
bereitstellt. Diese sollten zwischen Abschnitten und Unterabschnitten, etc.
@@ -6895,34 +6392,10 @@ erlauben mehrzeilige Überschriften und nutzen einer Technik, die Seitenzahlen
mit dem richtigen Seitenabstand auszugeben. Dieses wurde von der Funktionsweise
von Makros aus \LaTeX2e's |\@dottedtocline| inspiriert.
-\begin{verbatim}
-\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
-\etocsetstyle {section}
- {}
- {\leavevmode\leftskip 0cm\relax}
- {\bfseries\normalsize\makebox[.5cm][l]{\etocnumber.}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\mdseries\etocpage}}\par}
- {}
-\etocsetstyle {subsection}
- {}
- {\leavevmode\leftskip .5cm\relax }
- {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\etocpage}}\par}
- {}
-\etocsetstyle {subsubsection}
- {}
- {\leavevmode\leftskip 1.5cm\relax }
- {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
- \etocname\nobreak\hfill\nobreak
- \rlap{\makebox[1cm]{\etocpage}}\par}
- {}
-\etocruledstyle[1]{\bfseries \Large My first \etoc: TOC von
- \autoref{part:overview} (\nameref{part:overview})}
-\tableofcontents \ref {toc:overview}
-\endgroup
-\end{verbatim}
+Hier der Code:
+
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{Ein zweites Beispiel}
\label{sec:secondexample}
@@ -6934,57 +6407,7 @@ Dieses zweite Beispiel zeigt nur den Inhalt von \autoref{part:linestyles} und
das von der \hyperref[toc:main]{Hauptinhaltsangabe}, obwohl die Zeilenstile ganz
anders programmiert sind.
-\begingroup
-\newcommand*{\DotsAndPage}
-{\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}%
- \hfill\nobreak
- \makebox[\rightskip][r]{\bfseries\normalsize\etocpage}\par}
-
-\etocsetstyle {part}
-{\parindent 0pt
- \nobreak
- \etocskipfirstprefix}
-{\pagebreak[3]\bigskip}
-{\large\rmfamily\bfseries\scshape\centering
- \etocifnumbered{Part \etocnumber{} -- }{}\etocname\par}
-{}
-
-\etocsetstyle {section}
-{\leftskip 0pt \rightskip .75cm \parfillskip-\rightskip
- \nobreak\medskip
- \etocskipfirstprefix}
-{\leftskip 0pt \rightskip .75cm \parfillskip-\rightskip
- \pagebreak[1]\smallskip}
-{\normalsize\rmfamily\bfseries\scshape
- \etocnumber. \etocname\DotsAndPage }
-{\parfillskip 0pt plus 1fil\relax }
-
-\etocsetstyle {subsection}
-{\leftskip1cm\rightskip .75cm \parfillskip 0pt plus 1fil\relax
- \nobreak\smallskip}
-{}
-{\footnotesize\sffamily\mdseries\itshape
- \etocname{} (\etocnumber, p. \etocpage). }
-{\par\medskip}
-
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {none}
-\etocsettagdepth {arbitrarily}{none}
-\etocsettagdepth {surprising} {none}
-\etocsettagdepth {linestyles} {subsection}
-\etocsettagdepth {globalcmds} {subsection}
-\etocsettagdepth {custom} {none}
-\etocsettagdepth {tips} {none}
-\etocsettagdepth {etocandworld}{none}
-\etocsettagdepth {code} {none}
-
-\etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{}
-\etocsetnexttocdepth {subsection}
-\tableofcontents
-\endgroup
-
-Der Code:
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begingroup
\newcommand*{\DotsAndPage}
{\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}%
@@ -7019,231 +6442,75 @@ Der Code:
{\par\medskip}
\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {none}
-\etocsettagdepth {arbitrarily}{none}
-\etocsettagdepth {surprising} {none}
+%\etocsettagdepth {overview} {none}% not needed explicitely, keeps value
+%\etocsettagdepth {arbitrarily}{none}
+%\etocsettagdepth {examples} {none}
+%\etocsettagdepth {surprising} {none}
\etocsettagdepth {linestyles} {subsection}
-\etocsettagdepth {globalcmds} {subsection}
+%\etocsettagdepth {globalcmds} {subsection}
\etocsettagdepth {custom} {none}
-\etocsettagdepth {tips} {none}
-\etocsettagdepth {etocandworld}{none}
-\etocsettagdepth {code} {none}
+%\etocsettagdepth {tips} {none}
+%\etocsettagdepth {etocandworld}{none}
+%\etocsettagdepth {code} {none}
\etocsettocstyle {\centering\LARGE\textsc{\contentsname}\par\nobreak\medskip}{}
\etocsetnexttocdepth {subsection}
\tableofcontents
\endgroup
-\end{verbatim}
+\end{filecontentsdef}
-\begin{otherlanguage}{english}
-\section{Ein drittes Beispiel: emulating the book class}\label{sec:thirdexample}
+\filecontentsexec\foo
-As explained in \autoref{subs:compat}: without explicit use of an
-\csb{etocsetstyle} command the package will leave to the document class the
-hand regarding the ``toc line styles''. It is sometimes asked by users (for
-example those using \etoc for its \csb{localtableofcontents}) how to stay
-close to but not completely identical with the design implemented by the
-standard classes, such as |book|. I can recommend package |tocloft| for this,
-as it is compatible with \etoc (see \autoref{sec:kompatmitanderen}) and thus \etoc will
-obey the |tocloft| customizations (as long as no use has been made of
-\csa{etocsetstyle}). It is also possible to modify only the style for, say,
-sections and leave the parts, chapters, subsections as in the document class,
-via the technique from \autoref{sec:anothercompat}.
+Der Code:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-But for complete control, here is a translation of the |book| class code into
-\etoc lingua. It is then easy to modify the relevant lengths or adjust the
-used fonts. I thank \textsc{Denis Bitouzé} for prompting me to include this in
-the \etoc manual, as it resulted from some conversation we had about this. The
-code is not 100\% faithful to the |book| class, and particularly its rendering
-of (multi-line) non-numbered units differs (... I think, as I copied pasted as
-is the code from where I had stored it and did not do much thinking about it
-again). Some proficiency in low-level \TeX\ and \LaTeX\ macros is needed to
-understand what the code says, but for modifying fonts or some lengths such
-in-depth understanding is not needed.
+\section{Eine wunderschöne Beispielthese}
-With some extra code one can \emph{automatically adjust the widths} assigned
-to typesetting sectioning numbers in order to prevent overflows, even with for
-example \MakeUppercase{\romannumeral 38}; but this is a more advanced feature
-which I have moved to \autoref{sec:thirdexampleextra}.
+Hier ist noch ein relativ einfaches Beispiel für die Verwendung der
+Paket"=Funktionsweisen. Lassen Sie uns einige Linienstile einrichten. Wir wählen
+einen Stil für Abschnitte und Unterabschnitte, welche für die Abschnitte und
+Unterabschnitte in einem durchschnittlichen Memoirenumfang geeignet wären. Die
+Linienstilspezifikationen haben eine gewisse Redundanz für die Klarheit, und sie
+interessieren sich nicht dafür, was bei möglichen Seitenumbrüchen zu tun ist.
+Auch sind sie nicht besorgt über die potentielle mehrspaltige Nutzung.
-First we set up some lengths. I use macro registers, not real \LaTeX\ lengths.
-When using |em|'s however, this means that one must pay attention to when the
-actual dimension assignment is made, as this will then depend upon the current
-font settings. In the code below, at the location where the \csa{TOCnumwidthB}
-and \csa{TOCnumwidthC} will be used, the |1em| from their specification will
-be matched to the normal medium series font, not the bold font; this is
-deliberate so that one can compare more readily with the other dimensions;
-besides, with the \csa{TOCcomputenumwidths} from
-\autoref{sec:thirdexampleextra} these macros will actually hold a dimension
-using |pt| as dimensional unit.
-\begin{verbatim}
-% it will be easy to globally shift the TOC horizontally if needed
-\def\TOCleftmargin {0pt}
-\def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begingroup % wir starten, um eine Gruppe zu behalten
+\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
+\newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm}
-% this is for dotted leaders
-\newbox\TOCleaderbox
-\def\TOCleaderboxwidth {0.7777em}% about like what standard classes do
+\etocsetstyle{section} % wird vorgegeben, ein Kapitel zu sein
+{\addvspace{1ex}\parfillskip0pt
+ \leftskip\tocleftmargin % (bereits im Titel getan)
+ \rightskip\the\tocrightmargin plus 1fil
+ \parindent0pt\color{cyan}} % (bereits getan)
+{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
+{\llap{Chapter\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
+ \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
+{}
-% vertical spacing
-\def\TOCverysmallvskip {0pt plus .2pt}
-\def\TOCmedvskip {1em plus 1pt}
-\def\TOCbigvskip {2.25em plus 1pt}
+\etocsetstyle{subsection} % wird vorgegeben, ein Abschnitt zu sein
+{}
+{\mdseries\large\addvspace{.5ex}\leavevmode}
+{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
+ \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
+{}
-% the ``numwidths'' for typesetting the numbering of division units.
-% I don't recall exactly how (and for which fonts) these figures were chosen.
-% They quickly prove too small if using Roman numerals (as do too the book
-% class defaults indicated below which although a bit larger).
-\def\TOCnumwidthB {1.5em} % chapter
-\def\TOCnumwidthC {2.278em}% section, I think default is 2.3em
-\def\TOCnumwidthD {3.056em}% analog in standard class is 3.2em
-\def\TOCnumwidthE {3.833em}% analog in standard class is 4.1em
-\def\TOCnumwidthF {4.611em}% analog in standard class is 5em
-\def\TOCnumwidthG {5.389em}% analog in standard class is 6em
-\end{verbatim}
-The code for the ``global toc style''.
-\begin{verbatim}
-\makeatletter
-\etocsettocstyle
- {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
- \parindent\z@ \leftskip\z@skip \rightskip \z@skip
- \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
- \chapter *{\noindent\kern\TOCleftmargin\relax % uses "pt"...
- \contentsname
- \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
- \rightskip \TOCrightmargin\relax
- \parfillskip -\rightskip % or a smaller value if desired
- \leftskip \TOCleftmargin \relax }
- {\if@restonecol \twocolumn \fi\cleardoublepage}%
-\makeatother
-\end{verbatim}
-The code for the |part| and |chapter| line styles:
-\begin{verbatim}
-\makeatletter
-\etocsetstyle{part}
- {}
- {\addpenalty {-\@highpenalty}%
- \addvspace \TOCbigvskip
- \leavevmode
- {\large \bfseries % use a group to limit font change
- \interlinepenalty\@M
- \etocifnumbered{\etocnumber\hspace{1em}}{}%
- \etocname
- \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par
- \nobreak
- }
- {}
- {}
-\etocsetstyle{chapter}
- {\advance\leftskip\TOCnumwidthB\relax}
- {\addpenalty {-\@highpenalty }%
- \vskip \TOCmedvskip\relax
- \leavevmode
- {\interlinepenalty\@M
- \etocifnumbered
- {\llap{\makebox[\TOCnumwidthB][l]{\bfseries\etocnumber}}}
- {\advance\leftskip-\TOCnumwidthB\relax}%
- \bfseries\etocname
- \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
- \penalty \@highpenalty
- }
- {}
- {\advance\leftskip-\TOCnumwidthB\relax}
-\makeatother
-\end{verbatim}
-The remaining divisions share the same code, here abstracted into a macro:
-\begin{verbatim}
-\makeatletter
-\newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro
-\etocsetstyle{#1}
- {\advance\leftskip#2\relax}
- {\vskip \TOCverysmallvskip\relax
- \leavevmode
- {\interlinepenalty\@M
- \etocifnumbered
- {\llap{\makebox[#2][l]{\etocnumber}}}{\advance\leftskip-#2\relax}%
- \etocname
- \nobreak\leaders \copy\TOCleaderbox
- \hfil\makebox[-\parfillskip][r]{\etocpage}%
- \par }%
- }
- {}
- {\advance\leftskip-#2\relax}%
-}
-\makeatother
-\TOCsetlinestyle {section} {\TOCnumwidthC}
-\TOCsetlinestyle {subsection} {\TOCnumwidthD}
-\TOCsetlinestyle {subsubsection}{\TOCnumwidthE}
-\TOCsetlinestyle {paragraph} {\TOCnumwidthF}
-\TOCsetlinestyle {subparagraph} {\TOCnumwidthG}
-\end{verbatim}
-Note Bene: the code deliberately handles the non-numbered sectioning units
-unlike the way of the standard document classes (particularly regarding the
-alignment of multi-line headings.)
+\def\tmptitle{My Beautiful Thesis}
+\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
+ \leavevmode\leaders\hrule height 1pt\hfill\
+ \huge\textit{\tmptitle}\par}{\bigskip}
-In practice, typically one will want to use \csb{localtableofcontents}, hence
-we need to change a bit the global toc style for using |\section*| rather than
-|\chapter*| for example. When the time comes for these local ``minitocs'' one
-can do something like the following (of course all of that can be stored
-inside a macro, whose definition can be located in the preamble.)
+\tableofcontents \ref{toc:overview}
+\endgroup
+\end{filecontentsdef}
-For some reason this code has some hard-coded |2.25em| and |4.5em| which were
-not abstracted into macros or lengths.
+\filecontentsexec\foo
-The code inserts horizontal rules above and below the TOC contents in a
-non-separable by pagebreak way.
-\begin{verbatim}
-\makeatletter
-\etocsettocstyle
- {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
- \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
- \parindent\z@
- \dimen@ 2.25em % soon to be \leftskip
- \section *{\kern\dimen@ % \dimen@ works here by sheer luck
- \contentsname
- \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
- \parskip \z@skip
- \vspace{-1.25\baselineskip}% somewhat ad hoc
- \leftskip 2.25em
- \rightskip 4.5em
- \advance\rightskip-\TOCrightmargin\relax
- \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
- \rightskip 4.5em
- \parfillskip -\TOCrightmargin\relax }
- {\nobreak\vskip-.5\baselineskip
- \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
- \bigskip
- \if@restonecol \twocolumn \fi }
-\makeatother
-\end{verbatim}
-We then need to specify the line styles:
-\begin{verbatim}
-\makeatletter
-\etocsetstyle{section}
- {\advance\leftskip\TOCnumwidthC\relax}
- {\addpenalty \@secpenalty
- \etociffirst{}{\addvspace{\TOCmedvskip}}%
- \leavevmode
- {\interlinepenalty\@M
- \bfseries\etocifnumbered
- {\llap{\makebox[\TOCnumwidthC][l]{\etocnumber}}}
- {\advance\leftskip-\TOCnumwidthC}%
- \etocname\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
- \penalty \@highpenalty }
- {}
- {\advance\leftskip-\TOCnumwidthC\relax}
-\makeatother
-\TOCsetlinestyle {subsection} {\TOCnumwidthD}
-\TOCsetlinestyle {subsubsection}{\TOCnumwidthE}
-\TOCsetlinestyle {paragraph} {\TOCnumwidthF}
-\TOCsetlinestyle {subparagraph} {\TOCnumwidthG}
-\end{verbatim}
-As mentioned previously, this handles non-numbered (multi-line) sectioning
-units somewhat differently from what happens in the standard document classes.
-
-See \autoref{sec:thirdexampleextra} for more.
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
-\end{otherlanguage}
% \clearpage % ATTENTION 28 mars 2015
@@ -7339,6 +6606,7 @@ Inhaltsangabenstile (inklusive Titel) sind die aktuellen und der Wert von
|tocdepth| leistet Folge. Hier ein Beispiel: Die Inhaltsangabe von
\autoref{part:custom} ist innerhalb eines \hyperref[toc:d]{float}, der auf
dieser Seite erscheint: \vpageref{toc:d}.
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begin{figure}[ht!]
\centering
\begingroup
@@ -7347,26 +6615,17 @@ dieser Seite erscheint: \vpageref{toc:d}.
\renewcommand{\etocbelowtocskip}{0pt\relax}
\fboxsep1ex
\etocframedstyle [1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
- \hyperref[toc:c]{Ich bin von weit her}}}}
+ \hyperref[toc:c]{I am from far away}}}}
\tableofcontents \label{toc:d} \ref{toc:c}
\endgroup
\end{figure}
+\end{filecontentsdef}
+
+\filecontentsexec\foo
Wir benutzen dies:
-\begin{verbatim}
-\begin{figure}[ht!]
- \centering
- \begingroup
- \etocstandardlines
- \renewcommand{\etocbkgcolorcmd}{\color{green!5}}
- \renewcommand{\etocbelowtocskip}{0pt\relax}
- \fboxsep1ex
- \etocframedstyle [1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
- \hyperref[toc:c]{I am from far away}}}}
- \tableofcontents \label{toc:d} \ref{toc:c}
- \endgroup
-\end{figure}
-\end{verbatim}
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
Wichtig: Man sollte \toc|\ref{toc:d}| nicht woanders benutzen. Um wieder zu
Klonen, muss man eine Refernz zum Original"=Label benutzen: \toc|\ref{toc:c}|.
@@ -7428,7 +6687,8 @@ gigantischen Abstand nach rechts einzufügen.}
Der |tocdepth|-Zähler hat keinen Einfluss darauf, was in die |.toc|-Datei
geschrieben wird; dessen Einfluss ist ausschließlich auf das Setzen der
-Inhaltsangabe gerichtet. In der Standardklasse ist nur ein |\tableofcontents|
+Inhaltsangabe gerichtet.\footnote{In the standard classes (at least), it also influences the
+ \csa{listoftables} and \csa{listoffigures}, via \csa{@dottedtocline}.} In der Standardklasse ist nur ein |\tableofcontents|
möglich, wobei mit \etoc beliebig viele erlaubt sind. Dadurch könnte man
|tocdepth| immer und immer wieder auf einen passenden Wert ändern (der
entscheidet, wie tief die Abschnitte angezeigt werden sollen) bis die
@@ -7455,6 +6715,16 @@ Der einfachste Weg ist also, eine einfache Instanz des
dann lokal zu benutzen, wo es gebraucht wird, anhand von
\csb{etocsetnexttocdepth} vor |\tableofcontents| oder |\localtableofcontents|.
+%
+\begin{otherlanguage}{english}
+ \csa{etocsetnexttocdepth} used to modify the |tocdepth| counter immediately.
+ In case two or more such commands were issued in a row with no TOC being
+ typeset, this could break the correct restoring of the |tocdepth| counter
+ after the TOC. Starting with |1.08h|, the |tocdepth| counter is modified
+ only at the time the TOC is typeset, not earlier, thus fixing that
+ issue.\footnote{Thanks to D.B. for signaling the problem.}
+\end{otherlanguage}
+
\subsection{Die hyperref"=Option \emph{bookmarksdepth}}
\label{ssec:bookmarksdepth}
@@ -7586,6 +6856,103 @@ Nach \csb{etocignoredepthtags} werden die |.toc|-Tiefentags ignoriert
führt zu Beginn \csb{etocobeydepthtags} aus. Dieses befielt \etoc auf die
gefundenen Tags in der |.toc|-Datei zu reagieren.
+\section{Die Befehle \csbhyp{etocglobaldefs} und \csbhyp{etoclocaldefs}}
+\label{etocglobaldefs}
+\label{etoclocaldefs}
+
+In \LaTeX{} verschwindet die Bedeutung eines Befehls, definiert
+via |\newcommand\foo{...}| in einer Umgebung (oder Gruppe), vom
+\TeX-Speicher beim Austritt aus dieser Umgebung (oder Gruppe).
+Manchmal ist es jedoch erforderlich, Definitionen mit globaler
+Reichweite zu geben, für diese hat \TeX{} primitive Präfixe
+|\global|.
+
+Standardmäßig sind die \etoc-Definitionen von \csb{etocname} etc.
+\ldots{} lokal, Dies verursacht Probleme in bestimmten
+Zusammenhängen: bei TOCs als Tabellen (\autoref{sec:tocastable}, \autoref{ssec:tocastableold}), oder
+auch mit |enumitem|-\emph{inline}-Varianten der
+Standardumgebungen, weil der Befehl |\item| dann eine Gruppe
+schließt (siehe \autoref{etocthelink}).
+
+Nach \csa{etocglobaldefs} wird \etoc seine Definitionen von
+\csb{etocname} etc. \ldots{} vornehmen, sie haben eine globale
+Reichweite. Für den normalen Gebrauch ist das nicht notwendig. Es
+tut nicht weh, beides systematisch zu aktivieren.
+
+Um zur Standardeinstellung zurückzukehren, nehmen Sie
+\csa{etoclocaldefs}. Beachten Sie, dass beide,
+\csa{etocglobaldefs} and \csa{etoclocaldefs}, lokal für die
+Umgebung oder Gruppe sind, in der sie verwendet werden.
+
+\begin{otherlanguage}{english}
+\section{Not displayed empty TOCs}
+
+\subsection{The \csbhyp{etocchecksemptiness} command}
+\label{etocchecksemptiness}
+
+The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check whether
+local tables of contents are empty and in case of emptiness to print nothing
+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}
+
+
\section{Befehle zur \texorpdfstring{\texttt{.toc}}{.toc}-Datei hinzufügen}
\label{sec:addingtotoc}
@@ -7656,87 +7023,429 @@ Experimentell habe ich herausgefunden, dass die Option |hidelinks| oftmals mit
|hyperref|-Optionen der Fall).
+\clearpage
+\etocdepthtag.toc {examples}
+\part{Beispiele}\label{part:examples}
-\section{Zwei Beispiele}
+\thispartstats %% (pas de sous-section)
-\subsection{Eine wunderschöne Beispielthese}
+\etocstandardlines
+\etocsettocstyle {}{\medskip}
+\localtableofcontents
-Hier ist noch ein relativ einfaches Beispiel für die Verwendung der
-Paket"=Funktionsweisen. Lassen Sie uns einige Linienstile einrichten. Wir wählen
-einen Stil für Abschnitte und Unterabschnitte, welche für die Abschnitte und
-Unterabschnitte in einem durchschnittlichen Memoirenumfang geeignet wären. Die
-Linienstilspezifikationen haben eine gewisse Redundanz für die Klarheit, und sie
-interessieren sich nicht dafür, was bei möglichen Seitenumbrüchen zu tun ist.
-Auch sind sie nicht besorgt über die potentielle mehrspaltige Nutzung.
+\begin{otherlanguage}{english}
+ We present some additional examples. To understand all code snippets in
+ detail, one will possibly need to have first browsed through
+ \autoref{part:linestyles} and \autoref{part:globalcmds}.
+\end{otherlanguage}
+
+\section{Über\-prü\-fen des Kom\-pa\-tibilitäts\-modus}
+Als weiteres Beispiel wollen wir nun das Inhaltsverzeichnis dieses Teils setzen.
+Dazu wollen wir zuerst den Kompatibilitätsmodus testen.\footnote{Dieses
+Dokument wurde als |scrartcl| gesetzt. Wir wollen nun testen, ob
+der Kompatibilitätsmodus des \etoc"=Pakets die Anpassungen innerhalb der
+Klassenbefehle umsetzt.} Das ursprüngliche Inhaltsverzeichnis ist
+unsichtbar und wurde am Anfang von \autoref{part:globalcmds} definiert,
+wobei es mit einem Label versehen wurde.
\begin{verbatim}
-\begingroup % wir starten, um eine Gruppe zu behalten
-\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
-\newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm}
+\KOMAoptions{toc=left}
+\etocstandarddisplaystyle % wird benötigt, damit toc=left gilt
+\etocstandardlines
+\tableofcontents \ref{toc:globalcmds}
+\end{verbatim}
+\KOMAoptions{toc=left}
+\etocstandarddisplaystyle
+\etocstandardlines
+\tableofcontents \ref{toc:globalcmds}
-\etocsetstyle{section} % wird vorgegeben, ein Kapitel zu sein
-{\addvspace{1ex}\parfillskip0pt
- \leftskip\tocleftmargin % (bereits im Titel getan)
- \rightskip\the\tocrightmargin plus 1fil
- \parindent0pt\color{cyan}} % (bereits getan)
-{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
-{\llap{Chapter\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+\section{Ein weiterer Kompatibilitätsmodus}\label{sec:anothercompat}
-\etocsetstyle{subsection} % wird vorgegeben, ein Abschnitt zu sein
-{}
-{\mdseries\large\addvspace{.5ex}\leavevmode}
-{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+Wie in \autoref{subs:compat} erläutert, sagen die Befehle
+\csa{etocstandardlines} und \csa{etocstandarddisplaystyle} \etoc im
+Wesentlichen, wie man als Beobachter fungiert. Das Dokumentenklasse"=Layout für
+das Inhaltsverzeichnis wird dann gehorchen. Es gibt keine Möglichkeit, dieses
+Standard"=Layout aus dem Paket anzupassen (ändern von Schriftarten, Rändern,
+vertikalen Abständen, etc.) . Definieren Sie dazu ein Paket von dieser Funktion;
+weil entweder \etoc (vorübergehend vielleicht) im Kompatibilitätsmodus ohne
+Anpassung auf seinen Teil möglich ist oder der Benutzer hat das Layout in
+\csa{etocsetstyle}"=Befehlen angegeben (und \csa{etocsettocstyle}) ist (angeblich
+\ldots ) in der kompletten Steuerung.
-\def\tmptitle{My Beautiful Thesis}
-\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
- \leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{\tmptitle}\par}{\bigskip}
+Nun, es ist eigentlich eine Alternative. Es ist möglich, die Verwendung der
+\csa{etocsetstyle}"=Befehle zu nutzen, um einen künstlichen Kompatibilitätsmodus
+neu zu erstellen, um Effekte zu erreichen, wie die folgenden, alle Dinge
+gleichen andererseits dem Dokumentenklassen"=Standard:
+\begin{enumerate}[noitemsep]
+\item Enthält der |hyperref|-Link nur die Namen, aber nicht die Anzahl der
+ jeweils zu kapselnden Einträge der Inhaltstabellen;
+\item verwenden Sie den Dokumentenklassen"=Stil für Kapitel und Abschnitte, aber
+ ändern Sie es nur für Teilbereiche;
+\end{enumerate}
-\tableofcontents \ref{toc:overview}
-\endgroup
-\end{verbatim}
+Hier ist beschrieben, wie Sie vorgehen müssen. 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}}{}%
+ % for the scrbook or scrartcl classes:
+ \etocsetstyle{part}{}{}
+ {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ % identical in book/article/scrbook/scrartcl classes:
+ \etocsetstyle{chapter}{}{} %%% only for book and scrbook
+ {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ \etocsetstyle{section}{}{}
+ {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ \etocsetstyle{subsection}{}{}
+ {\savedsubsectionline{\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
+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
+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|).}
+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},
+dann ergibt es ein Inhaltsverzeichnis, wo die Zahlen nicht mehr verlinkt sind,
+aber die Namen noch. Oder man kann sich entscheiden, \csa{etocthename} zu
+verwenden und eine Hyperlink"=Nummer mit \csa{etocnumber} zu erhalten.
-\begingroup
-\newlength{\tocleftmargin}
-\setlength{\tocleftmargin}{5cm}
-\newlength{\tocrightmargin}
-\setlength{\tocrightmargin}{1cm}
+Hier ist ein subtiles Beispiel, wo nur geringfügig die "`sections"' modifiziert
+wurden (hinzufügen von Farbe für die Nummer und das Entfernen des
+|hyperref|-Links) und die Unterabschnitte, wie in der Standardeinstellung,
+\emph{mit Ausnahme} von einer bestimmte "`section"' im Layout komplett geändert
+wurde: \MyQuasiStandardTOC{\ref{toc:overview}} \bigskip Dieses Beispiel hat nur
+Abschnitte und Unterabschnitte und der in \csa{MyStandardTOC} verwendete Code
+war:
+% corrected section number in verbatim code: 4 not 3 (2015/03/18)
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\etocsetstyle{section}{}
+ {\ifnum\etocthenumber=4
+ \etocsetstyle{subsection}
+ {\par\nopagebreak\begingroup
+ \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
+ \parindent 0pt \normalfont\normalsize\rmfamily\itshape
+ % \columnsep1em
+ % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
+ % \begin{multicols}{2}%
+ \etocskipfirstprefix}
+ {\allowbreak\,--\,}
+ {\etocname\ \textup{(\etocnumber)}}
+ {.\par\endgroup}%
+ % {.\par\end{multicols}\end{minipage}\par\endgroup}%
+ \else
+ \etocsetstyle{subsection}
+ {}{}
+ {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}
+ {}%
+ \fi}
+ {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
+ {}%
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
+Beachten Sie die Seite mit den Kopf"=Zeichen, welche man dem Inhaltsverzeichnis
+hinzufügen kann. Abschnitte und Unterabschnitte sind genauso wie im Standard
+(mit Ausnahme der Unterabschnitte, welche von einem bestimmten
+Benutzer"=Abschnitt aus gewählt wird und bis auf die Farbe der
+Abschnittsnummern), ohne das explizit die Länge, die Schriftart oder andere
+Formatierungsanweisungen gegeben werden. Aber wir mussten die |scrartcl|-Quellen
+untersuchen, um festzustellen, was zu nehmen ist für \csa{leftskip} und
+\csa{rightskip} für unsere Nutzer-sections"=Einträge.
+
+\begin{otherlanguage}{english}
+\section{Emulating the book class}\label{sec:thirdexample}
+
+As explained in \autoref{subs:compat}: without explicit use of an
+\csb{etocsetstyle} command the package will leave to the document class the
+hand regarding the ``toc line styles''. It is sometimes asked by users (for
+example those using \etoc for its \csb{localtableofcontents}) how to stay
+close to but not completely identical with the design implemented by the
+standard classes, such as |book|. I can recommend package |tocloft| for this,
+as it is compatible with \etoc (see \autoref{sec:kompatmitanderen}) and thus \etoc will
+obey the |tocloft| customizations (as long as no use has been made of
+\csa{etocsetstyle}). It is also possible to modify only the style for, say,
+sections and leave the parts, chapters, subsections as in the document class,
+via the technique from \autoref{sec:anothercompat}.
+
+But for complete control, here is a translation of the |book| class code into
+\etoc lingua. It is then easy to modify the relevant lengths or adjust the
+used fonts. I thank \textsc{Denis Bitouzé} for prompting me to include this in
+the \etoc manual, as it resulted from some conversation we had about this. The
+code is not 100\% faithful to the |book| class, and particularly its rendering
+of (multi-line) non-numbered units differs (... I think, as I copied pasted as
+is the code from where I had stored it and did not do much thinking about it
+again). Some proficiency in low-level \TeX\ and \LaTeX\ macros is needed to
+understand what the code says, but for modifying fonts or some lengths such
+in-depth understanding is not needed.
+
+With some extra code one can \emph{automatically adjust the widths} assigned
+to typesetting sectioning numbers in order to prevent overflows, even with for
+example \MakeUppercase{\romannumeral 38}; but this is a more advanced feature
+which I have moved to \autoref{sec:thirdexampleextra}.
+
+First we set up some lengths. I use macro registers, not real \LaTeX\ lengths.
+When using |em|'s however, this means that one must pay attention to when the
+actual dimension assignment is made, as this will then depend upon the current
+font settings. In the code below, at the location where the \csa{TOCnumwidthB}
+and \csa{TOCnumwidthC} will be used, the |1em| from their specification will
+be matched to the normal medium series font, not the bold font; this is
+deliberate so that one can compare more readily with the other dimensions;
+besides, with the \csa{TOCcomputenumwidths} from
+\autoref{sec:thirdexampleextra} these macros will actually hold a dimension
+using |pt| as dimensional unit.
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+% it will be easy to globally shift the TOC horizontally if needed
+\def\TOCleftmargin {0pt}
+\def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg
+
+% this is for dotted leaders
+\newbox\TOCleaderbox
+\def\TOCleaderboxwidth {0.7777em}% about like what standard classes do
+
+% vertical spacing
+\def\TOCverysmallvskip {0pt plus .2pt}
+\def\TOCmedvskip {1em plus 1pt}
+\def\TOCbigvskip {2.25em plus 1pt}
+
+% the ``numwidths'' for typesetting the numbering of division units.
+% I don't recall exactly how (and for which fonts) these figures were chosen.
+% They quickly prove too small if using Roman numerals (as do too the book
+% class defaults even though they are a bit larger).
+\def\TOCnumwidthB {1.5em} % chapter
+\def\TOCnumwidthC {2.278em}% section, I think default is 2.3em
+\def\TOCnumwidthD {3.056em}% analog in standard class is 3.2em
+\def\TOCnumwidthE {3.833em}% analog in standard class is 4.1em
+\def\TOCnumwidthF {4.611em}% analog in standard class is 5em
+\def\TOCnumwidthG {5.389em}% analog in standard class is 6em
+
+%The code for the ``global toc style''.
+
+\newcommand*\TOCglobalstyle {%
+\etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \parindent\z@ \leftskip\z@skip \rightskip \z@skip
+ \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
+ \chapter *{\noindent\kern\TOCleftmargin\relax % uses "pt"...
+ \contentsname
+ \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}%
+ \rightskip \TOCrightmargin\relax
+ \parfillskip -\rightskip % or a smaller value if desired
+ \leftskip \TOCleftmargin \relax }
+ {\if@restonecol \twocolumn \fi\cleardoublepage}%
+%
+\etocsetstyle{part}
+ {}
+ {\addpenalty {-\@highpenalty}%
+ \addvspace \TOCbigvskip
+ \leavevmode
+ {\large \bfseries % use a group to limit font change
+ \interlinepenalty\@M
+ \etocifnumbered{\etocnumber\hspace{1em}}{}%
+ \etocname
+ \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par
+ \nobreak
+ }
+ {}
+ {}%
+%
+\etocsetstyle{chapter}
+ {\advance\leftskip\TOCnumwidthB\relax}
+ {\addpenalty {-\@highpenalty }%
+ \vskip \TOCmedvskip\relax
+ \leavevmode
+ {\interlinepenalty\@M
+ \etocifnumbered
+ {\llap{\makebox[\TOCnumwidthB][l]{\bfseries\etocnumber}}}
+ {\advance\leftskip-\TOCnumwidthB\relax}%
+ \bfseries\etocname
+ \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
+ \penalty \@highpenalty
+ }
+ {}
+ {\advance\leftskip-\TOCnumwidthB\relax}%
+%
+ \TOCsetlinestyle {section} {\TOCnumwidthC}%
+ \TOCsetlinestyle {subsection} {\TOCnumwidthD}%
+ \TOCsetlinestyle {subsubsection}{\TOCnumwidthE}%
+ \TOCsetlinestyle {paragraph} {\TOCnumwidthF}%
+ \TOCsetlinestyle {subparagraph} {\TOCnumwidthG}%
+}% end of \TOCglobalstyle
+
+% The common code for line styles is abstracted into a macro:
+
+\newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro
+\etocsetstyle{#1}
+ {\advance\leftskip#2\relax}
+ {\vskip \TOCverysmallvskip\relax
+ \leavevmode
+ {\interlinepenalty\@M
+ \etocifnumbered
+ {\llap{\makebox[#2][l]{\etocnumber}}}{\advance\leftskip-#2\relax}%
+ \etocname
+ \nobreak\leaders \copy\TOCleaderbox
+ \hfil\makebox[-\parfillskip][r]{\etocpage}%
+ \par }%
+ }
+ {}
+ {\advance\leftskip-#2\relax}%
+}
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
+Nota Bene: the code deliberately handles the non-numbered sectioning units
+unlike the way of the standard document classes (particularly regarding the
+alignment of multi-line headings.)
+
+The whole thing was encapsulated in \csa{TOCglobalstyle}, because we also want
+a \csa{TOClocalstyle} for local tables of contents which typically will want
+to use |\section*| rather than |\chapter*| and not insert page marks in the
+headers. The \csa{TOClocalstyle} is to be issued once, after the main document
+TOC, or rather before using \csa{localtableofcontents}. If one wants a full
+TOC at end of document one will naturally have to issue again
+\csa{TOCglobalstyle} there.
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\makeatletter
+\newcommand*\TOClocalstyle {%
+\etocsettocstyle
+ {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi
+ \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}%
+ \parindent\z@
+ \dimen@ 2.25em % for left indenting
+ \section *{\kern\dimen@ % use of \dimen@ works here by sheer luck
+ \contentsname
+ % un-comment this if marks are wanted:
+ %\@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}%
+ }% end of \section
+ \parskip \z@skip
+ \vspace{-1.25\baselineskip}% somewhat ad hoc
+ \leftskip 2.25em
+ \rightskip 4.5em
+ \advance\rightskip-\TOCrightmargin\relax
+ \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
+ \rightskip 4.5em
+ \parfillskip -\TOCrightmargin\relax }
+ {\nobreak\vskip-.5\baselineskip
+ \leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
+ \bigskip
+ \if@restonecol \twocolumn \fi }%
+%
\etocsetstyle{section}
-{\addvspace{1ex}\parfillskip0pt
- \leftskip\tocleftmargin
- \rightskip\the\tocrightmargin plus 1fil
- \parindent0pt\color{cyan}}
-{\bfseries\LARGE\upshape\addvspace{1ex}\leavevmode}
-{\llap{Kapitel\hspace{.5em}{\etocnumber}\hspace{.75cm}}\etocname
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+ {\advance\leftskip\TOCnumwidthC\relax}
+ {\addpenalty \@secpenalty
+ \etociffirst{}{\addvspace{\TOCmedvskip}}%
+ \leavevmode
+ {\interlinepenalty\@M
+ \bfseries\etocifnumbered
+ {\llap{\makebox[\TOCnumwidthC][l]{\etocnumber}}}
+ {\advance\leftskip-\TOCnumwidthC}%
+ \etocname\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
+ \penalty \@highpenalty }
+ {}
+ {\advance\leftskip-\TOCnumwidthC\relax}%
+% the rest is identical with code for global tocs:
+ \TOCsetlinestyle {subsection} {\TOCnumwidthD}%
+ \TOCsetlinestyle {subsubsection}{\TOCnumwidthE}%
+ \TOCsetlinestyle {paragraph} {\TOCnumwidthF}%
+ \TOCsetlinestyle {subparagraph} {\TOCnumwidthG}%
+}% end of \TOClocalstyle
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
+As mentioned previously, this handles non-numbered (multi-line) sectioning
+units somewhat differently from what happens in the standard document classes.
-\etocsetstyle{subsection}
-{}
-{\mdseries\large\addvspace{.5ex}\leavevmode}
-{\llap{\etocnumber\hspace{.75cm}}\textit{\etocname}%
- \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
-{}
+For some reason this code has some hard-coded |2.25em| and |4.5em| which were
+not abstracted into macros or lengths. The code inserts horizontal rules above
+and below the TOC contents in a non-separable by pagebreak way.
-\def\tmptitle{Meine wunderschöne These}
+See \autoref{sec:thirdexampleextra} for more.
-\etocsettocstyle{\color{cyan}\parindent0pt\leftskip\tocleftmargin
- \leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{\tmptitle}\par}{\bigskip}
+\end{otherlanguage}
-\tableofcontents \ref{toc:overview}
-% And again, for the fun of it:
-% \def\tmptitle{My Very Beautiful Thesis}
-% \tableofcontents \ref{toc:c}
+\section{Ein In\-halts\-ver\-zeich\-nis mit Rahmen}
+
+Als nächstes wollen wir ein gerahmtes Inhaltsverzeichnis erzeugen, wobei wir den
+vom Paket vorgegebenen Linienstil nutzen und ein paar Farben hinzufügen wollen.
+(Es wurde in eine Float"=Umgebung eingefügt, die man \vpageref{toc:b}
+findet.)
+
+% \footnote{Innerhalb der |figure|-Umgebung und vor dem gerahmten
+% Inhaltsverzeichnis, welches die Option |multicols| nutzt, haben wir den Befehl
+% \csa{normalcolor} eingefügt, um einen Bug zu umgehen, der durch die Interaktion
+% zwischen |multicols|, |color| und der |figure|-Umgebung entsteht. (Wir brauchen
+% den Befehl \csa{color\{red\}} in der |.toc|-Datei.) Der Fehler wird nicht durch
+% das \etoc"=Paket verursacht.}
+
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+\etocdefaultlines
+\begingroup
+\renewcommand{\etoccolumnsep}{2em}
+\renewcommand{\etocinnerleftsep}{1.5em}
+\renewcommand{\etocinnerrightsep}{1.5em}
+% Befehle für die Hintergrundfarbe des Inhaltsverzeichnisses
+\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
+% Befehle für die Rechtecke vor und nach dem Inhalt des Verzeichnisses
+\renewcommand{\etoctoprule}{\hrule height 1pt}
+\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
+\renewcommand{\etocbottomrule}{\hrule height 1pt}
+\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
+% Befehle für die Rechtecke links und rechts des Inhaltsverzeichnisses
+\renewcommand{\etocleftrule}{\vrule width 5pt}
+\renewcommand{\etocrightrule}{\vrule width 5pt}
+\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
+\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
+% mit \fcolorbox legen wir einen farbigen Rahmen für den Titel an
+\fboxrule1pt
+\renewcommand{\etocbelowtocskip}{0pt\relax}
+\etocframedstyle {\normalsize\rmfamily\itshape
+ \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
+ Dies ist das nach \etoc gestaltete Inhaltsverzeichnis, welches
+ jedoch nur die Abschnitte und Unterabschnitte dieses Teils
+ enthält. Da es gerahmt ist, darf es nicht größer sein als eine Seite.
+ Es hat das Label |toc:b|.}}}
+\begin{figure}[ht!]
+ \centering
+\tableofcontents \label{toc:b} \ref{toc:globalcmds}
+\end{figure}
\endgroup
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
+\filecontentsexec\filecontentsheremacro
-\subsection{Ein TOC mit einer Hintergrundfarbe}\label{ssec:again}
+\section{Ein weiteres TOC mit einer Hintergrundfarbe}\label{ssec:again}
Lassen Sie uns nun einige anspruchsvollere Linienstile versuchen. Das Display
wird den Paket"=Befehl \csa{etocframedstyle} verwenden, damit das erzeugte
@@ -7744,7 +7453,25 @@ Inhaltsverzeichnis auf eine einzige Seite passt. Wir wickeln es in eine
\hyperref[toc:floating]{Figur"=Umgebung}, damit es auf der aktuellen Seite
angezeigt wird. \vpageref{toc:floating}.
+Das aktuelle Design ist nicht in \etoc vorgefertigt; sondern nutzt seine
+`eingerahmten' Stile mit einer Hintergrundfarbe. Die Rahmengrenzen wurden so
+gesetzt, dass die gleiche Farbe, wie die Hintergrundfarbe, für die gesamte Sache
+dienen soll.
+% Dieses Design (mit anderen Farben) wird auch für
+% \hyperref[toc:clone]{dieses andere Inhaltsverzeichnis} benutzt, und der Leser
+% bezieht sich auf seine \hyperref[ssec:tocclone]{Unterabschnitte}, welche für die
+% Kodierung vorgesehen sind.
+
+\begin{otherlanguage}{english}
+ The details of the line styles used here are a bit involved, they were
+ written by the author at some early stage of this documentation and have
+ only been slightly revised to use more \LaTeX-commands and less
+ \TeX-primitives. Similar code is used also for
+ \hyperref[toc:clone]{this other toc}.
+\end{otherlanguage}
+
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\begin{figure}[htbp!]\centering
\colorlet{subsecnum}{black}
\colorlet{secbackground}{green!30}
@@ -7769,26 +7496,30 @@ angezeigt wird. \vpageref{toc:floating}.
\newcommand\shiftedwhiterule[2]{%
\hbox to \linewidth{\color{white}%
\hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#2}
+ \vskip#2}
-\etocsetstyle{subsubsection}{\etocskipfirstprefix}
+\etocsetstyle{subsubsection}
+{\etocskipfirstprefix}
{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
-\leftskip2.3cm\hangindent1cm\rightskip.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
-\nointerlineskip\vskip3pt}
+ \leftskip2.3cm\hangindent1cm\rightskip.5cm\relax
+ \makebox[1cm][l]{\color{subsecnum}\etocnumber}%
+ \color{black}\etocname
+ \nobreak\leaders\hbox to.2cm{\hss.}\hfill
+ \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
+ \nointerlineskip\vskip3pt}
{}
-\etocsetstyle{subsection}{\etocskipfirstprefix}
+\etocsetstyle{subsection}
+{\etocskipfirstprefix}
{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
-\leftskip1.5cm\hangindent.8cm\rightskip.5cm\noindent
-\hbox to .75cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
-\nointerlineskip\vskip3pt}
+ \leftskip1.5cm\hangindent.8cm\rightskip.5cm\relax
+ \makebox[.75cm][l]{\color{subsecnum}\etocnumber}%
+ \color{black}\etocname
+ \nobreak\leaders\hbox to.2cm{\hss.}\hfill
+ \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
+ \nointerlineskip\vskip3pt}
{}
\newcommand{\coloredstuff}[2]{%
@@ -7801,39 +7532,75 @@ angezeigt wird. \vpageref{toc:floating}.
\vskip3pt}}%
\par\nointerlineskip}
-% v1.07l on the occasion of traduction into German documentation:
- % APRIL 26, 2014 Improvement in the section style for better placement of
- % page number when the section name is more than one line long. Use of
- % \makebox rather than \hbox, to be more LaTeX like.
\etocsetstyle{section}
-{\coloredstuff{blue}
- {\hfil \bfseries\large Inhalt von Teil Eins\hfil}}
+{\coloredstuff{blue}{\hfil \bfseries\large Contents of Part One\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{blue}
{\leftskip1.5cm\rightskip.5cm\parfillskip-\rightskip
\makebox[0pt][r]{\makebox[.5cm][l]{\etocnumber}}%
- \etocname\hfill{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}}%
- \vskip6pt }
+ \etocname\nobreak\hfill\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}%
+ \vskip6pt}
{}
-
-% attention car \ref{toc:floating} fera référence au compteur de
-% toutes les toc, pas visibletoc.
-
\etocframedstyle[1]{}
\tableofcontents \label{toc:floating} \ref{toc:overview}
\vspace{-\baselineskip}
\centeredline{|\tableofcontents \ref{toc:overview}|
-(\emph{cf.} \autoref{ssec:again} and \hyperref[toc:clone]{this other toc})}
+(\emph{cf.} \hyperref[toc:clone]{this other toc})}
\end{figure}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
-Das aktuelle Design ist nicht in \etoc vorgefertigt; sondern nutzt seine
-`eingerahmten' Stile mit einer Hintergrundfarbe. Die Rahmengrenzen wurden so
-gesetzt, dass die gleiche Farbe, wie die Hintergrundfarbe, für die gesamte Sache
-dienen soll. Dieses Design (mit anderen Farben) wird auch für
-\hyperref[toc:clone]{dieses andere Inhaltsverzeichnis} benutzt, und der Leser
-bezieht sich auf seine \hyperref[ssec:tocclone]{Unterabschnitte}, welche für die
-Kodierung vorgesehen sind.
+\filecontentsexec\filecontentsheremacro
+
+
+\section{Eine (verrückte) In\-line"=Dar\-stellung}
+
+Nun wollen wir eine etwas verrückte Inline"=Darstellung erzeugen, womit das
+Inhaltsverzeichnis des gesamten Dokuments gesetzt werden soll. Hier werden die
+Unterabschnitte als Fußnoten dargestellt. Diese Art der Darstellung bietet sich
+eher für verlinkte Dokumente an, weniger für gedruckte! (Mir hingegen gefällt
+diese Art der Darstellung, obwohl mein Geschmack scheinbar oft nicht geteilt
+wird.)
+
+%%%% Note: 27 april 2014
+
+%%%% except for a miraculous situation depending from the quantity of previous
+%%%% material this TOC will have links extending accross pagebreaks, which
+%%%% dvipdfmx does not know how to handle completely. Apart from that the output
+%%%% is ok, thus no need to try seriously to avoid them.
+
+\begin{filecontentsdef}{etocsnippet-\the\value{section}-B.tex}{\foo}
+\begingroup
+\newsavebox{\forsubsections}
+\etocsetstyle{part}{\upshape. \etocskipfirstprefix}
+ {. \upshape}
+ {\bfseries\etocname:~~}
+ {}
+\etocsetstyle{section}{\itshape\etocskipfirstprefix}
+ {, }
+ {\mdseries\etocname}
+ {}
+\etocsetstyle{subsection}
+ {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
+ {; }
+ {\etocname}
+ {\end{lrbox}\footnote{\unhbox\forsubsections.}}
+\etocsetstyle{subsubsection}
+ { (\itshape\etocskipfirstprefix}
+ {, }
+ {\etocname}
+ {\/\upshape)}
+\etocsettocstyle{Hier ist das inline dargestellte Inhaltsverzeichnis. }{.\par}
+\tableofcontents
+\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+
+Zur Erzeugung dieses Inhaltsverzeichnisses wurde folgender Code genutzt:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}-B.tex}
\clearpage
@@ -7931,7 +7698,7 @@ Inhaltsverzeichnis setzt, verwendeten wir den Befehl \csb{etocinline} (auch als
Hier sind die Details der Implementierung:
\begingroup
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
< in der Prämbel >
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
@@ -7953,8 +7720,8 @@ Hier sind die Details der Implementierung:
Hier ist die nummerierte und verknüpfte Liste aller Tabellen von Inhalten,
die in diesem Dokument angezeigt werden: \tableofcontents.
\endgroup
-\end{verbatim}
-
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\endgroup
Nach |\etocsetstyle{visibletoc}{..}{..}{..}{..}|, wird für alle zukünftigen
@@ -8012,7 +7779,7 @@ sorgt für den richtigen Ort für den Link zusätzlich zum Paket
|.toc|-Datei, entsprechend einer fiktiven Dokumenteinheit
mit dem Namen `|Übung|' ein. Eine
Vier"=Säulen"=Liste, einschließlich der Abschnitte, kann dann erreichen mit
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocsetnexttocdepth{2} % Abschnitte sind auf Stufe 1 und werden anzeigen
\begingroup
\etocsetlevel{exercise}{2} % aber:
@@ -8029,8 +7796,8 @@ Vier"=Säulen"=Liste, einschließlich der Abschnitte, kann dann erreichen mit
\setlength{\columnseprule}{.4pt}
\tableofcontents
\endgroup
- \end{verbatim}
-
+ \end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{Ein TOC mit einem extravagantem Layout}
@@ -8310,128 +8077,6 @@ Eine andere Technik für diese Art der Dinge erläutert
\repeat
\endgroup
-\section{Ein weiterer Kompatibilitätsmodus}\label{sec:anothercompat}
-
-Wie in \autoref{subs:compat} erläutert, sagen die Befehle
-\csa{etocstandardlines} und \csa{etocstandarddisplaystyle} \etoc im
-Wesentlichen, wie man als Beobachter fungiert. Das Dokumentenklasse"=Layout für
-das Inhaltsverzeichnis wird dann gehorchen. Es gibt keine Möglichkeit, dieses
-Standard"=Layout aus dem Paket anzupassen (ändern von Schriftarten, Rändern,
-vertikalen Abständen, etc.) . Definieren Sie dazu ein Paket von dieser Funktion;
-weil entweder \etoc (vorübergehend vielleicht) im Kompatibilitätsmodus ohne
-Anpassung auf seinen Teil möglich ist oder der Benutzer hat das Layout in
-\csa{etocsetstyle}"=Befehlen angegeben (und \csa{etocsettocstyle}) ist (angeblich
-\ldots ) in der kompletten Steuerung.
-
-Nun, es ist eigentlich eine Alternative. Es ist möglich, die Verwendung der
-\csa{etocsetstyle}"=Befehle zu nutzen, um einen künstlichen Kompatibilitätsmodus
-neu zu erstellen, um Effekte zu erreichen, wie die folgenden, alle Dinge
-gleichen andererseits dem Dokumentenklassen"=Standard:
-\begin{enumerate}[noitemsep]
-\item Enthält der |hyperref|-Link nur die Namen, aber nicht die Anzahl der
- jeweils zu kapselnden Einträge der Inhaltstabellen;
-\item verwenden Sie den Dokumentenklassen"=Stil für Kapitel und Abschnitte, aber
- ändern Sie es nur für Teilbereiche;
-\end{enumerate}
-
-Hier ist beschrieben, wie Sie vorgehen müssen. Man nimmt in die Präambel:
-\begin{verbatim}
-\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}}{}%
- % for the scrbook or scrartcl classes:
- \etocsetstyle{part}{}{}
- {\savedpartline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- % identical in book/article/scrbook/scrartcl classes:
- \etocsetstyle{chapter}{}{} %%% only for book and scrbook
- {\savedchapterline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- \etocsetstyle{section}{}{}
- {\savedsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- \etocsetstyle{subsection}{}{}
- {\savedsubsectionline{\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{verbatim}
-Natürlich ist es so, 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
-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|).}
-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},
-dann ergibt es ein Inhaltsverzeichnis, wo die Zahlen nicht mehr verlinkt sind,
-aber die Namen noch. Oder man kann sich entscheiden, \csa{etocthename} zu
-verwenden und eine Hyperlink"=Nummer mit \csa{etocnumber} zu erhalten.
-
-Hier ist ein subtiles Beispiel, wo nur geringfügig die "`sections"' modifiziert
-wurden (hinzufügen von Farbe für die Nummer und das Entfernen des
-|hyperref|-Links) und die Unterabschnitte, wie in der Standardeinstellung,
-\emph{mit Ausnahme} von einer bestimmte "`section"' im Layout komplett geändert
-wurde: \MyQuasiStandardTOC{\ref{toc:overview}} \bigskip Dieses Beispiel hat nur
-Abschnitte und Unterabschnitte und der in \csa{MyStandardTOC} verwendete Code
-war:
-% corrected section number in verbatim code: 4 not 3 (2015/03/18)
-\begin{verbatim}
-\etocsetstyle{section}{}
- {\ifnum\etocthenumber=4
- \etocsetstyle{subsection}
- {\par\nopagebreak\begingroup
- \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
- \parindent 0pt \normalfont\normalsize\rmfamily\itshape
- % \columnsep1em
- % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
- % \begin{multicols}{2}%
- \etocskipfirstprefix}
- {\allowbreak\,--\,}
- {\etocname\ \textup{(\etocnumber)}}
- {.\par\endgroup}%
- % {.\par\end{multicols}\end{minipage}\par\endgroup}%
- \else
- \etocsetstyle{subsection}
- {}{}
- {\savedsubsectionline{\numberline{\etocnumber}\etocname}{\etocpage}}
- {}%
- \fi}
- {\savedsectionline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
- {}%
-\end{verbatim}
-
-Beachten Sie die Seite mit den Kopf"=Zeichen, welche man dem Inhaltsverzeichnis
-hinzufügen kann. Abschnitte und Unterabschnitte sind genauso wie im Standard
-(mit Ausnahme der Unterabschnitte, welche von einem bestimmten
-Benutzer"=Abschnitt aus gewählt wird und bis auf die Farbe der
-Abschnittsnummern), ohne das explizit die Länge, die Schriftart oder andere
-Formatierungsanweisungen gegeben werden. Aber wir mussten die |scrartcl|-Quellen
-untersuchen, um festzustellen, was zu nehmen ist für \csa{leftskip} und
-\csa{rightskip} für unsere Nutzer-sections"=Einträge.
\section{Das TOC als ein Baum}\label{tocastree}
@@ -8473,87 +8118,10 @@ Prozess.\footnote{Es gibt immer ein \csa{par}, welches kein Problem ist, es kann
aber unterdrückt werden, wenn der Bedarf über den Befehl \csb{etocinline} oder
dessen Synonym \csb{etocnopar} besteht.} Das ist der spätere Job einer
|forest|-Umgebung, die den Inhalt von |\treetok| wiedergeben soll.
-\newtoks\treetok
-\newtoks\tmptok
-
-% \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
-% #1\expandafter\expandafter\expandafter
-% {\expandafter\the\expandafter #1#2}}
-
-
-% 7 mars: j'utilise \etocthelinkedname défini à partir de 1.07f
-% mais bien sûr je sais que ça ne marche pas (sauf dans l'arbre pour le lien de
-% la section du bas) dans un QTree. Mais ça marche parfaitement dans un arbre
-% TikZ natif.
-
-% 9 septembre 2013: je remplace QTree par Forest, et il n'y a pas de problème
-% avec les hyperliens, ça marche out of the box (une fois que j'ai appris un peu
-% de sa syntaxe et de celle de TikZ).
-
-\newcommand*\PrepareSectionNode{%
- \tmptok {\centering\bfseries}%
- \appendtotok\tmptok\etocthelinkedname
- \edef\foresttreenode{ [{\noexpand\parbox{2cm}{\the\tmptok}}}%
-}
-
-% 7 mars: j'utilise maintenant \etocthelinkedname
-\newcommand*{\PrepareSubsectionNode}{%
- \tmptok {\raggedright}% j'ai essayé aussi avec \sloppy
- \appendtotok\tmptok\etocthelinkedname
- \edef\foresttreenode{ [{\noexpand\parbox{6cm}{\the\tmptok}}}%
-}
-
-\etocsetstyle{section}
- {\etocskipfirstprefix}
- {\appendtotok\treetok{ ]}}
- {\PrepareSectionNode \appendtotok\treetok\foresttreenode}
- {\appendtotok\treetok{ ]}}
-
-\etocsetstyle{subsection}
- {\etocskipfirstprefix}
- {\appendtotok\treetok{ ]}}
- {\PrepareSubsectionNode \appendtotok\treetok\foresttreenode}
- {\appendtotok\treetok{ ]}}
-
-\etocsettocstyle
- {\treetok{[{\hyperref[part:overview]{Überblick}}}}
- {\global\appendtotok\treetok{ ]}}
-
-
-% 11 octobre
-% forest ne veut pas @\the\treetok avec un \treetok vide, donc
-% il faut lui donner une valeur par défaut.
-\treetok{[{run latex again}]}
-% 12 octobre
-% pour que varioref fonctionne bien, je dois mettre la \tableofcontents
-% au plus près de l'environnement forest
-
-\begin{figure}[thp!]\centering
- \etocsetnexttocdepth{subsection}
- \tableofcontents \label{toc:forest}\ref{toc:overview}
- \hypersetup{hidelinks}%
- \bracketset{action character=@}
- \begin{forest}
- for tree={anchor=center,child anchor=west,
- grow'=east,draw,thick,
- edge={draw,thick,dashed,color=teal}},
- where={level()==1}{circle,thick,fill=blue!5,
- before computing xy={l=3cm}}{},
- where={level()==2}{fill=red!5,
- before computing xy={l=6cm}}{},
- % je trouve ce truc pour une position absolue. OK!
- rectangle, thick, fill=cyan!5, inner sep=6pt,
- @\the\treetok
- \end{forest}
- \centeredline{Ein Inhalsverzeichnis in Form eines |forest|"=Baums.}
-\end{figure}
-
-Der resultierende Baum wird in einem \hyperref[toc:forest]{Puffer} angelegt, welcher
-\vpageref[oben]{toc:forest} erscheint. Hier ist der zur Herstellung notwendige Code:
-\begin{verbatim}
-\newtoks\treetok
-\newtoks\tmptok
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+% \newtoks\treetok % move this (uncommented) to preamble
+% \newtoks\tmptok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter
@@ -8610,8 +8178,15 @@ Der resultierende Baum wird in einem \hyperref[toc:forest]{Puffer} angelegt, wel
@\the\treetok
\end{forest}
\end{figure}
-\end{verbatim}
+\end{filecontentsdef}
+\let\appendtotok\relax
+\filecontentsexec\foo
+
+Der resultierende Baum wird in einem \hyperref[toc:forest]{Puffer} angelegt, welcher
+\vpageref[oben]{toc:forest} erscheint. Hier ist der zur Herstellung notwendige Code:
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
Warum |\hypersetup{hidelinks}|? Wie in \autoref{ssec:hidelinks} erläutert ist,
werden die Links in Inhaltsverzeichnissen nicht eingefärbt, noch gerahmt, so
dass dieses Dokument den Befehl
@@ -8658,9 +8233,15 @@ Aufgabe die \csa{treetok} zu befüllen. Wir interessieren uns hier für die
Tabelle der Inhalte von diesem (oder einem anderen) Dokumententeil, nur ein
\csa{sectiontok} und ein \csa{subsectiontok} wird dafür gebraucht.
-\begin{verbatim}
-% \newtoks\treetok % already done earlier
-\newtoks\sectiontok \newtoks\subsectiontok \newcommand*{\treenode}{}
+\let\appendchildtree\relax
+\let\treenode\relax
+
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+% \newtoks\treetok % put this uncommented in preamble
+% \newtoks\sectiontok
+% \newtoks\subsectiontok
+
+\newcommand*{\treenode}{}
\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
\edef\tmp{\the#1 child {\the#2}}%
@@ -8687,43 +8268,6 @@ Tabelle der Inhalte von diesem (oder einem anderen) Dokumententeil, nur ein
{\treetok{\node {\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ;}}
-% moved to the inside of the figure environment for correct \pageref{toc:molecule}
-% \etocsetnexttocdepth{subsection}
-% \tableofcontents \label{toc:molecule} \ref{toc:overview}
-\end{verbatim}
-
-\newtoks\sectiontok
-\newtoks\subsectiontok
-\newcommand*\treenode {}
-
-\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
- \edef\tmp{\the#1 child {\the#2}}%
- #1\expandafter{\tmp}%
-}
-
-\newcommand*{\preparetreenode}{%
- \tmptok\expandafter{\etocthelinkednumber}%
- \edef\treenode{node {\the\tmptok}}%
-}
-
-\etocsetstyle{section}
- {\etocskipfirstprefix}
- {\appendchildtree\treetok\sectiontok}
- {\preparetreenode
- \sectiontok\expandafter{\treenode}}
- {\appendchildtree\treetok\sectiontok}
-
-\etocsetstyle{subsection}
- {\etocskipfirstprefix}
- {\appendchildtree\sectiontok\subsectiontok}
- {\preparetreenode
- \subsectiontok\expandafter{\treenode}}
- {\appendchildtree\sectiontok\subsectiontok}
-
-\etocsettocstyle
- {\treetok{\node {\hyperref[part:overview]{Überblick}}}}
- {\global\appendtotok\treetok{ ;}}
-
\begin{figure}[thp!]\centering
\etocsetnexttocdepth{subsection}
\tableofcontents \label{toc:molecule}\ref{toc:overview}
@@ -8739,6 +8283,10 @@ Tabelle der Inhalte von diesem (oder einem anderen) Dokumententeil, nur ein
\end{tikzpicture}
\centeredline{Ein Inhaltsverzeichnis als ein "`Molekül"'.}
\end{figure}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
+
+\filecontentsexec\filecontentsheremacro
% Pour que \pageref fonctionne correctement, je dois mettre
% le \tableofcontents dans la figure.
@@ -8748,24 +8296,7 @@ Der |\tableofcontents|"=Befehl erscheint direkt über der Umgebung in dem
die gleiche Seite zu beziehen, wie die in dem das Bild tatsächlich gedruckt
werden soll). Wir erhalten somit das Inhaltsverzeichnis als
"`\hyperref[toc:molecule]{Molekül}"', welches oben erscheint
-\vpageref[above]{toc:molecule}. Hier ist der aktuelle, tatsächlich produzierte
-Code:
-\begin{verbatim}
-\begin{figure}[thp!]\centering
- \etocsetnexttocdepth{subsection}
- \tableofcontents \label{toc:molecule} \ref{toc:overview}
- \hypersetup{hidelinks}%
- \begin{tikzpicture}
- [grow cyclic,
- level 1/.style={level distance=4cm,sibling angle=72},
- level 2/.style={level distance=2cm,sibling angle=60},
- every node/.style={ball color=red,circle,text=SkyBlue},
- edge from parent path={[dashed,very thick,color=cyan]
- (\tikzparentnode) --(\tikzchildnode)}]
- \the\treetok
- \end{tikzpicture}
-\end{figure}
-\end{verbatim}
+\vpageref[above]{toc:molecule}.
Dieses \hyperref[toc:molecule]{TikZ-TOC} ist komplett verlinkt, wie das
vorherige \hyperref[toc:forest]{Forest-TOC} auch.
@@ -8826,132 +8357,15 @@ Weitere Hilfe kam damals via
zu dem weiteren Beispiel \hyperref[toc:mindmaptitlepage]{title
page}.}
-\begingroup
-%\newtoks\treetok
-%\newtoks\parttok
-
-\newcommand*\partnode {} % just to check we don't overwrite something
-%\newcommand*\childnode {}
-
-\newcommand*\tmprotate {} % just to check we don't overwrite something
-\newcommand*\tmpoption {} % just to check we don't overwrite something
-\newcommand*\tmpstuff {} % just to check we don't overwrite something
-
-% \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
-% #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
-
-\renewcommand*{\appendchildtree}[3]{%
-% 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 [#3]{\the#2}}%
- #1\expandafter {\tmpstuff }%
-}
-
-% \newcounter{partco}
-
-% 1,2,3,4,5,... -> 1,2,3,1,2,3,1,2,3
-% \def\pseudomodthree #1{\numexpr #1 + 3 - 3*((#1+1)/3)\relax}
-
-\etocsetstyle{part}
- {\etocskipfirstprefix}
-% 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.
- {\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
-% define the part node
- \edef\partnode{node \tmpoption
- {\unexpanded\expandafter{\etocthelinkednumber}.
- \unexpanded\expandafter{\etocthelinkedname}}\tmprotate }%
-% 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 {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
- }
-
-\etocsetstyle{section}
- {}
- {}
- {% define the section node
- \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
- \unexpanded\expandafter{\etocthelinkedname}}}}%
- % append it to the current \parttok
- \appendtotok\parttok\childnode
- }
- {}
-
-\etocsettocstyle
- {\setcounter{partco}{0}%
- \treetok{\node [root concept]{\textbf{The \etoc documentation}}}}
- {\global\appendtotok\treetok{ ;}}
-% The \global above is mandatory because etoc always typesets TOC inside a group
-
-\etocsetnexttocdepth{section}
-% use of depth tags to cut out some sections.
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {section}
-\etocsettagdepth {linestyles} {part}
-\etocsettagdepth {globalcmds} {part}
-\etocsettagdepth {custom} {section}
-\etocsettagdepth {tips} {part}
-\etocsettagdepth {etocandworld}{part}
-\etocsettagdepth {code} {section}
-
-\tikzset{
- branch color/.style={
- concept color=#1!white,
- every child/.append style={concept color=#1!white!30!white, font=\normalsize},
- }
-}%
-
-\begin{figure}[thp!]
-\tableofcontents\label{toc:mindmap}%
-\centeredline{\resizebox{.85\paperwidth}{!}%
-{\begin{tikzpicture}[mindmap,
- grow cyclic,
- text width=2cm,
- align=flush center,
- nodes={concept},
- concept color=orange!60,
- root concept/.append style={text width=4cm, font=\Large},
- 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
-\end{tikzpicture}}}
-\end{figure}
-\endgroup
-
-Es ist schwierig, alles auf eine Seite einzupassen. Da kommt \csa{resizebox}
-zur Hilfe, das auch Hyperlings bewahrt. Dennoch habe ich für dieses Beispiel
-einige Abschnitte von der Anzeige ausgeschlossen, dafür nehmend die Technik von
-\etoc \hyperref[etocdepthtag.toc]{depth tags}. Das vollverlinkte TOC erscheint
-hier \vpageref{toc:mindmap}.
+\let\childnode\relax
+\let\appendchildtree\relax
+\let\appendtotok\relax
+\expandafter\let\csname c@partco\endcsname\relax
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\begingroup
-\newtoks\treetok
-\newtoks\parttok
+% \newtoks\treetok % in preamble
+% \newtoks\parttok % in preamble
\newcommand*\partnode {} % just to check we don't overwrite something
\newcommand*\childnode {}
@@ -9031,7 +8445,8 @@ hier \vpageref{toc:mindmap}.
\etocsettagdepth {preamble} {none}
\etocsettagdepth {overview} {part}
\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {section}
+\etocsettagdepth {examples} {section}
+\etocsettagdepth {surprising} {part}
\etocsettagdepth {linestyles} {part}
\etocsettagdepth {globalcmds} {part}
\etocsettagdepth {custom} {section}
@@ -9064,8 +8479,17 @@ hier \vpageref{toc:mindmap}.
\end{tikzpicture}}}
\end{figure}
\endgroup
-\end{verbatim}
+\end{filecontentsdef}
+\filecontentsexec\foo
+Es ist schwierig, alles auf eine Seite einzupassen. Da kommt \csa{resizebox}
+zur Hilfe, das auch Hyperlings bewahrt. Dennoch habe ich für dieses Beispiel
+einige Abschnitte von der Anzeige ausgeschlossen, dafür nehmend die Technik von
+\etoc \hyperref[etocdepthtag.toc]{depth tags}. Das vollverlinkte TOC erscheint
+hier \vpageref{toc:mindmap}.
+
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
Eine interessante Alternative zur Verwendung von \etoc ist, das
gesamte TOC in einen TikZ-Baum zu konvertieren (vielleicht mit
Ausnahme einiger Teile) und in eine Datei zu drucken, von der es
@@ -9118,39 +8542,7 @@ Einschränkungen:
Hier ein Beispiel eines TOCs als ein |longtable|.
-\begingroup
-\etocglobaldefs
-\etocsetstyle{part}
- {}
- {\\\hline}
- {\strut\etocnumber &\bfseries\etocname
- &\etocpage }
- {}
-\etocsetstyle{section}
- {}
- {\etociffirst{\etocifnumbered{\\\hline}{\\\hline\hline}}{\\}}
- {\etocnumber&\etocname &\etocpage }
- {}
-\etocsetstyle{subsection}
- {}
- {\\}
- {&\makebox[1cm][c]{\etocnumber}%
- \parbox[t]{\dimexpr6cm-\tabcolsep\relax}
- {\sloppy\itshape\etocname\strut}%
- &\itshape\etocpage }
- {}
-\etocsettocstyle
- {\hypersetup{hidelinks}%
- \begin{longtable}{|>{\bfseries}c|p{7cm}|r|}
- \hline
- \multicolumn{3}{|c|}{\Large\bfseries\strut\MakeUppercase{\contentsname}}%
- }
- {\\\hline\end{longtable}}
-\etocsetnexttocdepth {subsection}
-\tableofcontents
-\endgroup
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}-A.tex}{\foo}
\begingroup
\etocglobaldefs % notwendig für \etocname etc... um zu überleben &
@@ -9189,8 +8581,12 @@ Hier ein Beispiel eines TOCs als ein |longtable|.
\tableofcontents
\endgroup
-\end{verbatim}
+\end{filecontentsdef}
+\filecontentsexec\foo
+
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}-A.tex}
Beim Untersuchen des Codes wird sich der Leser fragen, warum die
|\\| immer zuerst in \meta{prefix+contents} und nicht, wie es
intuitiver ist, ziemlich später gegeben wird. In vielen Fällen
@@ -9236,28 +8632,7 @@ gleichen Resultats hier zu sehen \autoref{ssec:tocastableold}.
Hier ist auch ein viel einfacheres Beispiel. Es ist ein lokales
Inhaltsverzeichnis.
-
-\begin{center}
-\etocsetstyle{section}
- {}
- {\etociffirst{\\\hline\hline}{\\\hline}}
- {\etocname& \etocnumber&\etocpage }
- {}
-
-\etocsettocstyle
- {\hypersetup{hidelinks}\begin{tabular}{|p{4cm}|c|c|}\hline
- \multicolumn{1}{|c|}{\bfseries Abschnitt}&
- \bfseries Nummer&
- \bfseries Seite}
- {\\\hline\end{tabular}}
-
-\etocglobaldefs % VERPFLICHTEND !!
-\etocsetnexttocdepth{1}
-
-\tableofcontents\ref{toc:overview}
-\end{center}
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}-B.tex}{\foo}
\begin{center}
\etocsetstyle{section}
{}
@@ -9277,110 +8652,24 @@ Inhaltsverzeichnis.
\tableofcontents\ref{toc:overview}
\end{center}
-\end{verbatim}
+\end{filecontentsdef}
-\subsection{Die Befehle \csbhyp{etocglobaldefs} und \csbhyp{etoclocaldefs}}
-\label{etocglobaldefs}
-\label{etoclocaldefs}
-
-In \LaTeX{} verschwindet die Bedeutung eines Befehls, definiert
-via |\newcommand\foo{...}| in einer Umgebung (oder Gruppe), vom
-\TeX-Speicher beim Austritt aus dieser Umgebung (oder Gruppe).
-Manchmal ist es jedoch erforderlich, Definitionen mit globaler
-Reichweite zu geben, für diese hat \TeX{} primitive Präfixe
-|\global|.
-
-Standardmäßig sind die \etoc-Definitionen von \csb{etocname} etc.
-\ldots{} lokal, Dies verursacht Probleme in bestimmten
-Zusammenhängen, nicht nur wie hier bei TOCs als Tabellen, sondern
-auch mit |enumitem|-\emph{inline}-Varianten der
-Standardumgebungen, weil der Befehl |\item| dann eine Gruppe
-schließt.
+\filecontentsexec\foo
-Nach \csb{etocglobaldefs} wird \etoc seine Definitionen von
-\csb{etocname} etc. \ldots{} vornehmen, sie haben eine globale
-Reichweite. Für den normalen Gebrauch ist das nicht notwendig. Es
-tut nicht weh, beides systematisch zu aktivieren.
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}-B.tex}
-Um zur Standardeinstellung zurückzukehren, nehmen Sie
-\csb{etoclocaldefs}. Beachten Sie, dass beide,
-\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 \csbhyp{etocchecksemptiness} command}
-\label{etocchecksemptiness}
-
-The user needs to issue \csb{etocchecksemptiness} to tell \etoc to check whether
-local tables of contents are empty and in case of emptiness to print nothing
-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|).
-
\section{A TOC self-adjusting widths for its typesetting}
\label{sec:thirdexampleextra}
This is a continuation of \autoref{sec:thirdexample}. The goal is to adjust
automatically the ``numwidths'' used for typesetting the unit numbers in the
(local) tables of contents.
-\begin{verbatim}
-\newcommand*\TOCcomputenumwidths [1][]{% #1=empty or "local"
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\makeatletter
+\newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent
\begingroup
\def\TOCnumwidthB {0pt}%
\def\TOCnumwidthC {0pt}%
@@ -9390,22 +8679,22 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the
\def\TOCnumwidthG {0pt}%
\etocsetstyle{part}{}{}{}{}%
\etocsetstyle{chapter}{}
- {\setbox0\hbox{\bfseries\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthB\edef\TOCnumwidthB{\the\wd0}\fi}{}%
\etocsetstyle{section}{}
- {\setbox0\hbox{\bfseries\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthC\edef\TOCnumwidthC{\the\wd0}\fi}{}%
\etocsetstyle{subsection}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthD\edef\TOCnumwidthD{\the\wd0}\fi}{}%
\etocsetstyle{subsubsection}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthE\edef\TOCnumwidthE{\the\wd0}\fi}{}%
\etocsetstyle{paragraph}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthF\edef\TOCnumwidthF{\the\wd0}\fi}{}%
\etocsetstyle{subparagraph}{}
- {\setbox0\hbox{\etocthenumber\kern0.5em}}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
{\ifdim\wd0>\TOCnumwidthG\edef\TOCnumwidthG{\the\wd0}\fi}{}%
%
\etocsettocstyle{}
@@ -9425,30 +8714,45 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the
\typeout{Next TOCs will use \TOCnumwidthG\space for subparagraph number width}%
\endgroup
}%
-\end{verbatim}
-One invokes either only once \csa{TOCcomputenumwidths} (with
-a prior |\etocsetnexttocdepth{all}|) or, alternatively multiple times,
-using the optional argument:
+\newcommand*\TOCcomputenumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {}{#1}%
+}%
+\newcommand*\TOCcomputelocalnumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {local}{#1}%
+}%
+\makeatother
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
+The optional parameter to \csa{TOCcomputenumwidths} specifies the minimal
+indent. In case nothing is numbered you may wish a higher value than |0.5em|.
+For each local table of contents to have its own width computations, the macro
+\csa{TOCcomputelocalnumwidths} is provided. As the code makes global
+assignments, either use (once) \csa{TOCcomputenumwidths} or do
+\csa{TOCcomputelocalnumwidths} for each local table of contents.
\begin{verbatim}
-\bgroup
- \etocsettocdepth{paragraph}% for example
- \TOCcomputenumwidths [local]%
+ \TOCcomputelocalnumwidths % may use optional argument to replace 0.5em
\localtableofcontents
-\egroup
\end{verbatim}
-Then each local table of contents will compute the various ``numwidths'' to
-match exactly (with an extra |0.5em|), for each sectioning unit (apart from
-|\part| as it has no associated ``numwidth'' in the table of contents code of
-the |book| class), the widest number found. As the code makes global
-assignments, it is either to be used only once, or for each local table of
-contents. Notice that the bold font serves for both chapter and section
-styles, but the code from \autoref{sec:thirdexample} does not use bold for
-sections in the global TOC, only in local TOCs. Thus the
-\csa{TOCcomputenumwidth} will set the parameter \csa{TOCnumwidthC} to a value
-slightly larger than needed in the main TOC. Hence the section style in
-\csa{TOCcomputenumwidth} should insert the |\bfseries| in the box only after
-testing that optional parameter |local| was used, but well.
-
+Notes:
+\begin{enumerate}[nosep]
+\item naturally these are only suggestions. For example one could put
+ everything in single macros \csa{TOCtoc} and \csa{TOClocaltoc} to
+ simultaneously compute the numwidths and then typeset the (local) table of
+ contents.
+\item if you want to adjust the |tocdepth| recall from
+ \autoref{ssec:bookmarksdepth} that it influences |hyperref| hence you may
+ need to use a group |\begingroup...\endgroup|. Or, one can use
+ \csb{etocsetnexttocdepth}\marg{level} but (with the code as here) this must
+ then be issued twice, once for \csa{TOCcomputelocalnumwidths}, once for
+ \csa{localtableofcontents}.
+\item the bold font serves above for both chapter and section numwidth
+ computations, but the code from \autoref{sec:thirdexample} uses |\bfseries|
+ only in local TOCs. Thus the \csa{TOCcomputenumwidth} will set the parameter
+ \csa{TOCnumwidthC} to a value slightly larger than needed in the main TOC.
+ Hence the section style in \csa{TOCcompute@numwidths} should possibly insert
+ the |\bfseries| in the box only after testing for the optional parameter
+ |local|.
+\end{enumerate}
\end{otherlanguage}
\clearpage
@@ -9522,7 +8826,7 @@ man grundsätzlich auf die folgende Art und Weise:
\csa{rmfamily} geschrieben.}
\begingroup\small
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocsetstyle{section}
{\begin{enumerate}}
{\normalsize\bfseries\rmfamily\item}
@@ -9541,7 +8845,8 @@ man grundsätzlich auf die folgende Art und Weise:
{\allowbreak\,--\,}
{\etocname}
{.\hfil\par\endgroup\pagebreak[3]}
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
\endgroup
Diese provisorischen Stil"=Definitionen beruhen auf der automatischen
@@ -9714,8 +9019,10 @@ Das Folgende ist für fortgeschrittene Anwendungen von fortgeschrittenen
Benutzern. Das \csa{etocthename}-Makro wurde bereits schon einmal erwähnt;
verwendet man es in Anweisungen wie |\global\let\lastone\etocthename| in einem
\etoc line"=Stil, definiert das Macro |\lastone| so, dass es sich ausbreitet bis
-zum letzten Namen auf dem korrespondieren Level. Jedoch bestand bisher keine
-Möglichkeit, dass Gleiche auch für die Link"=Daten zu tun.
+zum letzten Namen auf dem korrespondieren Level.
+
+% Jedoch bestand bisher keine
+% Möglichkeit, dass Gleiche auch für die Link"=Daten zu tun.
Das in diesem Paket enthaltene \csa{etocthelinkedname} stellt dies nun zur
Verfügung, inklusive der Link"=Daten. Es wurde in dieser Dokumentation benutzt
@@ -9726,9 +9033,11 @@ Ebenfalls bereit gestellt mit ähnlichen Funktionen: \csa{etocthelinkednumber},
zu dieser Seitenzahl hinzugefügt hat) und \csa{etocthelink}\marg{linkname},
welches es erlaubt einen Link mit einem beliebigen Name zu erstellen.
-All diese Befehle sind \emph{nicht} robust. In der Tat wurde mit
-|1.08a| \csa{etocname} als robuste Variante von
-\csa{etocthelinkedname} gestartet.
+All diese Befehle sind \emph{nicht} robust.
+
+% In der Tat wurde mit
+% |1.08a| \csa{etocname} als robuste Variante von
+% \csa{etocthelinkedname} gestartet.
Veralteter Beispiel\begingroup\
\etocsetstyle {section}
@@ -9763,7 +9072,8 @@ Veralteter Beispiel\begingroup
\endgroup
\end{verbatim}
-Mit \etoc |1.08| gibt es ein einfacher Weg zum gleichen Resultat:
+Mit \etoc |1.08| gibt es ein einfacher Weg mit Hilfe von \csb{etocglobaldefs}
+zum gleichen Resultat:
\begin{verbatim}
Beispiel\begingroup\etocglobaldefs % <-- NEU mit etoc 1.08.
\etocsetstyle {section}
@@ -10220,165 +9530,11 @@ und \csb{etocaftertochook} all drei ähnlich definiert um nichts zu tun und die
für einige spezielle Effekte genutzt werden können.
-\section{Das In\-halts\-ver\-zeic\-hnis von die\-sem Teil}
-
-\subsection{Über\-prü\-fen des Kom\-pa\-tibilitäts\-modus}
-
-Als drittes Beispiel wollen wir nun das Inhaltsverzeichnis dieses Teils setzen.
-Dazu wollen wir zuerst den Kompatibilitätsmodus testen.\footnote{Dieses
-Dokument wurde als |scrartcl| gesetzt. Wir wollen nun testen, ob
-der Kompatibilitätsmodus des \etoc"=Pakets die Anpassungen innerhalb der
-Klassenbefehle umsetzt.} Das ursprüngliche Inhaltsverzeichnis ist
-unsichtbar und wurde am Anfang von \autoref{part:globalcmds} definiert,
-wobei es mit einem Label versehen wurde.
-\begin{verbatim}
-\KOMAoptions{toc=left}
-\etocstandarddisplaystyle % wird benötigt, damit toc=left gilt
-\etocstandardlines
-\tableofcontents \ref{toc:globalcmds}
-\end{verbatim}
-\KOMAoptions{toc=left}
-\etocstandarddisplaystyle
-\etocstandardlines
-\tableofcontents \ref{toc:globalcmds}
-
-\subsection{Ein In\-halts\-ver\-zeich\-nis mit Rahmen}
-
-Als nächstes wollen wir ein gerahmtes Inhaltsverzeichnis erzeugen, wobei wir den
-vom Paket vorgegebenen Linienstil nutzen und ein paar Farben hinzufügen wollen.
-(Es wurde in eine Float"=Umgebung eingefügt, die man \vpageref{toc:b}
-findet.)
-
-% \footnote{Innerhalb der |figure|-Umgebung und vor dem gerahmten
-% Inhaltsverzeichnis, welches die Option |multicols| nutzt, haben wir den Befehl
-% \csa{normalcolor} eingefügt, um einen Bug zu umgehen, der durch die Interaktion
-% zwischen |multicols|, |color| und der |figure|-Umgebung entsteht. (Wir brauchen
-% den Befehl \csa{color\{red\}} in der |.toc|-Datei.) Der Fehler wird nicht durch
-% das \etoc"=Paket verursacht.}
-
-\begin{verbatim}
-\etocdefaultlines
-\begingroup
-\renewcommand{\etoccolumnsep}{2em}
-\renewcommand{\etocinnerleftsep}{1.5em}
-\renewcommand{\etocinnerrightsep}{1.5em}
-% Befehle für die Hintergrundfarbe des Inhaltsverzeichnisses
-\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
-% Befehle für die Rechtecke vor und nach dem Inhalt des Verzeichnisses
-\renewcommand{\etoctoprule}{\hrule height 1pt}
-\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
-\renewcommand{\etocbottomrule}{\hrule height 1pt}
-\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
-% Befehle für die Rechtecke links und rechts des Inhaltsverzeichnisses
-\renewcommand{\etocleftrule}{\vrule width 5pt}
-\renewcommand{\etocrightrule}{\vrule width 5pt}
-\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
-\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
-% mit \fcolorbox legen wir einen farbigen Rahmen für den Titel an
-\fboxrule1pt
-\renewcommand{\etocbelowtocskip}{0pt\relax}
-\etocframedstyle {\normalsize\rmfamily\itshape
- \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
- Dies ist das nach \etoc gestaltete Inhaltsverzeichnis, welches
- jedoch nur die Abschnitte und Unterabschnitte dieses Teils
- enthält. Da es gerahmt ist, darf es nicht größer sein als eine Seite.
- Es hat das Label |toc:b|.}}}
-\begin{figure}[ht!]
- \centering
-\tableofcontents \label{toc:b} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
-\end{verbatim}
-
-
-\etocdefaultlines
-\begingroup
-\renewcommand{\etoccolumnsep}{2em}
-\renewcommand{\etocinnerleftsep}{1.5em}
-\renewcommand{\etocinnerrightsep}{1.5em}
-% specify a background color for the toc contents
-\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
-% set up the top and bottom rules
-\renewcommand{\etoctoprule}{\hrule height 1pt}
-\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
-\renewcommand{\etocbottomrule}{\hrule height 1pt}
-\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
-% set up the left and right rules
-\renewcommand{\etocleftrule}{\vrule width 5pt}
-\renewcommand{\etocrightrule}{\vrule width 5pt}
-\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
-\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
-% use \fcolorbox to set up a colored frame for the title
-\fboxrule1pt
-\renewcommand{\etocbelowtocskip}{-.5\baselineskip\relax}
-\etocframedstyle {\normalsize\rmfamily\itshape
- \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
- Dies ist das nach \etoc gestaltete Inhaltsverzeichnis, welches
- jedoch nur die Abschnitte und Unterabschnitte dieses Teils
- enthält. Da es gerahmt ist, darf es nicht größer sein als eine Seite.
- Es hat das Label |toc:b|.}}}
-\begin{figure}[ht!]
- \centering
-%\normalcolor % work-around to a bug involving color and multicols (and figure)
-\tableofcontents \label{toc:b} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
-
-
-\subsection{Eine (verrückte) In\-line"=Dar\-stellung}
-
-Nun wollen wir eine etwas verrückte Inline"=Darstellung erzeugen, womit das
-Inhaltsverzeichnis des gesamten Dokuments gesetzt werden soll. Hier werden die
-Unterabschnitte als Fußnoten dargestellt. Diese Art der Darstellung bietet sich
-eher für verlinkte Dokumente an, weniger für gedruckte! (Mir hingegen gefällt
-diese Art der Darstellung, obwohl mein Geschmack scheinbar oft nicht geteilt
-wird.)
-
-%%%% Note: 27 april 2014
-
-%%%% except for a miraculous situation depending from the quantity of previous
-%%%% material this TOC will have links extending accross pagebreaks, which
-%%%% dvipdfmx does not know how to handle completely. Apart from that the output
-%%%% is ok, thus no need to try seriously to avoid them.
-
-\begingroup
-\newsavebox{\forsubsections}
-\etocsetstyle{part}{\upshape. \etocskipfirstprefix}{. \upshape}{\bfseries\etocname:~~}{}
-\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }{\mdseries\etocname}{}
-\etocsetstyle{subsection}
- {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
- {; }
- {\etocname}
- {\end{lrbox}\footnote{\unhbox\forsubsections.}}
-\etocsetstyle{subsubsection}{ (\itshape\etocskipfirstprefix}
- {, }{\etocname}{\/\upshape)}
-\etocsettocstyle{Hier ist das inline dargestellte Inhaltsverzeichnis. }{.\par}
-\tableofcontents \label{toc:crazyinline}
-\endgroup
-
-Zur Erzeugung dieses Inhaltsverzeichnisses wurde folgender Code genutzt:
-\begin{verbatim}
-\begingroup
-\newsavebox{\forsubsections}
-\etocsetstyle{part}{\upshape. \etocskipfirstprefix}{. \upshape}
- {\bfseries\etocname:~~}{}
-\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }
- {\mdseries\etocname}{}
-\etocsetstyle{subsection}
- {\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
- {; }{\etocname}{\end{lrbox}\footnote{\unhbox\forsubsections.}}
-\etocsetstyle{subsubsection}
- { (\itshape\etocskipfirstprefix}{, }{\etocname}{\/\upshape)}
-\etocsettocstyle{Hier ist das inline dargestellte Inhaltsverzeichnis. }{.\par}
-\tableofcontents
-\endgroup
-\end{verbatim}
-
\clearpage
\etocdepthtag.toc {custom}
-\part{\etoc nutzen und an\-passen}
+\part{Eigene Stile von \etoc nutzen und an\-passen}
\label{part:custom}
\thispartstats
@@ -10523,7 +9679,7 @@ Schriftart die halbfette Variante. Hierfür modifizieren wir den Befehl
\csa{etocfontone}. Weiterhin nutzen wir einen gepunkteten Einzug, da dieser
weniger Platz einnimmt als der Paketstandard.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
\fbox{\parbox{.6\linewidth}{
\leftskip 0pt plus .5fil
@@ -10547,31 +9703,13 @@ weniger Platz einnimmt als der Paketstandard.
\sloppy
\tableofcontents
\endgroup
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
-% pour un problème avec multicol (doc de 1.08g, Samedi 29 août 2015 à 12:06:08)
-\clearpage
-\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
- \fbox{\parbox{.6\linewidth}{
- \leftskip 0pt plus .5fil
- \rightskip 0pt plus -.5fil
- \parfillskip 0pt plus 1fil Dies ist das zentrale zweispaltige
- Inhaltsverzeichnis, das den Standardlinienstil von \etoc nutzt, wobei die
- Abschnitte wie Kapitel und die Unterabschnitte wie Abschnitte gesetzt
- wurden. }}}
+% % pour un problème avec multicol (doc de 1.08g, Samedi 29 août 2015 à 12:06:08)
+% \clearpage
-\etocdefaultlines
-\etocsetnexttocdepth{1}
-
-\begingroup
-\etocsetlevel{section}{0}
-\etocsetlevel{subsection}{1}
-\renewcommand*{\etocfontone}{\normalfont \normalsize}
-\renewcommand*{\etoctoclineleaders}
- {\hbox{\normalfont\normalsize\hbox to 1ex {\hss.\hss}}}
-\sloppy
-\tableofcontents
-\endgroup
+\filecontentsexec\filecontentsheremacro
\section{\etoc individuell an\-passen}
@@ -10714,7 +9852,7 @@ Beim Befehl \csa{etocframedstyle} wird der Titel in der Mitte des oberen Rechtec
jedoch sehr unschön aussehen, weswegen wir den Titel innerhalb der \meta{start}-Umgebung eines Abschnittbefehls
platzieren. Hierdurch wird er innerhalb des Rahmens gesetzt.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
\definecolor{secbackground}{RGB}{0,177,235}
@@ -10785,88 +9923,15 @@ platzieren. Hierdurch wird er innerhalb des Rahmens gesetzt.
\etocframedstyle[1]{}
\tableofcontents \label{toc:clone} \ref{toc:globalcmds}
\endgroup
-\end{verbatim}
-
-\begingroup
-\definecolor{subsecnum}{RGB}{13,151,225}
-\definecolor{secbackground}{RGB}{0,177,235}
-\definecolor{tocbackground}{RGB}{212,237,252}
-
-\renewcommand{\etocbkgcolorcmd}{\color{tocbackground}}
-\renewcommand{\etocleftrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etocrightrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etocbottomrulecolorcmd}{\color{tocbackground}}
-\renewcommand{\etoctoprulecolorcmd}{\color{tocbackground}}
-
-\renewcommand{\etocleftrule}{\vrule width 1cm}
-\renewcommand{\etocrightrule}{\vrule width .5cm}
-\renewcommand{\etocbottomrule}{\hrule height 12pt}
-\renewcommand{\etoctoprule}{\hrule height 12pt}
-
-\renewcommand{\etocinnertopsep}{0pt}
-\renewcommand{\etocinnerbottomsep}{0pt}
-\renewcommand{\etocinnerleftsep}{0pt}
-\renewcommand{\etocinnerrightsep}{0pt}
-
-\newcommand\shiftedwhiterule[2]{%
- \hbox to \linewidth{\color{white}%
- \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#2}
-
-\etocsetstyle{subsubsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{\leftskip}{6pt}}
-{\sffamily\footnotesize
-\leftskip2.5cm\hangindent1cm\rightskip1cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
-\nointerlineskip\vskip3pt}
-{}
-
-\etocsetstyle{subsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{1.5cm}{6pt}}
-{\sffamily\small
-\leftskip1.5cm\hangindent1cm\rightskip1cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
-\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
-\nointerlineskip\vskip6pt}
-{}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
-\newcommand{\coloredstuff}[2]{%
- \leftskip0pt\rightskip0pt\parskip0pt
- \fboxsep0pt % \colorbox uses \fboxsep also when no frame!
- \noindent\colorbox{secbackground}
- {\parbox{\linewidth}{%
- \vskip5pt
- {\noindent\color{#1}#2\par}\nointerlineskip
- \vskip3pt}}%
- \par\nointerlineskip}
+\filecontentsexec\filecontentsheremacro
% v1.07l on the occasion of traduction into German documentation
% APRIL 26, 2014 Improvement in the section style for better placement of
% page number when the section name is more than one line long. Use of
% \makebox rather than \hbox, to be more LaTeX like.
-\etocsetstyle{section}
-{\coloredstuff{white}
- {\hfil \hyperref[toc:b]
- {\bfseries\large Ich bin der Zwilling von diesem
- Verzeichnis (Klick mich an!)}%
- \hfil}}
-{\vskip3pt\sffamily\small}
-{\coloredstuff{white}
- {\leftskip1.5cm\rightskip.5cm\parfillskip-\rightskip
- \makebox[0pt][r]{\makebox[.5cm][r]{\etocnumber\hspace{.2cm}}}%
- \etocname\hfill\makebox[.5cm][r]{\etocpage\hspace{.2cm}}}%
- \vskip6pt }
-{}
-
-\etocframedstyle[1]{}
-
-\begin{figure}[ht!]\centering
- \tableofcontents \label{toc:clone} \ref{toc:globalcmds}
-\end{figure}
-\endgroup
Das Inhaltsverzeichnis befindet sich in einer
\hyperref[toc:clone]{float}-Umgebung, die man \vpageref{toc:clone} findet. Da
@@ -10884,7 +9949,6 @@ Alle Befehle, welche die Farbe verändern, sind in \etoc zu Beginn so definiert,
dass sie nichts verändern. Daher kann der Nutzer selbst entscheiden, ob er
Farben nutzen will oder nicht.
-
\clearpage
\etocdepthtag.toc {tips}
@@ -10902,28 +9966,21 @@ Farben nutzen will oder nicht.
\section{Hacken "`framed parboxes"'}
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\etocdefaultlines
\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.}}}}
+ unter Berücksichtigung der \emph{surrounding horizontal rules.}}}}}
\ref{toc:globalcmds}
-\end{verbatim}
-
-\etocdefaultlines
-
-\renewcommand\etoctoprule{\hrule height 2pt depth 2pt}
+\end{filecontentsdef}
-\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}
+\filecontentsexec\foo
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{Umstellen der Ebenen}
\label{subsec:interverting}
@@ -10990,7 +10047,7 @@ im Code von \autoref{sec:molecule} vorgestellt. Wir präsentieren auch diese
zweite Methode.
Aber als Erstes der Code von \csa{thispartstats}:\par
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
\newsavebox\firstnamei \newsavebox\firstnumberi
\newsavebox\lastnamei \newsavebox\lastnumberi
\newsavebox\firstnameii \newsavebox\firstnumberii
@@ -11044,11 +10101,11 @@ Aber als Erstes der Code von \csa{thispartstats}:\par
\localtableofcontents % to be used at the top level of a Part.
\endgroup
}
-\end{verbatim}
-
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-A.tex}
Und nun, die Variante mit Makros anstelle von der mit Boxen (diese Variante
steht hier für die Verwendung in einem Kapitel).
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
\makeatletter
\newcommand*\firstsubname {} \newcommand*\lastsubname {}
\newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {}
@@ -11079,7 +10136,8 @@ steht hier für die Verwendung in einem Kapitel).
\endgroup
}
\makeatother
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}-B.tex}
\section{Tiefe Tags nehmen}
\label{ssec:tocwithdepthtags}
@@ -11104,84 +10162,19 @@ unter den Zahlen leer, im Gegensatz zu dem Code von \autoref{sec:firstexample}).
Und nach ein paar Minuten für die Wahl der Längen (jetzt ist das erstmal getan,
es kann leicht recycelt) erhalten wir:
-\etocsetnexttocdepth {all}
-\begingroup
-\parindent 0pt
-\leftskip 0cm
-\rightskip 0.75cm
-\parfillskip -\rightskip
-\newcommand*{\EndParWithPagenoInMargin}
- {\nobreak\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
- \par}
-\renewcommand*\etoctoclineleaders
- {\hbox{\normalfont\normalsize\hbox to .75ex {\hss.\hss}}}
-\newcommand*{\EndParWithPagenoInMarginAndLeaders}
- {\nobreak\leaders\etoctoclineleaders\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
- \par }
-\etocsetstyle {part}
- {}
- {\leavevmode\leftskip 1cm\relax}
- {\bfseries\large\llap{\makebox[1cm][r]{\etocnumber\ \ }}%
- \etocname\EndParWithPagenoInMargin\smallskip}
- {}
-\etocsetstyle {section}
- {}
- {\leavevmode\leftskip 1.75cm\relax}
- {\bfseries\normalsize\llap{\makebox[.75cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {subsection}
- {}
- {\leavevmode\leftskip 2.75cm\relax }
- {\mdseries\normalsize\llap{\makebox[1cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {subsubsection}
- {}
- {\leavevmode\leftskip 4cm\relax }
- {\mdseries\normalsize\llap{\makebox[1.25cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsetstyle {paragraph}
- {}
- {\leavevmode\leftskip 5.5cm\relax }
- {\mdseries\normalsize\llap{\makebox[1.5cm][l]{\etocnumber}}%
- \etocname\EndParWithPagenoInMarginAndLeaders}
- {}
-\etocsettagdepth {preamble} {none}
-\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {part}
-\etocsettagdepth {linestyles} {part}
-\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}}
-\renewcommand\etocaftercontentshook
- {\medskip\begingroup \color{blue}\hrule height 3pt \endgroup }
-\etocruledstyle [1]{\Large\bfseries
- \fbox{\makebox[8cm]{Ein TOC -- nehmend tiefe Tags}}}
-\sloppy
-\tableofcontents
-
-\begin{verbatim}
+\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
\etocsetnexttocdepth {all}
\begingroup
\parindent 0pt \leftskip 0cm \rightskip .75cm \parfillskip -\rightskip
\newcommand*{\EndParWithPagenoInMargin}
{\nobreak\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
+ \makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
\par}
\renewcommand*\etoctoclineleaders
{\hbox{\normalfont\normalsize\hbox to .75ex {\hss.\hss}}}
\newcommand*{\EndParWithPagenoInMarginAndLeaders}
{\nobreak\leaders\etoctoclineleaders\hfill
- \nobreak\makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
+ \makebox[0.75cm][r]{\mdseries\normalsize\etocpage}%
\par }
\etocsetstyle {part}
{}
@@ -11215,13 +10208,14 @@ es kann leicht recycelt) erhalten wir:
{}
\etocsettagdepth {preamble} {none}
\etocsettagdepth {overview} {part}
-\etocsettagdepth {arbitrarily}{part}
-\etocsettagdepth {surprising} {part}
-\etocsettagdepth {linestyles} {part}
+%\etocsettagdepth {arbitrarily}{part}% not needed explicitely, keeps value
+%\etocsettagdepth {examples} {part}
+%\etocsettagdepth {surprising} {part}
+%\etocsettagdepth {linestyles} {part}
\etocsettagdepth {globalcmds} {paragraph}
\etocsettagdepth {custom} {part}
-\etocsettagdepth {tips} {part}
-\etocsettagdepth {etocandworld}{part}
+%\etocsettagdepth {tips} {part}
+%\etocsettagdepth {etocandworld}{part}
\etocsettagdepth {code} {none}
\renewcommand\etoctoprule {\hrule height 3pt\relax }
\renewcommand\etoctoprulecolorcmd {\color{blue}}
@@ -11232,8 +10226,12 @@ es kann leicht recycelt) erhalten wir:
\sloppy
\tableofcontents
\endgroup
-\end{verbatim}
-\endgroup
+\end{filecontentsdef}
+
+\filecontentsexec\foo
+
+\filecontentsprint\foo
+\attachfile{etocsnippet-\the\value{section}.tex}
\section{Das TOC als eine Tabelle setzend (die alte Weise)}
\label{ssec:tocastableold}
@@ -11276,12 +10274,15 @@ Anleitungen zu ändern, etc. \ldots ). Und wir sind weniger anfällig,
potentielle Opfer von verschiedenen Fallen bei externen Makros
innerhalb der |.toc|-Datei aus anderen Paketen stammend.
+% unexpanded avait été traduit en allemand :-((
+% corrigé seulement le 25 septembre 2016
+
Hinweis: Anstatt |\toks|-Register wäre es hier einfacher, \eTeX{}
-zu verwenden, \csa{ nicht expandierte} Primitive. Sehen Sie dazu
+\csa{unexpanded} Primitive zu verwenden. Sehen Sie dazu
zum Beispiel \autoref{sec:mindmap}.
-\begin{verbatim}
+\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
\newtoks\toctabletok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}}
@@ -11328,44 +10329,85 @@ zum Beispiel \autoref{sec:mindmap}.
\tableofcontents
\the\toctabletok
\endgroup
-\end{verbatim}
+\end{filecontentshere}
+\attachfile{etocsnippet-\the\value{section}.tex}
-\clearpage
+% ATTENTION Dimanche 25 septembre 2016 à 18:56:50
+% je retire le \clearpage car il y a une page quasi-vide à l'exception de
+% l'icône Paperclip.
+
+% \clearpage
\etocdepthtag.toc {etocandworld}
\part{\etoc und die Außenwelt}
\section{Kompatibilität mit anderen Paketen}\label{sec:kompatmitanderen}
-% JFBU modifiziert Januar 23, 2015
+\subsection{Generelle Informationen}
+
Die Inhalte der |.toc|-Datei (falls bereits vorhanden) werden einmal in den
Speicher von \etoc getan, bei |\begin{document}|. \footnote{Neu mit |1.07m|.
Früherer Versionen benutzten die |.toc|-Datei bei
\csa{usepackage\{etoc\}}. Danke an Denis Bitouzé für ein Babel-etoc
Problem entdecken zu haben.}
-\begin{framed}
- Man sollte \etoc \emph{nach} \texttt{babel} laden.
-\end{framed}
-
Die |.toc|-Datei bleibt für andere Pakete nutzbar für
Lesevorgänge bis zum Ort des ersten Inhaltsverzeichnisses, zu diesem
Zeitpunkt wird ein Schreib-stream durch \etoc geöffnet und von diesem Punkt
aus wird die Datei gelöscht bis ihr Inhalt wieder auf die Platte von
\LaTeX{} am Ende der Kompilierung geschrieben wurde.
-\etoc lädt das Paket |multicol|.
-
\etoc erwartet die Sektionierungseinheiten des Dokuments, um ihre Daten in eine
Datei mit der Endung |.toc| zu schreiben, in Form von Linien, die enthalten den
\csa{contentsline}"=Befehl und dessen Argumente.
\etoc erfordert von der |.toc|-Datei, das |\contentsline|-Makro zu
-verwenden (möglicherweise von anderen Paketen belegt). So ist es
-inkompatibel mit der |beamer|-Klasse. Wie auch immer, wenn
-|beamer|im article-Modus verwendet wird, d.\,h. die article-Klasse
-in Verbindung mit dem |beamerarticle|-Paket, dann sollte \etoc
-arbeiten.
+verwenden (möglicherweise von anderen Paketen belegt).
+
+\etoc kann nicht wirklich mit Paketen zusammensein, die
+\csa{tableofcontents}"=Befehle ändern: Eine Art Waffenstilstand kann erreicht
+werden, wenn \etoc zuletzt geladen wird, daher ist es der Gewinner.
+ \begin{framed}
+ Ändern Sie nicht den |\tableofcontents|"=Befehl, wie diesen folgenden:
+ \centeredline{|\let\oldtableofcontents\tableofcontents|,}
+ \centeredline{|\renewcommand\tableofcontents{\oldtableofcontents\mystuff}|,}
+ da dies den |\label/\ref|-Mechanismus unmöglich macht. Sie können vielmehr
+ \centeredline{|\renewcommand\etocaftertochook{\mystuff}|} ausführen und es
+ ergibt auch \csb{etocaftercontentshook}, das führt ein bisschen eher
+ \footnotemark{} aus, gerade vor dem Schließen des Teils vom toc"=Anzeigestil
+ (und damit innerhalb einer Gruppe).
+ \end{framed}
+\footnotetext{Im Gegensatz zu \csa{etocaftertochook},
+ \csa{etocaftercontentshook} wird nicht ausgeführt, wenn |tocdepth| das
+ Drucken des TOC nicht ermöglicht.}
+
+%
+
+\begin{otherlanguage}{english}
+ Don't use |\if<condition> stuff \tableofcontents\fi|, but:
+ \centeredline{|\if<condition> stuff \expandafter\tableofcontents\fi|}
+ Also a |\else| immediately following \csa{tableofcontents} or
+ \csa{localtableofcontents} requires a previous \csa{expandafter}.
+\end{otherlanguage}
+
+\subsection{Kompatibilität mit \texttt{beamer}}
+
+\etoc steht inkompatibel mit der |beamer|-Klasse. Aber, wenn |beamer| im
+article-Modus verwendet wird, d.\,h. die article-Klasse in Verbindung
+mit dem |beamerarticle|-Paket, dann sollte \etoc arbeiten.
+
+\subsection{Kompatibilität mit \texttt{Babel}}
+
+\begin{framed}
+ Man sollte \etoc \emph{nach} \texttt{babel} laden.
+\end{framed}
+
+\subsection{Kompatibilität mit \texttt{hyperref}}
+
+\begin{otherlanguage}{english}
+ Please inform the author in case of issues: \etoc was from the start
+ designed to be |100%| compatible with package |hyperref|.
+\end{otherlanguage}
Es ist |hyperref| bekannt und hoffentlich kompatibel mit ihm: die Macros
\csa{etocname}, \csa{etocnumber} und \csa{etocpage} enthalten die
@@ -11375,6 +10417,12 @@ Seitenzahl zu setzen ist, für ein einen toc"=Eintrag.). Beispielsweise sind die
Inhaltsverzeichnisse des vorliegenden Dokuments komplett verlinkt.
Es ist kein Thema, ob \etoc vor oder nach |hyperref| geladen wird.
+\subsection{Kompatibilität mit \texttt{multicol}}
+
+\etoc lädt das Paket |multicol|.
+
+\subsection{Kompatibilität mit \texttt{tocloft}}\label{subs:tocloft}
+
Die Release |1.07k| fügt Kompatibilität mit dem Paket |tocloft| hinzu:
\footnote{\url{http://ctan.org/pkg/tocloft}} Schritte wurden getan, um eine Neudefinition
von |\tableofcontents| zu vermeiden, getan von |tocloft| an |\begin{document}|.
@@ -11395,6 +10443,13 @@ möglich.
ausgegeben.
\end{framed}
+Es ist möglich (unter Verwendung des Pakets|tocloft| beispielsweise), im
+gesamten Dokument die Makros \csa{l@section}, \csa{l@subsection} \ldots{} zu
+benutzen und der Effekt wird im nächsten Inhaltsverzeichnis durch den
+Kompatibilitätsmodus von \etoc sichtbar werden.
+
+\subsection{Kompatibilität mit der \texttt{memoir}-Klasse}
+
Die Release |1.07l| hat ebenfalls die Kompatibilität mit der |memoir|-Klasse
verbessert: Seine |appendix|-Ebene kann mit \etoc gemacht werden. Es ist die
gleiche Ebene wie wie bei |chapter|, also der Kapitelebenstil kann eventuell ein
@@ -11402,41 +10457,19 @@ Test für einige boolesche"=Ausdrücke sein, die aktiviert sein können via eine
Instruktion an die |.toc|-Datei aufgenommen werden, wenn man zwei Arten von
Unterteilungen unterscheidet.
-\etoc kann nicht wirklich mit Paketen zusammensein, die
-\csa{tableofcontents}"=Befehle ändern: Eine Art Waffenstilstand kann erreicht
-werden, wenn \etoc zuletzt geladen wird, daher ist es der Gewinner.
- \begin{framed}
- Ändern Sie nicht den |\tableofcontents|"=Befehl, wie diesen folgenden:
- \centeredline{|\let\oldtableofcontents\tableofcontents|,}
- \centeredline{|\renewcommand\tableofcontents{\oldtableofcontents\mystuff}|,}
- da dies den |\label/\ref|-Mechanismus unmöglich macht. Sie können vielmehr
- \centeredline{|\renewcommand\etocaftertochook{\mystuff}|} ausführen und es
- ergibt auch \csb{etocaftercontentshook}, das führt ein bisschen eher
- \footnotemark{} aus, gerade vor dem Schließen des Teils vom toc"=Anzeigestil
- (und damit innerhalb einer Gruppe).
- \end{framed}
-\footnotetext{Im Gegensatz zu \csa{etocaftertochook},
- \csa{etocaftercontentshook} wird nicht ausgeführt, wenn |tocdepth| das
- Drucken des TOC nicht ermöglicht.}
+\subsection{Kompatibilität mit \texttt{tocvsec2}}
+
+% la traduction allemande était déficiente semble-t-il, j'améliore un peu
+% Dimanche 25 septembre 2016 à 11:02:43
-\etoc zu verwenden, kann unvereinbar sein mit dem Paket
-|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}}; jetzt lebt es ,
-sortierend, wie es deaktiviert die Modifikationen des |\tableofcontents| durch
-|tocvsec2| (getan im Stile von oben) und es kanzelt auch andere |toc|-bezogene
-Macros, aber es reimplantiert partiell ihre Funktionalität mit
-\csb{etocsettocdepth.toc}. In der Art und Weise, die letzten beiden \LaTeX-Läufe
-sind für das erneute Nehmen des Befehls in einem Dokument notwendig, um einen
+\etoc deaktiviert die Modifikationen des |\tableofcontents| durch
+|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}} und es kanzelt
+auch andere |toc|-bezogene Macros, aber es reimplantiert partiell ihre
+Funktionalität mit \csb{etocsettocdepth.toc}. Zwei \LaTeX-Läufe sind für
+das erneute Nehmen des Befehls in einem Dokument notwendig, um einen
Effekt im Inhaltsverzeichnis zu haben.
-
-Wenn ein \localtoc durch den Nutzer in das Dokument aufgenommen wird, eine
-Zeile, in einen inneren \etoc"=Befehl und eine Identifikationszahl in die
-|.toc|-Datei aufgenommen wird. Das korrekte Inhaltsverzeichnis wird nur nach dem
-nächsten \LaTeX -Lauf angezeigt werden.
-Es ist möglich (unter Verwendung des Pakets|tocloft| beispielsweise), im
-gesamten Dokument die Makros \csa{l@section}, \csa{l@subsection} \ldots{} zu
-benutzen und der Effekt wird im nächsten Inhaltsverzeichnis durch den
-Kompatibilitätsmodus von \etoc sichtbar werden.
+\subsection{Kompatibilität mit \texttt{tableof}}
Es ist möglich, \etoc und {\color{niceone}|tableof|}
\footnote{\url{http://ctan.org/pkg/tableof}} gleichzeitig zu
@@ -11456,6 +10489,11 @@ den \etoc-Tiefenauszeichnungen, wie erklärt in der
ausgegeben wurde; es sei denn, ihr Skopus wurde da beendet oder
\csb{etoclocaldefs} hat seine Einflussnahme abgebrochen.
+\subsection{Kompatibilität mit \texttt{tocstyle}}
+
+Nicht bekannt. (not tested a.t.t.o.w).
+
+
\section{\TeX -nische Sachen}
Die \csa{etocname}, \csa{etocnumber}, \csa{etocpage} Befehle sind gegen
@@ -11473,6 +10511,12 @@ Befehle wie \csb{etocsetstyle}, \csb{etocsetlevel}, \csb{etocsettocstyle},
\csb{etocmulticolstyle}, \csb{etocruledstyle}, \csb{etocframedstyle} folgen
Gruppierungen von \LaTeX. Alle TOCs werden in Gruppierungen gesetzt.
+Wenn ein \localtoc durch den Nutzer in das Dokument aufgenommen wird, eine
+Zeile, in einen inneren \etoc"=Befehl und eine Identifikationszahl in die
+|.toc|-Datei aufgenommen wird. Das korrekte Inhaltsverzeichnis wird nur nach dem
+nächsten \LaTeX -Lauf angezeigt werden.
+
+
\section{Fehler und Katastrophen}
Nach der Verwendung von \csa{etocsetstyle}für eine Ebene nehmen die restlichen,
@@ -11503,9 +10547,14 @@ Aussehen zu erhalten (mindestens zweimal durchlaufen).
\section{Zeitstempel}
-Dies ist die deutsche Dokumentation von \texttt{\etocDEdocdate}, erzeugt von der
-Quelldatei mit dem Stempel \texttt{\etocdtxtimestamp}. Die dokumentierte
-Paketversion ist \texttt{\etocDEpkgversion} von \texttt{\etocDEpkgdate}.
+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.
+
+Dokumentation erzeugt von der Quelldatei mit dem Stempel
+\texttt{\etocdtxtimestamp}. Die dokumentierte Paketversion ist
+\texttt{\etocpkgversion} von \texttt{\etocDEpkgdate}.
% STOP GERMAN (DEUTSCH) VERSION
@@ -11576,7 +10625,24 @@ Paketversion ist \texttt{\etocDEpkgversion} von \texttt{\etocDEpkgdate}.
\begin{multicols}{2}
\begin{jfverbatim}
-v1.08g [2015/08/29]^
+v1.08h [2016/09/25]^
+
+ New functioning of \etocsetnexttocdepth: the tocdepth counter is
+ modified only at the time of the table of contents, not before.
+ This fixes an issue which arose when \etocsetnexttocdepth was used
+ multiple times with no intervening table of contents.
+
+ The PDF documentation includes about 25 LaTeX code snippets also
+ as file attachment annotations, additionally to their verbatim
+ typesetting. The ordering of the documentation contents has been
+ slightly re-organized.
+
+ A previous documentation-only update on 2016/09/09 added a new
+ section with the (approximate) translation into etoc lingua of the
+ book class toc style, for easy customizability.
+
+
+~v1.08g [2015/08/29]^
Downgraded to a mere info message the etoc-issued warning
(relative to \settocdepth/\maxtocdepth) under class memoir.
@@ -11902,36 +10968,35 @@ v1.08g [2015/08/29]^
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 thrice latex on etoc.tex, then dvipdfmx on etoc.dvi.\endgraf
+ \ \ \ \ then thrice pdflatex on etoc.tex.\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
- to set \string\NoSourceCode\space to 0, and run latex thrice on etoc-DE.tex
- then dvipdfmx on etoc-DE.dvi\endgraf
- \medskip
- (ignore dvipdfmx warnings, or, in case of problems caused by an old version
- of dvipdfmx, set \string\Withdvipdfmx\space to 0 in etoc.tex or
- etoc-DE.tex, to compile with pdflatex)\endgraf }%
+ to set \string\NoSourceCode\space to 0, and run pdflatex thrice on etoc-DE.tex.\endgraf
+}%
\fi
\ifnum\ForDeutsch=1
\texttt{\hyphenchar\font-1
\parindent 0pt\rightskip 0.5cm minus 0.5cm \selectlanguage{ngerman}%
- Diese Dokumentation wurde ohne Einbeziehung des Quellcodes erstellt. Um
- die englische Dokumentation mit dem Quellcode zu produzieren, ist
- einzubeziehen: \endgraf
- \ \ \ \ kompilieren etex mit etoc.dtx oder etoc.ins, um etoc.tex zu
- produzieren, \endgraf
- \ \ \ \ dann viermal latex mit etoc.tex, dann dvipdfmx mit etoc.dvi.\endgraf
- \medskip
+ Diese Dokumentation wurde ohne Einbeziehung des Quellcodes
+ erstellt.
+ % Um
+ % die englische Dokumentation mit dem Quellcode zu produzieren, ist
+ % einzubeziehen: \endgraf
+ % \ \ \ \ kompilieren etex mit etoc.dtx oder etoc.ins, um etoc.tex zu
+ % produzieren, \endgraf
+ % \ \ \ \ dann dreimal pdflatex mit etoc.tex.\endgraf
+ \endgraf
Um die deutsche Dokumentation mit Einbeziehung des Quellcodes zu erstellen,
ist zu kompilieren etex mit etoc.dtx oder etoc.ins, um etoc-DE.tex zu
erzeugen, dann ist \string\NoSourceCode\space in etoc-DE.tex auf 0 zu
- setzen, dann ist latex dreimal mit etoc-DE.tex laufen zu lassen, dann
- dvipdfmx mit etoc-DE.dvi.\endgraf
- \medskip
- (Ignorieren Sie dvipdfmx-Warnungen oder, im Falle von Problemen mit einer
- alten Version von dvipdfmx, setzen Sie \string\Withdvipdfmx\space auf 0 in
- etoc.tex oder etoc-DE.tex um dann pdflatex laufen zu lassen.)\endgraf }%
+ setzen, dann ist pdflatex dreimal mit etoc-DE.tex laufen zu lassen.\endgraf
+ % \medskip
+ % (Ignorieren Sie dvipdfmx-Warnungen oder, im Falle von Problemen mit einer
+ % alten Version von dvipdfmx, setzen Sie \string\Withdvipdfmx\space auf 0 in
+ % etoc.tex oder etoc-DE.tex um dann pdflatex laufen zu
+ % lassen.)\endgraf }%
+ }%
\fi
\fi
\end{document}}
@@ -12927,8 +11992,8 @@ v1.08g [2015/08/29]^
\fi
\@gobble\etoc@
\endgroup\ifEtoc@mustclosegroup\endgroup\fi
- \Etoc@aftertochook % 1.07h
- \etocaftertochook % 1.07g
+ \Etoc@tocdepthreset % 1.07h, renamed 1.08h
+ \etocaftertochook % 1.07g
}
% \end{macrocode}
% |2013/03/07|: I discover a \csa{@namedef} trick to construct the
@@ -12985,8 +12050,8 @@ v1.08g [2015/08/29]^
\Etoc@tableofcontents
\fi
\endgroup\ifEtoc@mustclosegroup\endgroup\fi
- \Etoc@aftertochook % 1.07h
- \etocaftertochook % 1.07g
+ \Etoc@tocdepthreset % 1.07h, renamed 1.08h
+ \etocaftertochook % 1.07g
\@gobble\etoc@
}
% \end{macrocode}
@@ -13018,6 +12083,7 @@ v1.08g [2015/08/29]^
\let\etocaftercontentshook \@empty
\def\etoctableofcontents{%
\Etoc@openouttoc
+ \Etoc@tocdepthset % new with 1.08h
\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
@@ -13035,6 +12101,7 @@ v1.08g [2015/08/29]^
\let\tableofcontents\etoctableofcontents
\newcommand*\localtableofcontents{%
\Etoc@openouttoc
+ \Etoc@tocdepthset % new with 1.08h
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
\let\tof@begingroup\@empty
\let\tof@endgroup \@empty
@@ -13889,7 +12956,12 @@ v1.08g [2015/08/29]^
}%
}%
% \end{macrocode}
-% |1.07g|
+% |1.07g|. Initial version of \csa{etocsetnexttocdepth}.
+%
+% |1.08h|: avoid after-effect of consecutive uses of \csa{etocsetnexttocdepth}
+% with no intervening TOC, due to the fact that the command did an immediate
+% modification of the |tocdepth counter|. This is now delayed until
+% the actual TOC typesetting.
% \begin{macrocode}
\def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }%
\def\invisiblelocaltableofcontents
@@ -13898,9 +12970,12 @@ v1.08g [2015/08/29]^
\@ifundefined{Etoc@#1@@}
{\PackageWarning{etoc}
{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}%
+ {\def\Etoc@tocdepthset
+ {\edef\Etoc@tocdepthreset {%
+ \global\c@tocdepth\the\c@tocdepth\space
+ \global\let\noexpand\Etoc@tocdepthreset\noexpand\@empty }%
+ \global\c@tocdepth\csname Etoc@#1@@\endcsname
+ \global\let\Etoc@tocdepthset\@empty}}%
}%
% \end{macrocode}
% |1.07h|. In order for the |.toc| file to be usable without error even
@@ -13920,8 +12995,9 @@ v1.08g [2015/08/29]^
\etocstandarddisplaystyle
\etocobeytoctocdepth
\etocobeydepthtags
-\let\Etoc@aftertochook\@empty % private for \etocsetnexttocdepth
-\let\etocaftertochook \@empty % public for end user.
+\let\Etoc@tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth
+\let\Etoc@tocdepthset \@empty %
+\let\etocaftertochook \@empty % public for end user.
\let\etocbeforetitlehook \@empty % new with 1.07m
\endinput
% \end{macrocode}
@@ -13942,7 +13018,7 @@ v1.08g [2015/08/29]^
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum{3157}
+\CheckSum{3169}
\csname check@checksum\endcsname
\Finale