summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/etoc/README196
-rw-r--r--Master/texmf-dist/doc/latex/etoc/etoc.pdfbin257856 -> 277593 bytes
-rw-r--r--Master/texmf-dist/doc/latex/etoc/etoc.tex25
-rw-r--r--Master/texmf-dist/source/latex/etoc/etoc.dtx2643
-rw-r--r--Master/texmf-dist/source/latex/etoc/etoc.ins57
-rw-r--r--Master/texmf-dist/tex/latex/etoc/etoc.sty270
6 files changed, 1975 insertions, 1216 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/README b/Master/texmf-dist/doc/latex/etoc/README
index 5c09f2f9709..7ae6716ecdf 100644
--- a/Master/texmf-dist/doc/latex/etoc/README
+++ b/Master/texmf-dist/doc/latex/etoc/README
@@ -1,156 +1,86 @@
-version 1.07f dated 2013/03/07
-documentation dated 2013/05/14
-
-Package `etoc'
-Completely customisable TOCs
-Copyright (C) 2012, 2013 by Jean-Francois Burnol
-
-LICENSE
-=======
-
- The copyright and license statement applies to `etoc.dtx' and to
- its derived files.
-
- 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
- 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.
+%
+% Package: etoc
+% Version: 2013/10/13 v1.07g
+% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
+%
+ 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
+ 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.
+
+ This Work has the LPPL maintenance status Author-Maintained.
+
+ The Author of this Work is Jean-Francois Burnol <jfbu at free dot fr>.
- The author of this work is Jean-Francois Burnol <jfbu at free dot fr>.
- This work has the LPPL maintenance status `author-maintained'.
-
-INSTALLATION
-============
-
- `latex etoc.dtx' --> this extracts the style file `etoc.sty'
-
- `latex etoc.dtx' (twice more) finishes producing the documentation
-
- Move `etoc.sty' to a suitable location within the TeX installation:
- etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty
-
- The generated auxiliary files may be discarded.
+ This Work consists of the main source file etoc.dtx and the
+ derived files etoc.sty, etoc.ins, etoc.tex, etoc.dvi, etoc.pdf
+
ABSTRACT
========
The etoc package gives to the user complete control on how
the entries of the table of contents should be constituted
- from the name, number, and page number of each sectioning
- unit. This goes via the definition of line styles for each
- sectioning level used in the document. The package provides
- its own custom line styles. Simpler ones are given as
- examples in the documentation. The simplest usage will be to
- take advantage of the layout facilities of packages dealing
- with list environments.
-
- The \tableofcontents command may be used arbitrarily many
- times and it has a variant \localtableofcontents which
- prints tables of contents `local' to the current surrounding
- document unit. An extension of the \label/\ref syntax allows
- to reproduce (with another layout) a TOC defined somewhere
- else in the document.
+ from the {name}, {number}, and {page number}
+ of each sectioning unit. This goes via the definition of
+ {line styles} for each sectioning level used in the
+ document. The package provides its own custom line styles.
+ Simpler ones are given as examples in the documentation. The
+ simplest usage will be to take advantage of the layout facilities
+ of packages dealing with list environments.
+
+ The \tableofcontents command may be used arbitrarily
+ many times and it has a variant \localtableofcontents
+ which prints tables of contents `local' to the current
+ surrounding document unit. An extension of the
+ \label/\ref syntax allows to reproduce (with another
+ layout) a TOC defined somewhere else in the document.
The formatting inherited (and possibly customized by other
packages) from the document class may also be used in
- compatibility mode. Regarding the global toc display, etoc
- provides pre-defined styles based on a multi-column format,
- optionally with a frame or a ruled title.
+ {compatibility mode}. Regarding the {global toc
+ display}, etoc provides pre-defined styles based on a
+ multi-column format, optionally with a frame or a ruled
+ title.
As the assignment of levels to the sectioning units can be
changed at any time, etoc can be used in a quite general
- manner to also create custom "lists of", additionally to the
- tables of contents related to the document sectioning units.
- No auxiliary file is used apart from the usual .toc file.
-
-
-Change log
-==========
-
- v1.07f [2013/03/07]
-
- new macros \etocthelinkedname, \etocthelinkednumber,
- \etocthelinkedpage, and \etocthelink.
-
-
- v1.07e [2013/03/01]
-
- improvements in the package own line styles with
- regards to penalties and vertical spaces.
-
- addition to the documentation of an example of
- a tree-like table of contents (uses tikz).
-
- more such examples added 2013/03/03.
-
-
- v1.07d [2013/02/24]
-
- minor code improvements and new documentation
- section "Another compatibility mode".
+ manner to also create custom ``lists of'', additionally to
+ the tables of contents related to the document sectioning
+ units. No auxiliary file is used additionally to the
+ standard .toc file.
- v1.07b [2013/02/02]
-
- removal of the \xspace from the macros \etocname,
- \etocnumber, \etocpage.
-
- additional examples in the documentation.
-
-
- v1.07 [2013/01/29]
-
- new commands:
-
- \etocthename, \etocthenumber, \etocthepage, \etoclink,
-
- \etoctoccontentsline, \etoctoccontentsline*
-
- \etocnopar, \etocaftercontentshook
-
- modified command: \etocmulticolstyle
-
- new documentation section "Surprising uses of etoc" which
- explains how to do "Lists of arbitrary things", in
- addition to the tables of contents.
-
-
- v1.06 [2012/12/07]
-
- the standard macros \l@section etc... are modified only
- during the calls to \tableofcontents; they can thus be
- customized as will by the user (with the help of a
- package like tocloft) and this will be taken into account
- by etoc for the TOCs typeset in compatibility mode.
-
-
- v1.05 [2012/12/01]
-
- \localtableofcontents replaces \tableofcontents* (for
- compatibility with the memoir class).
+INSTALLATION
+============
- compatibility with KOMA-script and memoir document
- classes.
+ Extraction of the package (.sty) and driver (.tex) files:
+ - if etoc.ins is present: tex etoc.ins
+ - without etoc.ins: tex etoc.dtx
+ It is also possible to run latex/pdflatex directly on etoc.dtx
- v1.04 [2012/11/24]
+ At least three ways to produce etoc.pdf:
+ (1) latex etoc.dtx (three times), then dvips, then ps2pdf
+ (2) pdflatex etoc.dtx (three times)
+ (3) latex etoc.tex (three times), then dvipdfmx
- a (possibly local) table of contents can be labeled:
-
- \tableofcontents \label{toc:1}
+ 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/pdflatex.
- and reproduced elsewhere in the document (with a possibly
- completely different layout):
-
- \tableofcontents \ref{toc:1}
+ Installation:
-
- v1.02 [2012/11/18]
+ etoc.sty->TDS:tex/latex/etoc/etoc.sty
+ etoc.dtx->TDS:source/latex/etoc/etoc.dtx
+ etoc.pdf->TDS:doc/latex/etoc/etoc.pdf
- initial version.
+ etoc.tex, etoc.ins, etoc.aux, etoc.toc, etc... may be discarded
diff --git a/Master/texmf-dist/doc/latex/etoc/etoc.pdf b/Master/texmf-dist/doc/latex/etoc/etoc.pdf
index a4d73e5fff0..232b58a2c1f 100644
--- a/Master/texmf-dist/doc/latex/etoc/etoc.pdf
+++ b/Master/texmf-dist/doc/latex/etoc/etoc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/etoc/etoc.tex b/Master/texmf-dist/doc/latex/etoc/etoc.tex
new file mode 100644
index 00000000000..225306b0ed1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/etoc/etoc.tex
@@ -0,0 +1,25 @@
+\def\pkgname {etoc} \def\pkgdate {2013/10/13} \def\pkgversion {v1.07g}
+\def\pkgdescription {Completely customisable TOCs (jfB)}
+\def\doctimestamp {Time-stamp <13-10-2013 23:44:43 CEST *>}
+%%
+%% Package: etoc
+%% Version: 2013/10/13 v1.07g
+%% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
+%%
+%% run latex thrice on this file etoc.tex then dvipdfmx on etoc.dvi
+%% to produce the documentation etoc.pdf, with source code included.
+%%
+%% customize as desired the class options and the two toggles below.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{etoc.tex}[\pkgdate\space\pkgversion\space\pkgdescription]%
+\PassOptionsToClass{a4paper,11pt}{scrdoc}
+\chardef\Withdvipdfmx 1 % replace 1 by 0 for using latex/pdflatex, rather.
+\chardef\NoSourceCode 0 % replace 0 by 1 for the doc *without* the source code
+\input etoc.dtx
+%%% Local Variables:
+%%% mode: latex
+%%% End:
+\endinput
+%%
+%% End of file `etoc.tex'.
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx
index c5e48633f32..df664fbf2e9 100644
--- a/Master/texmf-dist/source/latex/etoc/etoc.dtx
+++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx
@@ -1,19 +1,15 @@
% -*- coding: iso-latin-1; -*-
-%<*ins>
-\def\pkgname{etoc}
-\def\pkgdate{2013/03/07}
-\def\pkgversion{v1.07f}
-\def\pkgdescription{Completely customisable TOCs (jfB)}
-%</ins>
+%<*!package>
+\def\pkgname {etoc} \def\pkgdate {2013/10/13} \def\pkgversion {v1.07g}
+\def\pkgdescription {Completely customisable TOCs (jfB)}
+\def\doctimestamp {Time-stamp <13-10-2013 23:44:43 CEST *>}
+%</!package>
%%
-%% Package `etoc' by Jean-Francois Burnol
-%% Copyright (C) 2012, 2013 by Jean-Francois Burnol
+%% Package: etoc
+%% Version: 2013/10/13 v1.07g
+%% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
%%
-%
-% The copyright statement at the top of this file applies to `etoc.dtx'
-% and to its derived files.
-%
-% This work may be distributed and/or modified under the
+% 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
@@ -23,69 +19,183 @@
% and version 1.3 or later is part of all distributions of
% LaTeX version 2005/12/01 or later.
%
-% The author of this work is Jean-Francois Burnol <jfbu at free dot fr>.
-% This work has the LPPL maintenance status `author-maintained'.
+% This Work has the LPPL maintenance status Author-Maintained.
+%
+% The Author of this Work is Jean-Francois Burnol <jfbu at free dot fr>.
%
-% Installation:
-% ============
+% This Work consists of the main source file etoc.dtx and the
+% derived files etoc.sty, etoc.ins, etoc.tex, etoc.dvi, etoc.pdf
%
-% `latex etoc.dtx' --> this extracts the style file `etoc.sty'
+% Extraction of the package (.sty) and driver (.tex) files:
+% - if etoc.ins is present: tex etoc.ins
+% - without etoc.ins: tex etoc.dtx
%
-% `latex etoc.dtx' (twice more) finishes producing the documentation
+% It is also possible to run latex/pdflatex directly on etoc.dtx
%
-% Move `etoc.sty' to a suitable location within the TeX installation:
-% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty
+% At least three ways to produce etoc.pdf:
+% (1) latex etoc.dtx (three times), then dvips, then ps2pdf
+% (2) pdflatex etoc.dtx (three times)
+% (3) latex etoc.tex (three times), 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/pdflatex.
+%
+% Installation:
+%
+% etoc.sty->TDS:tex/latex/etoc/etoc.sty
+% etoc.dtx->TDS:source/latex/etoc/etoc.dtx
+% etoc.pdf->TDS:doc/latex/etoc/etoc.pdf
+%
+% etoc.tex, etoc.ins, etoc.aux, etoc.toc, etc... may be discarded
%
-% The generated auxiliary files may be discarded.
-%
%<*none>
-\def\lasttimestamp{Time-stamp: <14-05-2013 16:34:59 CEST jfb>}
-\def\docdate{2013/05/14}
-\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4}
-\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp}
-\ProvidesFile{\pkgname.dtx}
- [`\pkgname' source and documentation (\dtxtimestamp)]
-\begingroup
-\input docstrip.tex
-\askforoverwritefalse
-\def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
-\string\ProvidesPackage{\pkgname}^^J%
-\space[\pkgdate\space\pkgversion\space\pkgdescription]}
-\generate{\nopreamble
-\file{\pkgname.ins}{\from{\pkgname.dtx}{ins}}
-\usepreamble\pkgpreamble
-\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
-\endgroup
\iffalse
%</none>
-%<*ins>
-%-------------------------------------------------------------------------------
-%% This file `etoc.ins' is provided for compatibility with TeX distributions
-%% expecting to find it for installation of `etoc.sty'.
+%<*driver>----------------------------------------------------------------------
+%% run latex thrice on this file etoc.tex then dvipdfmx on etoc.dvi
+%% to produce the documentation etoc.pdf, with source code included.
+%%
+%% customize as desired the class options and the two toggles below.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{etoc.tex}[\pkgdate\space\pkgversion\space\pkgdescription]%
+\PassOptionsToClass{a4paper,11pt}{scrdoc}
+\chardef\Withdvipdfmx 1 % replace 1 by 0 for using latex/pdflatex, rather.
+\chardef\NoSourceCode 0 % replace 0 by 1 for the doc *without* the source code
+\input etoc.dtx
+%%% Local Variables:
+%%% mode: latex
+%%% End:
+%</driver>----------------------------------------------------------------------
+%<*insfile>---------------------------------------------------------------------
+%% Run tex on this file to extract etoc.sty and etoc.tex from etoc.dtx
+%%
+%% At least three ways to produce etoc.pdf:
+%% (1) latex etoc.dtx (three times), then dvips, then ps2pdf
+%% (2) pdflatex etoc.dtx (three times)
+%% (3) latex etoc.tex (three times), then dvipdfmx
%%
-%% As usual `latex etoc.ins' produces `etoc.sty' from the source `etoc.dtx'
-%% (an already existing etoc.sty in the same repertory will be overwritten)
-%%
-%% Move `etoc.sty' to a suitable location:
-%% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty
+%% 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/pdflatex.
%%
-%% The generated auxiliary files may be discarded. See `etoc.dtx' for the
-%% statements of copyright and conditions of distribution or modification.
+%% Installation:
+%% etoc.sty->TDS:tex/latex/etoc/etoc.sty
+%% etoc.dtx->TDS:source/latex/etoc/etoc.dtx
+%% etoc.pdf->TDS:doc/latex/etoc/etoc.pdf
%%
\input docstrip.tex
\askforoverwritefalse
\def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
\string\ProvidesPackage{\pkgname}^^J%
-\space[\pkgdate\space\pkgversion\space\pkgdescription]}
-\generate{\usepreamble\pkgpreamble
-\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
+\space[\pkgdate\space\pkgversion\space\pkgdescription]}%
+\generate{\nopreamble
+\file{\pkgname.tex}{\from{\pkgname.dtx}{driver}}%
+\usepreamble\pkgpreamble
+\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}%
+\catcode32=13\relax% active space
+\let =\space%
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* etoc.sty}
+\Msg{*}
+\Msg{* To produce the documentation run latex thrice on file etoc.tex}
+\Msg{* and then run dvipdfmx on file etoc.dvi}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
\endbatchfile
+%</insfile>---------------------------------------------------------------------
+%<*none>------------------------------------------------------------------------
+\fi
+%
+\def\getdtxtimestamp #1 <#2 #3 #4 #5>{#2 at #3 #4}
+\edef\dtxtimestamp {\expandafter\getdtxtimestamp\doctimestamp }
+\def\getdocdate #1 <#2-#3-#4 #5 #6 #7>{#4/#3/#2}
+\edef\docdate {\expandafter\getdocdate\doctimestamp }
+\chardef\noetex 0
+\expandafter\ifx\csname numexpr\endcsname\relax \chardef\noetex 1 \fi
+\ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop
+\else
+% \ifdefined does not count as \if with Knuth tex !
+% no way to use it or \ifcsname here ! (besides hiding it in macros)
+ \expandafter\ifx\csname ProvidesFile\endcsname\relax
+ \chardef\extractfiles 0 % etex etc.. on etoc.dtx
+ \else % latex/pdflatex on etoc.tex or on etoc.dtx
+ \ProvidesFile{\pkgname.dtx}%
+ [`\pkgname' source and documentation (\dtxtimestamp)]%
+ \expandafter\ifx\csname Withdvipdfmx\endcsname\relax
+ % latex run is on etoc.dtx
+ \chardef\extractfiles 1 % 1 = extract .sty, .ins, .tex and typeset
+ \chardef\Withdvipdfmx 0 % 0 = pdflatex or latex+dvips
+ \chardef\NoSourceCode 1 %
+ \PassOptionsToClass{a4paper,11pt}{scrdoc}%
+ \else % latex run is on etoc.tex
+ \chardef\extractfiles 2 % do not extract files
+ \fi
+ \fi
+\fi
+\ifnum\extractfiles<2 % extract files
+\def\MessageDeFin{\newlinechar10 \let\Msg\message
+\Msg{********************************************************************^^J}%
+\Msg{*^^J}%
+\Msg{* To finish the installation you have to move the following^^J}%
+\Msg{* file into a directory searched by TeX:^^J}%
+\Msg{*^^J}%
+\Msg{*\space\space\space\space \pkgname.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{*^^J}%
+\Msg{* Happy TeXing!^^J}%
+\Msg{*^^J}%
+\Msg{********************************************************************^^J}%
+}%
+\begingroup
+ \input docstrip.tex
+ \askforoverwritefalse
+ \def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
+ \string\ProvidesPackage{\pkgname}^^J%
+ \space[\pkgdate\space\pkgversion\space\pkgdescription]}%
+ \generate{\nopreamble
+ \file{\pkgname.ins}{\from{\pkgname.dtx}{insfile}}%
+ \file{\pkgname.tex}{\from{\pkgname.dtx}{driver}}%
+ \usepreamble\pkgpreamble
+ \file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}%
+\endgroup
+\fi % end of file extraction
+\ifnum\extractfiles=0 % tex/etex/xetex/etc on etoc.dtx, files extracted, stop
+ \MessageDeFin\expandafter\end\fi
+% no use of docstrip to extract files if latex run was on etoc.tex
+\ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi
%-------------------------------------------------------------------------------
-%</ins>
-%<*none>
+\documentclass[abstract]{scrdoc}
+\ifnum\NoSourceCode=1 \OnlyDescription\fi
+
+\makeatletter
+\ifnum\Withdvipdfmx=1
+ \@for\@tempa:=hyperref,bookmark,graphicx,xcolor\do
+ {\PassOptionsToPackage{dvipdfmx}\@tempa}
+ %
+ \PassOptionsToPackage{dvipdfm}{geometry}
+ \PassOptionsToPackage{bookmarks=true}{hyperref}
+ \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref}
+ \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark}
+ %
+ \def\pgfsysdriver{pgfsys-dvipdfm.def}
+\else
+ \PassOptionsToPackage{bookmarks=true}{hyperref}
\fi
-\documentclass[a4paper,11pt,abstract]{scrdoc}
-%%\OnlyDescription
+\makeatother
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
@@ -96,7 +206,7 @@
% 2013/03/07.
% This macro allows to conveniently center a line inside a paragraph and still
% use there in \verb or other commands changing catcodes.
-% A proposito, \centerline uses \hsize and not \linewidth!!!
+% Note: \centerline in LaTeX still uses \hsize and not \linewidth/\columnwidth
\def\@centeredline {\hbox to \linewidth
\bgroup \hss \bgroup
\aftergroup\centeredline@ }
@@ -114,19 +224,86 @@
\let\check@percent\relax
\makeatother
-\def\MacroFont{\ttfamily\small\baselineskip12pt\relax}
+% pour les environnements verbatim
+\def\MacroFont{\ttfamily\small\hyphenchar\font45
+ \baselineskip12pt\relax}
+
+% mais \verb fait \ttfamily hardcoded!!! (contrairement au
+% \verbatim@font de latex)
+
+
+%----
+% better \verb pour doc.
+% 12 octobre 2013, importé de xint.dtx
+% je rajoute pour { afin que truc{machin puisse avoir hyphénation
+% retire \leavemmode, pas nécessaire pour emploi ici
+
+\def\MicroFont{\ttfamily\hyphenchar\font45 }
+% modif de \do@noligs: \char`#1} --> \char`#1 }
+
+\makeatletter
+% le \allowbreak provoque un espace à la fin d'une ligne
+\def\dobackslash
+{%
+ \catcode92 \active
+ \begingroup \lccode `\~=92\relax
+%% non \lowercase {\endgroup \def ~{\kern \z@ \allowbreak \char 92 }}%
+ \lowercase {\endgroup \def ~{\kern \z@ \char 92 }}%
+}%
+\def\dobraces
+{%
+ \catcode123 \active
+ \begingroup \lccode `\~=123\relax
+ \lowercase {\endgroup \def ~{\hskip \z@\@plus.1pt\@minus.1pt
+ \char 123 }}%
+ \catcode125 \active
+ \begingroup \lccode `\~=125\relax
+ \lowercase {\endgroup \def ~{\char 125 \hskip \z@\@plus.1pt\@minus.1pt }}%
+}%
+\def\do@noligs #1%
+{%
+ \catcode `#1\active
+ \begingroup \lccode `\~=`#1\relax
+ \lowercase {\endgroup \def ~{\kern \z@ \char `#1 }}%
+}%
+\def\verb
+{%
+ \relax \ifmmode\hbox\else\leavevmode\null\fi
+ \bgroup \MicroFont
+ \let\do\do@noligs \verbatim@nolig@list
+ \dobackslash
+ \dobraces
+ \let\do\@makeother \dospecials \catcode32 10
+ \catcode92 13
+ \catcode123 13 \catcode 125 13
+ \makestarlowast \@jfverb
+}%
+\def\@jfverb #1{\catcode`#1\active\lccode`\~`#1\lowercase{\let~\egroup}}%
+
+% \lowast est défini plus loin
+\begingroup
+ \catcode`* 13
+ \gdef\makestarlowast {\let*\lowast\catcode`\*\active}%
+\endgroup
+\makeatother
+%----
\usepackage{txfonts}
% m'occuper de la taille de txtt:
% au passage je supprime le \hyphenchar \font\m@ne
+% avril ?
% ATTENTION ATTENTION ATTENTION Un changement de taille comme \small semble
% déclencher (peut-être) la relecture de t1txtt.fd et quoi qu'il en soit le
% \hyphenchar est REMIS à -1 !
-\DeclareFontFamily{T1}{txtt}{}
+% update: 13 octobre 2013
+% et pourtant tailles sont ok, donc au moins cette information est
+% maintenue je ne sais donc pas exactement ce qui se passe.
+
+\DeclareFontFamily{T1}{txtt}{\hyphenchar\font 45\relax}
\DeclareFontShape{T1}{txtt}{m}{n}{ %medium
<->s*[.96] t1xtt%
}{}
@@ -173,9 +350,8 @@
<->ssub * txtt/bx/ui%
}{}
-
\usepackage{xspace}
-\usepackage{xcolor}
+\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{enumitem}
@@ -190,21 +366,31 @@
\addto\captionsenglish{\renewcommand\partname{Part}}
}
-% ok il faut ceci pour dvipdfmx:
-% \def\pgfsysdriver{pgfsys-dvipdfm.def}
-
\usepackage{tikz}
\usetikzlibrary{trees} % added for "cyclic" grow function 2013/03/02
-\usepackage{tikz-qtree}
-
-\usepackage[% dvipdfmx,
-pdfencoding=pdfdoc,bookmarks=true]{hyperref}
-
+\usepackage{forest} % switched from qtikz-tree to forest 2013/09/09
+% No problem with hyperlinks then, contrarily to qtikz-tree.
+
+% NOTE: (12 octobre)
+% - si compilation pour dvipdfmx, les arbres dans le dvi visualisés par xdvi
+% montrent correctement les textes, mais rien au point de vue graphique,
+% - si compilation pour dvips, l'arbre fait par forest est tout empilé, celui
+% fait par tikz sans forest est presque correct, les labels débordent.
+% Dans les deux cas, le résultat final dans le pdf est bon.
+% grosso modo dans l'état actuel le pdf fait 250K (dvipdfmx), 340K (pdflatex) et
+% 1M pour dvips+ps2pdf.
+
+% 9 octobre 2013, je me décide à ne plus utiliser hidelinks, mais il est tout de
+% même ajouté au .toc
+
+\usepackage[pdfencoding=pdfdoc]{hyperref}
\hypersetup{%
linktoc=all,% why is the important stuff
-bookmarksdepth=3,% in a *hard* to find README?
+%% bookmarksdepth=3,% in a *hard* to find README? anyhow, no need now 1.07g
breaklinks=true,%
-hidelinks,%
+colorlinks,%
+linkcolor=RoyalBlue,% Orchid
+urlcolor=OliveGreen,%
pdfauthor={Jean-Fran\c cois Burnol},%
pdftitle={The etoc package},%
pdfsubject={LaTeX, table of contents},%
@@ -212,20 +398,30 @@ pdfkeywords={LaTeX, table of contents},%
pdfstartview=FitH,%
pdfpagemode=UseOutlines}
-% for use when \usepackage{hyperref} is commented out
-% \makeatletter
-% \let\texorpdfstring\@firstoftwo
-% \def\hyperref[#1]#2{{#2}}
-% \def\href#1#2{{#2}}
-% \makeatother
+% added usage of package bookmark 2013/10/10
+%\usepackage[open,openlevel=1]{bookmark}
+\usepackage{bookmark}
+\usepackage{framed}
+\usepackage{varioref}
+
+
+\usepackage{etoc} % loads multicol
+
+%--------
+% 10 octobre 2013:
+\AtBeginDocument{\addtocontents{toc}{\protect\hypersetup{hidelinks}}}
+% mieux que de passer hidelinks comme option à hyperref.
+% Comme toutes les tocs sont faites dans un groupe, c'est très
+% bien. (et j'utilise \etocaftertitlehook pour autre chose)
-\usepackage{etoc} % executes \RequirePackage{multicol}
%--------
% add-ons for the new section `surprising uses of etoc' (2013/01/24)
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
- {\stepcounter{visibletoc}\etoctoccontentsline{visibletoc}{\thevisibletoc}}
+ {\stepcounter{visibletoc}%
+ \phantomsection
+ \etoctoccontentsline{visibletoc}{\thevisibletoc}}
\etocsetlevel{visibletoc}{6}
%--------
% add-ons for the `fancy TOC' (2013/01/25)
@@ -237,26 +433,23 @@ pdfpagemode=UseOutlines}
\etocsetlevel{dummysection}{6}
%--------
% for "Another compatibility mode" (2013/02/21):
+% attention au 5 qui est hard-coded (pour 1.07f c'était 3, maintenant 5)
\makeatletter
\newcommand*{\MyQuasiStandardTOC}[1]{%
\begingroup
\let\savedsectionline\l@section
\let\savedsubsectionline\l@subsection
\etocsetstyle{section}{}
- {\ifnum\etocthenumber=3
+ {\ifnum\etocthenumber=5
\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\end{multicols}\end{minipage}\par\endgroup}%
{.\par\endgroup}%
\else
\etocsetstyle{subsection}{}{}
@@ -266,13 +459,18 @@ pdfpagemode=UseOutlines}
{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
{}%
\etocstandarddisplaystyle
- \setcounter{tocdepth}{2}
+ \etocsetnexttocdepth {2}%
\tableofcontents #1
\endgroup}
\makeatother
%--------
-% 2 mars \thispartstats macro:
+% Statistics on sections and subsections in a part \thispartstats:
+% 2 mars 2013
% 7 mars je retire la phrase Click on the names or numbers to get confirmation!
+% cette version utilise des box, plutôt que des macros.
+% mais on ne peut plus alors changer de police etc...
+
+% 11 octobre, je retire les \color{teal}.
\newsavebox\firstnamei
\newsavebox\firstnumberi
@@ -290,17 +488,15 @@ pdfpagemode=UseOutlines}
\newcommand*{\oldtocdepth}{}
\newcommand*{\thispartstats}{%
- \edef\oldtocdepth{\arabic{tocdepth}}%
- \setcounter{tocdepth}{2}%
\setcounter{mycounti}{0}%
\setcounter{mycountii}{0}%
\def\thispartstatsauxi{%
- \sbox{\firstnamei}{\color{cyan}\etocname}%
- \sbox{\firstnumberi}{\color{cyan}\etocnumber}%
+ \sbox{\firstnamei}{\etocname}%
+ \sbox{\firstnumberi}{\etocnumber}%
\def\thispartstatsauxi{}}%
\def\thispartstatsauxii{%
- \sbox{\firstnameii}{\color{cyan}\etocname}%
- \sbox{\firstnumberii}{\color{cyan}\etocnumber}%
+ \sbox{\firstnameii}{\etocname}%
+ \sbox{\firstnumberii}{\etocnumber}%
\def\thispartstatsauxii{}}%
\begingroup
\etocsetstyle{subsection}
@@ -308,85 +504,60 @@ pdfpagemode=UseOutlines}
{}
{\thispartstatsauxii
\stepcounter{mycountii}%
- \sbox{\lastnameii}{\color{teal}\etocname}%
- \sbox{\lastnumberii}{\color{teal}\etocnumber}}
+ \sbox{\lastnameii}{\etocname}%
+ \sbox{\lastnumberii}{\etocnumber}}
{}
\etocsetstyle{section}
{}
{}
{\thispartstatsauxi
\stepcounter{mycounti}%
- \sbox{\lastnamei}{\color{teal}\etocname}%
- \sbox{\lastnumberi}{\color{teal}\etocnumber}}
+ \sbox{\lastnamei}{\etocname}%
+ \sbox{\lastnumberi}{\etocnumber}}
{Here are some statistics for this part: it contains \arabic{mycounti}
section\ifnum\value{mycounti}>1 s\fi{} and
\arabic{mycountii} subsection\ifnum\value{mycountii}>1 s\fi. The name of
the first section is
- \unhbox\firstnamei{} and the corresponding number is
- \unhbox\firstnumberi. The name of the last section is
- \unhbox\lastnamei{} and its number is \unhbox\lastnumberi. The name of
+ ``\unhbox\firstnamei{}'' and the corresponding number is
+ ``\unhbox\firstnumberi''. The name of the last section is
+ ``\unhbox\lastnamei{}'' and its number is
+ ``\unhbox\lastnumberi''.
+ \ifnum\value{mycountii}>0 The name of
the first subsection is
- \unhbox\firstnameii{} and the corresponding number is
- \unhbox\firstnumberii. The name of the last subsection is
- \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}%
- \etocinline % don't do a \par automatically
- \etocsettocstyle {}{}
+ ``\unhbox\firstnameii{}'' and the corresponding number is
+ ``\unhbox\firstnumberii''. The name of the last subsection is
+ ``\unhbox\lastnameii{}'' and its number is
+ ``\unhbox\lastnumberii''.\fi }%
+ \etocinline
+% october 10, 2013.
+ \etocsetnexttocdepth {2}%
+ \etocsettocstyle {\pdfbookmark[1]{Statistics}{\thepart.STATS}}{}
\localtableofcontents
\endgroup
- \setcounter{tocdepth}{\oldtocdepth}%
}
-% \makeatletter
-% \newcommand*{\restoretocdepth}{}%
-% \newcommand*{\thispartstats}[1][{part}{section}]{%
-% \edef\restoretocdepth{\noexpand\setcounter{tocdepth}{\arabic{tocdepth}}}%
-% \setcounter{tocdepth}{\csname Etoc@\@secondoftwo#1@@\endcsname}%
-% \begingroup
-% \etocsetstyle{\@secondoftwo#1}
-% {\setcounter{mycount}{0}%
-% \def\thispartstatsaux{%
-% \sbox\firstname{\color{cyan}\etocname}%
-% \sbox\firstnumber{\color{cyan}\etocnumber}%
-% \def\thispartstatsaux{}}}
-% {}
-% {\thispartstatsaux
-% \stepcounter{mycount}%
-% \sbox\lastname{\color{teal}\etocname}%
-% \sbox\lastnumber{\color{teal}\etocnumber}}
-% {this \@firstoftwo#1 has \arabic{mycount}
-% \@secondoftwo#1\ifnum\c@mycount>1 s\fi. The name of
-% its first is
-% \unhbox\firstname{} and the corresponding number is
-% \unhbox\firstnumber. The name of the last \@secondoftwo#1 is
-% \unhbox\lastname{} and its number is \unhbox\lastnumber.
-% Click on the names or numbers to get confirmation!}%
-% \etocsettocstyle{Here are some statistics for this \@firstoftwo#1: }{\par}%
-% %\etocinline
-% \localtableofcontents
-% \endgroup
-% \restoretocdepth}
-% \makeatother
-
-
-
\newcommand\toc{\csa{table\-of\-contents}\xspace}
\newcommand\localtoc{\csa{local\-table\-of\-contents}\xspace}
-\newcommand\tocb{\csb{table\-of\-contents}\xspace}
-\newcommand\localtocb{\csb{local\-table\-of\-contents}\xspace}
\newcommand\etoc{%
\texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}}{etoc}\xspace}
-\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}}
-\DeclareRobustCommand\csb[1]
-{{\color{blue}\ttfamily\hyphenchar\font45 \char`\\ #1}}
+\DeclareRobustCommand\csa [1]
+ {{\ttfamily\hyphenchar\font45 \char`\\ #1}}
+
+\DeclareRobustCommand\csb [1]
+ {\hyperref[#1] {\ttfamily\hyphenchar\font45 \char`\\ #1}}
+
+% \DeclareRobustCommand\csbnolk[1]
+% {{\color{\linkcolor}\ttfamily\hyphenchar\font45 \char`\\ #1}}
\newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
-\newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}}
+%\newcommand\csbhyp[1]{\texorpdfstring{\csbnolk{#1}}{\textbackslash #1}}
+\let\csbhyp\cshyp
\newcommand\lowast{\raisebox{-.25\height}{*}}
\newcommand\starit[1]{\csa{#1\lowast}}
-\newcommand\staritb[1]{\csb{#1\lowast}}
+\newcommand\staritb[1]{\csb{#1}\lowast}
\hyphenation{toc-depth sec-num-depth etoc-framed-style etoc-ruled-style}
@@ -404,13 +575,16 @@ pdfpagemode=UseOutlines}
\renewcommand\familydefault\sfdefault
+% for illustration only. Not to be recommended in general.
\setcounter{secnumdepth}{4}
-\begin{document}
-
-\rmfamily
+\begin{document}\rmfamily
\thispagestyle{empty}
+% 10 octobre 2013.
+\bookmark[named=FirstPage,level=1]{Title page}
+
+
\begin{center}
{\normalfont\Large The \etoc package}\\
\textsc{Jean-François Burnol}\par
@@ -446,21 +620,73 @@ pdfpagemode=UseOutlines}
multi-column format, optionally with a frame or a ruled
title.
- As the assignment of levels to the sectioning units can be
- changed at any time, \etoc can be used in a quite general
- manner to also create custom ``lists of'', additionally to
- the tables of contents related to the document sectioning
- units. No auxiliary file is used apart from the usual |.toc|
- file.
+ As the assignment of levels to the sectioning units can be changed at any
+ time, \etoc can be used in a quite general manner to also create custom
+ ``lists of'', additionally to the tables of contents related to the document
+ sectioning units. No auxiliary file is used additionally to the standard
+ |.toc| file.
\end{abstract}
+\small
-\section*{Foreword}
+\section{License, installation}
-Popular packages dealing with TOCs include |tocloft|,
-|titletoc| and |minitoc|. Why another one? well, initially I
-started \etoc for my own use, and only later found out about
-the above mentioned packages ...
+\begin{verbatim}
+% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
+%
+% 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
+% 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.
+%
+% This Work has the LPPL maintenance status Author-Maintained.
+%
+% The Author of this Work is
+% Jean-Francois Burnol <jfbu at free dot fr>.
+%
+% This Work consists of the main source file etoc.dtx and the
+% derived files etoc.sty, etoc.dvi, etoc.pdf, etoc.ins, etoc.tex
+%
+% Extraction of the package (.sty) and driver (.tex) files:
+% - if etoc.ins is present: tex etoc.ins
+% - without etoc.ins: tex etoc.dtx
+%
+% It is also possible to run latex/pdflatex directly on etoc.dtx
+%
+% At least three ways to produce etoc.pdf:
+% (1) latex etoc.dtx (three times), then dvips, then ps2pdf
+% (2) pdflatex etoc.dtx (three times)
+% (3) latex etoc.tex (three times), 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/pdflatex.
+%
+% Installation:
+%
+% etoc.sty->TDS:tex/latex/etoc/etoc.sty
+% etoc.dtx->TDS:source/latex/etoc/etoc.dtx
+% etoc.pdf->TDS:doc/latex/etoc/etoc.pdf
+%
+% etoc.tex, etoc.ins, etoc.aux, etoc.toc, etc... may be discarded
+%
+\end{verbatim}
+
+\normalsize
+
+\section{Foreword}
+
+Popular packages dealing with TOCs include |tocloft|, |titletoc|
+and |minitoc|. Why another one? I started \etoc
+for my own use, and found out only later about the above mentioned
+packages; and they did not accomplish what I was aiming at.
As is well explained in the |tocloft| package documentation,
the standard \LaTeX{} layout for the Table of Contents is
@@ -485,29 +711,25 @@ found in a line of the |.toc| file) in a completely arbitrary
manner: they are made available via the \csb{etocname},
\csb{etocnumber}, and \csb{etocpage} commands.
-\etoc is
+\etoc appears to be
compatible with the |article|, |book|, |report|, |scrartcl|,
|scrbook|, |scrreprt| and |memoir| classes.
-% Preliminary
-% testing is positive, but the author not being familiar with the
-% latter classes,\footnote{latter=all but |article|...} he does
-% not have a stock of documents which could have been used to
-% test all their bells and whistles in the presence of
-% \etoc. \par
-
\begingroup
\renewcommand\lowast{{\normalsize\raisebox{-.4\height}{*}}}
-\section*{\bfseries\small Change history}
+
+\clearpage
+\small
+
+\section{Change history}
\setlength{\columnsep}{\etoccolumnsep}
\makeatletter
\def\jfverbatim{\@beginparpenalty \predisplaypenalty
- %\leftskip \z@
\parindent \z@
\parfillskip \@flushglue
\parskip \tw@\p@ plus 1fil\relax
@@ -516,7 +738,6 @@ compatible with the |article|, |book|, |report|, |scrartcl|,
\footnotesize\normalfont\baselineskip10pt\relax
\frenchspacing \obeyspaces \jf@xverbatim }
-
\begingroup
\catcode `|=0 \catcode `[= 1 \catcode`]=2
\catcode `\{=12 \catcode `\}=12 \catcode`\\=12
@@ -538,6 +759,36 @@ compatible with the |article|, |book|, |report|, |scrartcl|,
\begin{multicols}{2}
\begin{jfverbatim}
+v1.07g [2013/10/13]
+
+ new commands \etocsettocdepth, \etocsettocdepth.toc,
+ \etocobeytoctocdepth, \etoc~-ignoretoctocdepth which
+ emulate part of tocvsec2 functionality ; measures to
+ make tocvsec2 partially compatible with etoc.
+
+ new commands \etocsetnexttocdepth, \invisibletableofcontents,
+ \invisiblelocaltableofcontents.
+
+ switched from tikz-qtree to forest for the first `toc as
+ tree' example.
+
+ command names are linked to their descriptions, and many
+ other changes in the documentation.
+
+ removed printing of temporary message when the local toc
+ id is not yet stabilized; indeed \localtableofcontents
+ can have many use, such as filling up some token list
+ register and one may wish to not have anything typeset,
+ even in an intermediate run.
+
+ all of tex etoc.dtx, etex etoc.dtx, xetex etoc.dtx, latex
+ etoc.dtx, pdflatex etoc.dtx are now possible, and the
+ extracted file etoc.tex allows easy customization of
+ compilation options for the documentation (default is via
+ dvipdfmx which produces the smallest file).
+
+~smallskip
+
v1.07f [2013/03/07]
new macros \etocthelinkedname, \etocthelinkednumber,
@@ -622,92 +873,117 @@ v1.02 [2012/11/18]
\end{jfverbatim}
\end{multicols}
-\endgroup
+\endgroup % group for modified verbatim printing of the changes log
-\setcounter{tocdepth}{3}
+%----
+% MAIN TOC
+%
+\etocsettocdepth {subsubsection}
\etoctoclines
\etocmarkboth\contentsname
\etocmulticolstyle[1]
- {\noindent\bfseries\Large
+ {\pdfbookmark[1]{Table of contents}{MAINTOC}%
+ \noindent\bfseries\Large
\leaders\hrule height1pt\hfill
\MakeUppercase{Table of Contents}}
\begingroup
\etocsetlevel{subsection}{3}
\etocsetlevel{subsubsection}{6}
-
\tableofcontents \label{toc:main}
-
-
\endgroup
-\clearpage
+%% \clearpage
-\part{Overview}\label{part:one}
+\part{Overview}\label{part:overview}
\thispartstats
-\setcounter{tocdepth}{-3}
-\localtableofcontents \label{toc:partone}
-\setcounter{tocdepth}{3}
-
-\section{Initial motivation: nested lists}
-
-The initial impetus was to feed nested list environments
-with the data consisting of the \emph{name}
-(\csb{etocname}), \emph{number} (\csb{etocnumber}), and
-\emph{page number} (\csb{etocpage}) as
-recorded\footnote{the \emph{number} has to be disentangled
- from the \emph{name}, and in case |hyperref| is present, the
- hyperlink has to be redistributed around each of them.} in the
-|.toc| file.
-% \footnote{I got started about this through
-% reading this question on the
-% \TeX{} Stackexchange site:
-% \href{http://tex.stackexchange.com/questions/79682/can-i-get-a-list-of-all-sections-as-a-simple-enumerate-list}{tex.stackexchange.com/questions/79682}}
-For example, typesetting the line corresponding to the first
-sub-section in a given section would open a list environment
-which would be closed only when a section, chapter, or part
-line entry in the |.toc| file would be encountered. \etoc
-allows to do this very easily and the opening and closing
-may be for example |\begin{enumerate}| and |\end{enumerate}|
-pairs, will all the customizing allowed by packages such as
-|enumitem|.
-
-\subsection{Limitations intrinsic to the use of environments}
+\invisiblelocaltableofcontents \label{toc:overview}
+
+\section{Do I need to be a geek to use \etoc?}
+
+Not quite. The simplest way is to use |enumerate| environments,
+with the customizing facilities of packages such as
+|enumitem|,\footnote{\url{http://ctan.org/pkg/enumitem}} to
+display the data fetched by \etoc from the |.toc| file. The data
+consists of the \emph{name} (\csb{etocname}), \emph{number}
+(\csb{etocnumber}), and \emph{page number} (\csb{etocpage}) as
+extracted\footnote{although \LaTeX{} has been promoted as
+ separating contents from form, there are some areas where its
+ real implementation is very far from this ideal. And the |.toc|
+ file is a case in point; not to mention the hard-coded
+ dimensions, with use of the @ sign,
+ in the macros responsible for constructing the typeset table of
+ contents.} from the |.toc| file.
+
+This is
+illustrated \hyperref[toc:a]{at the start} of
+\autoref{part:linestyles}. More
+sophisticated examples would use more sophisticated |enumitem|
+options. One may say then that again the user has to memorize some
+customizing! indeed, but the syntax and option names to memorize
+are in no way related only to matters of tables of contents, hence
+an economy of use of the poor brain.
+
+Next in ease of use, perhaps, is the
+method explained later in this part. For this some knowledge of
+|\leftskip|, |\rightskip|, etc... is necessary. Next, people who
+know the internals of \LaTeX2e well (which is not my case) will
+happily use directly a |\list| command.
+
+As will be amply illustrated in this manual, \etoc is quite
+versatile (especially as it allows to re-define at any point in
+the document the hierarchy of sectioning units) and one can
+achieve surprising effects with it: \autoref{part:surprising} is
+devoted to this, and some more is to be found in
+\autoref{part:tipsandtricks}.
+
+\begin{framed}
+\setcounter{mycounti}{0}%
+ \etocinline
+\etocsetlevel{part}{1}
+\etocsetlevel{chapter}{1}
+\etocsetlevel{visibletoc}{0}
+\etocsetstyle{visibletoc}
+ {}
+ {\stepcounter{mycounti}}
+ {}
+ {}
+\etocsettocstyle{}{}
+\etocsetnexttocdepth{0}
+\tableofcontents
+A very important aspect of \etoc is that it is geared towards making many TOCs
+in the same document, \emph{using only one |.toc| file}! packages or methods
+found on the internet which fiddle with |\addcontentsline| or write directly
+to the |.toc| file often do not have the perspective that this |.toc| file
+will be used again and again. The present documentation contains
+\arabic{mycounti} visible tables of contents (and a few invisible ones) and
+uses only one |.toc| file!\footnotemark
+\end{framed}
+
+\footnotetext{and the counting itself has been achieved by a table of contents
+ which was inserted in the framed paragraph! \dots the technique for this kind
+ of effect will be explained later.}
+
+
+\subsection{Limitations in the use of list environments for
+ tables of contents}
\label{ssec:limitations}
-There is a first limitation to this method: the |.toc| file
-may contain other commands, such as language changing
+There are some limitations to the use of list environments
+for typesetting TOCs. One of them is intrinsic to the scope
+limitations created by the groups associated to the
+environments: the |.toc| file
+may contain, besides the information to be typeset in the
+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 package own line styles
-(illustrated by the main table of contents in this document)
-do not make use of environments to avoid that problem.
-
-A second limitation is that one may nest at most 4 levels of
-enumerate environments, and 4 levels of itemize environment. I
-tried alternating them and did succeed to nest 6 levels (and
-not 8 alas . . . \footnote{this is
- surely a well-known issue which I did not at all
- investigate any further.}). With
-\csb{etocnumber} as the optional parameter to \csa{item}:
-\csa{item}|[\etocnumber]| one may transform the itemize into an
-enumerated list... anyway, 4 levels of sectional divisions in
-a TOC are generally sufficient, and again using |enumerate|
-environments is only a possibility provided by \etoc, it is by
-no means mandatory to use them in the line styles
-specifications.
-
-We will give in this manual a simple-minded example of nested
-use of |enumerate| environments. More sophisticated examples
-would use more sophisticated |enumitem| options. One may say
-then that again the user has to memorize some customizing!
-indeed, but the syntax and option names to memorize are in no
-way related only to matters of tables of contents, hence an
-economy of use of the poor brain.
-
-The built-in default ``line styles'' provided by the package
-do not make use of 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.
\section{Line styles and toc display style}
@@ -721,40 +997,43 @@ etc... the latter is governed by the command
\csa{etocsettocstyle} (or some higher-level commands) and the
former by the command \csa{etocsetstyle}.
+
+\subsection{\csbhyp{etocsetstyle} for the line styles}
+
+The command to inform \etoc of what to do with \csa{etocname}, \csa{etocnumber},
+and \csa{etocpage} is called \csb{etocsetstyle}. It has five mandatory
+arguments. The first one is the name of the sectional unit: a priori known names
+are |book|, |part|, |chapter|, |section|, |subsection|, |subsubsection|,
+|paragraph|, and |subparagraph|, and any other name can be declared and assigned
+to a (numeric) level via the \csb{etocsetlevel} command.
+
+The four other arguments of \csb{etocsetstyle} specify: 1) \emph{what to do when
+ this level is first encountered, down from a more general one,} then 2) \& 3)
+(two arguments, a `prefix' and a `contents') \emph{what to do when a new entry
+ of that type is found,} and 4) \emph{the last argument is the code to execute
+ when a division unit of higher importance is again hit upon.}
+
\subsection{\csbhyp{etocsettocstyle} for the toc display}
-The low-level \csb{etocsettocstyle} command allows to decide
-what should be done before and after the line entries of the
-TOC are typeset, and in particular how the title should be
+The \csb{etocsettocstyle} command allows to specify what
+should be done before and after the line entries of the TOC
+are typeset, and in particular how the title should be
printed. It has two arguments, the first one is executed
before the TOC contents (typically it will print
-``Contents'' and define suitable head-marks) and the second is
-executed after the TOC contents.
+``Contents'' and define suitable marks for the page headings) and
+the second is executed after the TOC contents.
\etoc provides four (customizable) higher level toc styles:
\csb{etocmulticolstyle}, \csb{etoctocstyle},
\csb{etocruledstyle}, and \csb{etocframedstyle}. All use the
|multicol| package with a default of two columns
-(single-column mode is of course allowed).
+(single-column mode is obtained with the optional argument |[1]|).
These commands must be followed either by \toc or \localtoc.
-\subsection{\csbhyp{etocsetstyle} for the line styles}
-
-The command to inform \etoc of what to do with \csa{etocname},
-\csa{etocnumber}, and \csa{etocpage} is called
-\csb{etocsetstyle}. It has five mandatory arguments. The first
-one is the name of the sectional unit: a priori known names
-are |book|, |part|, |chapter|, |section|, |subsection|,
-|subsubsection|, |paragraph|, and |subparagraph|. The four
-other arguments say: 1) \emph{what to do when this level is first
-encountered, down from a more general one,} then 2) \& 3) (two
-arguments, a `prefix' and a `contents') \emph{what to do when a new
-entry of that type is found,} and 4) \emph{the last argument is the
-code to execute when a division unit of higher importance is
-again hit upon.}
-
\subsection{Compatibility mode}\label{ssub:compat}
+\label{etoctoclines}
+\label{etocstandardlines}
Both for the ``line styles'' and the ``toc display style'', it is
possible to switch into a compatibility mode which uses the
@@ -768,104 +1047,302 @@ document class.\footnote{for the ``toc display style''
|% `toc display' as without \usepackage{etoc}|
-If the command \csa{etocsetstyle} has not been used in the
-preamble the package will be at |\begin{document}| in this
+If the command \csa{etocsetstyle} has \emph{not been used in the
+preamble} the package will be at |\begin{document}| in this
compatibility mode: hence just adding \csa{usepackage\{etoc\}}
should hopefully not change anything to the look of a
previously existing document, under the |article|, |book|,
|report|, |scrartcl|, |scrbook|, |scrreprt| and |memoir|
classes.
- Any use of \csa{etocsetstyle} in the preamble or body of the
- document turns off the compatibility mode for line styles
- (but not for the global display style; for this one needs to
- use the command \csa{etocsettocstyle}).
+ Any use of \csa{etocsetstyle} in the \emph{preamble or body} of the document
+ turns off from that point on the compatibility mode for line styles. One
+ re-activates the compatibility mode with \csb{etocstandardlines}; and the
+ command \csb{etoctoclines} will re-activate the line styles as defined by the
+ last uses of \csa{etocsetstyle}, if their scope was not limited to a group or
+ environment.
-To exit after \csa{etocstandardlines} from compatibility mode
-one uses the command \csb{etoctoclines}, which re-activates
-the latest line styles as defined by \csa{etocsetstyle} (if
-their scope was not limited to a group or environment). The
+The
command \csb{etocdefaultlines} resets the line styles to be
-the package initial default ones.
+the package initial default ones.
+
+Even if \csb{etocsetstyle} has been used, the global display
+style remains initially as defined by the document class;
+one needs to use the command \csb{etocsettocstyle} or its
+variants to exit from this compatibility mode at the ``toc
+display style'' level. It will be re-activated if use if
+made of \csb{etocstandarddisplaystyle}.
+
+\section{A first example}
+
+Let us present it a first example of specification for line styles.
+Immediately after the start of \autoref{part:overview} we inserted in the
+source file:
+\centeredline{|\invisiblelocaltableofcontents \label{toc:overview}|} This
+sets-up the label |toc:overview|, and we can use it at any location in the
+document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used
+|\invisible...|,\footnote{this is a shortcut for setting temporarily the
+ |tocdepth| to |-3|, which has the effect to tell \etoc not to print the TOC,
+ and not even the heading.} the local TOC will exist only through its clones
+elsewhere in the document. Here is one such clone:
+\begingroup
+\parindent 0pt
+\parfillskip 0pt
+\leftskip 0cm
+\rightskip 1cm
+\etocsetstyle {section}
+ {}
+ {\leavevmode\leftskip 0cm\relax}
+ {\bfseries\normalsize\makebox[.5cm][l]{\etocnumber.}%
+ \etocname\hfill{}\rlap{\makebox[1cm]{\mdseries\etocpage}}\par}
+ {}
+\etocsetstyle {subsection}
+ {}
+ {\leavevmode\leftskip .5cm\relax }
+ {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
+ \etocname\hfill{}\rlap{\makebox[1cm]{\etocpage}}\par}
+ {}
+\etocsetstyle {subsubsection}
+ {}
+ {\leavevmode\leftskip 1.5cm\relax }
+ {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
+ \etocname\hfill{}\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
-\section{Arbitrarily many TOCs, and local ones too}
+We could use the line styles defined by \etoc, with
+\csb{etoctoclines}, 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|. The |\rightskip| on the other hand is shared by
+ all, and page numbers are printed there.
+
+
+This is a simple design which does not make provisions for page
+breaks which should be discouraged in-between a section and a
+subsection etc\dots as we only used it for the table of contents of this part,
+thus with sections as top levels,
+there was no need to specify a style for parts too. The two
+commands used are \csb{etocsetstyle} for specifying the line
+styles, and \csb{etocruledstyle} for the TOC global style.
+
+\begin{verbatim}
+\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
+\etocsetstyle {section}
+ {}
+ {\leavevmode\leftskip 0cm\relax}
+ {\bfseries\normalsize\makebox[.5cm][l]{\etocnumber.}%
+ \etocname\hfill{}\rlap{\makebox[1cm]{\mdseries\etocpage}}\par}
+ {}
+\etocsetstyle {subsection}
+ {}
+ {\leavevmode\leftskip .5cm\relax }
+ {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
+ \etocname\hfill{}\rlap{\makebox[1cm]{\etocpage}}\par}
+ {}
+\etocsetstyle {subsubsection}
+ {}
+ {\leavevmode\leftskip 1.5cm\relax }
+ {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
+ \etocname\hfill{}\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}
+
+
+
+% 13 octobre, ceci était une section avant
+\part{Arbitrarily many TOCs, and local ones too}
+
+\thispartstats
\etoc allows arbitrarily many \csa{tableofcontents} commands in
your document. The line styles and the toc display style may of
course be changed in-between. Furthermore
\csa{localtableofcontents} will print local tables of
-contents\footnote{Up to version |1.04| we called this
- \starit{tableofcontents}, but for reasons of compatibility
- with the |memoir| class, we have decided to drop this
- usage.}: \emph{i.e.} all sections and sub-units inside a
+contents: \emph{i.e.} all sections and sub-units inside a
given chapter, or all subsubsections and lower inside a given
subsection, etc . . .
-\subsection{Labeling and reusing elsewhere}
-
-\etoc allows the labeling of a TOC with \csa{label\{toc:A\}}
-and will redisplay it elsewhere when told
-\csa{tableofcontents}\csa{ref\{toc:A\}}. The actual layout
-(title inclusive) used for the cloned TOC will be decided
-locally. The line styles and toc display style (including the
-title) will be the current ones and the current value of the
-|tocdepth| counter is obeyed. As an example here is the table
-of contents of Part \ref{part:custom}:
-
-\begingroup
-
-\etocstandardlines
-\renewcommand{\etocbkgcolorcmd}{\color{green!5}}
-\fboxsep1ex
-
-\etocframed[1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
-\hyperref[toc:c]{I am from far away}}}}
-\label{toc:d}
-\ref{toc:c}
-
-\endgroup
+\section{Labeling and reusing elsewhere}
+
+\etoc allows the labeling of a TOC with (for example)
+\csa{label\{toc:A\}} and will redisplay it elsewhere when
+told \csa{tableofcontents}\csa{ref\{toc:A\}}. The actual
+layout (title inclusive) used for the cloned TOC will be
+decided locally. The line styles and toc display style
+(including the title) will be the current ones and the
+current value of the |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{figure*}[ht!]
+ \centering
+ \begingroup
+ \etocstandardlines
+ \renewcommand{\etocbkgcolorcmd}{\color{green!5}}
+ \renewcommand{\etocbelowtocskip}{0pt\relax}
+ \fboxsep1ex
+ \etocframed[1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
+ \hyperref[toc:c]{I am from far away}}}}
+ \label{toc:d} \ref{toc:c}
+ \endgroup
+%% \centeredline{The original is \hyperref[toc:c]{there}.}
+\end{figure*}
-We actually did something like:
-\centeredline{\toc\space\csa{label}|{toc:d}|\csa{ref}|{toc:c}|} Hence
-\hyperref[toc:d]{\color{niceone}the present location}
-can itself now be referred to via |\ref{toc:d}|: it gives
-the id of this TOC\footnote{\emph{i.e}
-{\color{niceone}\ref{toc:d}}, there was an invisible
-TOC with id 2 and another one whose identity is left to the reader's sagacity.}
- in the sequence of
-document TOCs, and will be a link if package |hyperref| is
-used.
-
-However one should not use elsewhere \toc|\ref{toc:d}|. Due to
-the way \etoc implements the cloning, the doubly cloned TOC
-will be typeset as a full table of contents. So to clone
-again, one should use the original: \toc|\ref{toc:c}|.
+We used this:
+\begin{verbatim}
+\begin{figure*}[ht!]
+ \centering
+ \begingroup
+ \etocstandardlines
+ \renewcommand{\etocbkgcolorcmd}{\color{green!5}}
+ \renewcommand{\etocbelowtocskip}{0pt\relax}
+ \fboxsep1ex
+ \etocframed[1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
+ \hyperref[toc:c]{I am from far away}}}}
+ \label{toc:d} \ref{toc:c}
+ \endgroup
+\end{figure*}
+\end{verbatim}
+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}|\unskip.
+
+
+\section{The \csbhyp{etocsettocdepth},
+ \csbhyp{etocsetnexttocdepth} and \csbhyp{etocsettocdepth.toc} commands}
+\label{etocsettocdepth}
+
+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
+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
+and again each time a table of contents needs to be typeset.
+
+\etoc provides \csb {etocsettocdepth}\marg{level} whose mandatory argument is
+either
+numeric (from |-3| to |5|) or a division name such as |subsection| or
+|subsubsection| or any name previously declared to \etoc with
+\csb{etocsetlevel} (the special names |all| and |none| are recognized).
+This does the appropriate |\setcounter{tocdepth}{numeric_level}|.
+
+\subsection{The \csbhyp{etocsetnexttocdepth} command}
+\label{etocsetnexttocdepth}
+
+As is explained in the next subsection, |tocdepth| is used by |hyperref|, and
+one must take steps to prevent its changes to influence the bookmarks, too. So,
+\etoc has \csb {etocsetnexttocdepth}\marg{level} whose influence ceases
+immediately after the next table of contents. Thus, |\invisibletableofcontents|
+is
+essentially |\etocsetnexttocdepth{none}\tableofcontents|.
+
+The simplest course is thus to have after |\begin {document}| and before the
+ first |\tableofcontents| a single instance of the \csb{etocsettocdepth}
+ command, with argument the deepest level (or most commonly used deepest level)
+ among the tables of contents of the document, and to use locally,
+ where needed, \csb{etocsetnexttocdepth} before |\tableofcontents| or
+ |\localtableofcontents|.
\subsection{The hyperref option \emph{bookmarksdepth}}
\label{ssec:bookmarksdepth}
When modifying the counter |tocdepth| for the purposes of
-multiple uses of \toc or \localtoc, one should consider that
+multiple uses of \toc or \localtoc, one should be aware that
package |hyperref| by default takes into account the
\emph{current} value of the |tocdepth| counter to decide
-whether the final |pdf| output will contain a bookmark
-corresponding to the used sectioning command. Thus, one
-often will have to reset |tocdepth| to its previous value
-immediately after the display of the table of contents.
+whether the |pdf| file will contain a bookmark corresponding
+to sectioning commands encountered in the source file. Thus,
+one typically needs to reset |tocdepth| to its previous
+value after having temporarily modified it for a given table of
+contents.
Or, there is the \emph{bookmarksdepth=n} option of package
|hyperref|, with \emph{n} the desired document bookmarks
-depth, which can be numeric or the name of a level known to
-|hyperref|. The present document passed |bookmarksdepth=3| as
-option to |hyperref|, so as to not have to reset |tocdepth|
-each time its value was changed.
+maximal depth, which can be numeric or the name of a level known to
+|hyperref|. This documentation previously passed |bookmarksdepth=3| as
+option to |hyperref|, so even if |tocdepth| was left to |1|
+by inadvertance after printing a certain table of contents
+this did not modify the bookmark tree of the |pdf| file. Now that
+\csb{etocsetnexttocdepth} has been added to the package, we have used it
+systematically and there was no need for |bookmarksdepth=3| anymore.
+
+\subsection{Further commands \csbhyp{etocsettocdepth.toc}, \csbhyp{etocobeytoctocdepth}, and \csbhyp{etocignoretoctocdepth}}
+\label{etocsettocdepth.toc}
+\label{etocobeytoctocdepth}
+\label{etocignoretoctocdepth}
+
+This command \csb{etocsettocdepth.toc} implements some functionality of
+|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. I thank D.B. for drawing
+ my attention to the incompatibility of this package with \etoc.}, a package
+which however was incompatible with \etoc (it can still be used for its
+|secnumdepth|-related commands, but its |toc|-related activities will get
+canceled by \etoc) and more-or-less designed for a single table of contents.
+
+The action of \csb{etocsettocdepth.toc} is totally different than the one of
+\csb{etocsettocdepth}. Rather than modifying the |tocdepth| counter immediately,
+it adds a line to the |.toc| file which, when executed inside a table of
+contents will enact this change.
+
+The command \csb{etocsettocdepth.toc}, like
+\csb{etocsettocdepth}\unskip, accepts both numeric and named
+arguments. In the case of a named argument, the actual numeric
+value to be used is not yet decided at the time the |.toc|
+file is created; it will be the value currently specified for
+the named level at the time each table of contents (not having
+done |\etocignoretoctocdepth|) is typeset.
+
+The |tocdepth| counter will never be set to a value finer than its initial value
+at the start of the table of contents: so adding commands
+\csb{etocsettocdepth.toc} in the document is a way to \emph{restrict} locally
+the depth of the table of contents. For example to prevent inclusion in the
+tables of contents of the sub-sub-sections of a given chapter.
-\subsection{On manually adding layout commands to the
+This
+{\fbox{gets executed in ALL tables of contents.}}
+So \csb{etocignoretoctocdepth} is provided to cancel this mechanism when
+needed; and \csb{etocobeytoctocdepth} will
+re-activate it. The package does \csb{etocobeytoctocdepth} when it is loaded.
+
+
+Actually, with the \emph{shuffling abilities of \etoc}, one may never need nor
+wish to do \csa{etoc\-ignoretoctocdepth} if one has used
+\csb{etocsettocdepth.toc} in the following powerful way, illustrated on
+an example, there are infinite variations.
+
+In the preamble one does \csb{etocsetlevel}|{partI}{6}|,
+\csb{etocsetlevel}|{partII}{6}|, \dots, for as many parts as found in the
+document. Then one inserts a command \csb{etocsettocdepth.toc}|{partI}|, just
+before the first |\part|, and the same for all others. One may then decide,
+individually for each part, what will be the finest level authorized to appear
+in the next table of contents, through assignments
+\csb{etocsetlevel}|{partI}{2}|, \csb{etocsetlevel}|{partII}{1}|, etc\dots each
+time one prints a TOC, one decides on the levels for each part. One may exclude
+entirely the part and all its sub-units by setting the level of its associated
+tag
+to |-2|.
+
+Important: \csb{etocsetlevel} only accept numeric levels, from |-3| to |6|, with
+|-3| only accepted for such dummy level associations (one can not and one should
+not try to associate a line style to a named level assigned a numeric value of
+|-3|) allowing to exclude an entire |book| from inclusion in a TOC (|memoir|
+allows this level |book|). I guess this might prove a rather rare instance, but
+still I enlarged \csb{etocsetlevel} to accept it.
+
+\section{Adding commands to the
\texorpdfstring{\texttt{.toc}}{.toc} file}
When displaying in that way many tables of contents in the same
-document one should of course beware of the impact of adding
+document one should be cautious when adding
manually things
to the |.toc| file. For example, inserting
\csa{addtocontents}|{toc}{\string\clearpage}|
@@ -874,8 +1351,8 @@ before a \csa{part} to fix the problem when some part entry (in
the table of contents) is isolated at the bottom of one page,
will cause problems with multiple TOCs: this \csa{clearpage}
will be executed by \etoc each time a \toc or \localtoc
-command is encountered! The more prudent thing is to have
-issued rather: {\csa{addtocontents}|{toc}{\string\myclearpage}|,}
+command is encountered! The more prudent thing is to do
+rather: {\csa{addtocontents}|{toc}{\string\myclearpage}|,}
to have a |\let\myclearpage\relax| at the top level of the
document and to use where needed something like:
\begin{verbatim}
@@ -886,24 +1363,60 @@ document and to use where needed something like:
The |memoir| class has the command \csa{settocdepth} which
writes a \csa{changetoc\-depth} command inside the |.toc| file.
This will impact the typesetting by \etoc of \emph{all} tables
-of contents, with possibly unexpected results: imagine the
+of contents, with (possibly) unexpected results: imagine the
document has \csa{settocdepth}|{chapter}| at some point to
avoid having the sections from subsequent chapters be listed
in the main table of contents. Then a local table of contents
in one of these chapters will print a title but will be
-without any entry. A solution is to do \csa{begingroup}
-|\renewcommand*\changetocdepth[1]{}| \csa{localtableofcontents}
-\csa{endgroup}, and to set the desired level for the local
-table of contents with the other |memoir| command \csa{maxtocdepth}.
-\footnote{The |memoir| class allows multiple calls to the \toc
- command, so these issues already arise there,
- independently of \etoc, see page 170 of the |memoir|
- manual.}
+without any entry.
-\subsection{Shuffling the levels with \csbhyp{etocsetlevel}}
+As the |memoir| class by itself allows multiple\toc
+ these issues already arise there,
+ independently of \etoc, see page 170 of the |memoir|
+ manual.
+
+For this specific issue, the commands \csb{etocsettocdepth.toc},
+\csb{etocignoretoctocdepth} and \csb{etocobeytoctocdepth} are the way to go.
+
+As an aside, any |\setcounter{tocdepth}{n}| command added directly to the |.toc|
+file sees its effect (since release |1.07g|) canceled at the end of each table
+of contents, which automatically does a |\setcounter{tocdepth}{previous_value}|
+with the value active on entering the table of contents.
+
+\subsection{The hyperref option \emph{hidelinks}}\label{ssec:hidelinks}
+
+The colored links (and also the rectangle links) are a bit
+annoying when used in tables of contents, especially when
+the document uses \etoc and has plenty of them! One may wish
+for having colored links, \emph{except} for those within
+table of contents!
+Indeed, why would things in TOCs need to be either framed in
+rectangles or colored, when the user \emph{already expects
+ them to be links!}
+
+I use the following trick: either in the preamble using
+|\AtBeginDocument|, or right after |\begin{document}|, I
+ have the command
+ \centeredline{|\addtocontents{toc}{\protect\hypersetup{hidelinks}}|}
+
+ \begin{framed}
+ All TOCs typeset by \etoc have their contents done
+ within a group (as if enclosed in an environment). So
+ the command \csa{hypersetup}|{hidelinks}| will be
+ executed by \emph{each} TOC, but its effect will be
+ limited to that TOC.
+ \end{framed}
+
+ I found out experimentally that the option |hidelinks| could
+ indeed be set many times with |\hypersetup| (this is not the
+ case of all |hyperref| options).
+
+\section{A powerful functionality of \etoc: the
+ re-assignment of levels}
The intrinsic levels manipulated by \etoc are numeric: from
-|-2| (which corresponds to |book| in the |memoir| class) down
+|-2| (which corresponds to |book| in the |memoir| class)
+down (from the big to the small)
to |5| (|subparagraph|). But the assignment of a numeric level
to a given name can be modified at any time with the command
\csa{etocsetlevel}\marg{level\_name}\marg{n}. In conjunction
@@ -912,26 +1425,54 @@ powerful applications: \meta{level\_name} does not have to
coincide with an actual document sectioning command, and \etoc
can be used to print arbitrary ``lists of things'', using no
other auxiliary file than the |.toc| file. This is
-explained further in the section \ref{sec:surprising}.
-
-\section{Two examples}
-
-Here is a simple example of use of the package
-functionalities. Immediately after the |\part{Overview}|
-line in the source file we inserted:
-\begin{verbatim}
- \setcounter{tocdepth}{-3}
- \localtableofcontents \label{toc:partone}
- \setcounter{tocdepth}{3}
-\end{verbatim}
-The |tocdepth| having been set to -3, nothing at all was typeset, as
-\etoc
-cancels printing even the heading of the TOC if the |tocdepth| is -3 or
-less (and it is even ``-2 or less'', except for the |memoir| class).
-We will then display here this TOC with:
-\centeredline{|\tableofcontents \ref{toc:partone}|}
-
-But first let us set up some line styles. We choose a style for sections and
+explained further in \autoref{part:surprising}.
+
+\begin{framed}
+ It is often said that in the standard classes, the sectioning
+ level of |\part| is |0| in the classes not having a |\chapter|
+ command, and |-1| in classes having a |\chapter| command. This
+ is \emph{correct} for what regards the \emph{automatic
+ numbering}, as is governed by the value of the |secnumdepth|
+ counter; but it is \emph{wrong} for what regards the effect of
+ the |tocdepth| counter: setting the |tocdepth| to |-1| in the
+ |article| class just before |\tableofcontents| does \emph{not}
+ prevent Parts from appearing in the Table of Contents. One has
+ to set it to |-2| for that, whether in the |article| or in the
+ |book| class.
+
+ The canonical levels, a priori known to \etoc, are those of
+ relevance to the \textbf{|tocdepth|} counter in the standard
+ classes and are recapitulated in this table: \centeredline{
+ \fbox{\begin{tabular}{rc}
+ (|memoir| class) book&-2\\ part&-1\\ chapter&0 \\
+ section&1\\ subsection&2 \\
+ subsubsection&3 \\ paragraph&4 \\ subparagraph& 5
+ \end{tabular}}}
+
+\smallskip With \etoc, the user can easily print a local table of
+contents inside a given subsection, where subsubsections will be
+printed in the style of sections, paragraphs in the style of
+subsections, and subparagraphs in the style of subsubsections, if
+so desired. One can also decide to set everything to be at the level
+|6| (never displayed by \etoc), except for example
+paragraphs, promoted to be at level |1|, and then one obtains a nice
+table of contents of all the paragraphs from the document!
+(|tocdepth| at least |1|)\footnotemark
+\end{framed}
+
+\footnotetext{one has to issue \csa{etoctoclines}, or to set up at
+ least one style with \csa{etocsetstyle} to escape from the
+ compatibility mode, which would insist on printing the
+ paragraphs in the TOC as paragraphs, with a silly gigantic left margin.}
+
+
+\section{Two Examples}
+
+\subsection{A Beautiful Thesis example}
+
+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
@@ -959,14 +1500,12 @@ breaks. Also, they do not worry about potential multi-column use.
\hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
{}
+\def\tmptitle{My Very Beautiful Thesis}
\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
\leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{My Beautiful Thesis}\par}{\bigskip}
-
-% \color{cyan}\parindent0pt and \leftskip\tocleftmargin were repeated
-% in the <start> code of the ``section style'', for clarity of code.
+ \huge\textit{\tmptitle}\par}{\bigskip}
-\tableofcontents \ref{toc:partone}
+\tableofcontents \ref{toc:overview}
\endgroup
\end{verbatim}
@@ -993,44 +1532,31 @@ breaks. Also, they do not worry about potential multi-column use.
\hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par}
{}
+\def\tmptitle{My Beautiful Thesis}
+
\etocsettocstyle{\color{cyan}\parindent0pt\leftskip\tocleftmargin
\leavevmode\leaders\hrule height 1pt\hfill\
- \huge\textit{My Beautiful Thesis}\par}{\bigskip}
+ \huge\textit{\tmptitle}\par}{\bigskip}
-\tableofcontents \ref{toc:partone}
+\tableofcontents \ref{toc:overview}
+% And again, for the fun of it:
+% \def\tmptitle{My Very Beautiful Thesis}
+% \tableofcontents \ref{toc:c}
\endgroup
-As one can see, the code uses the basic commands from
-\TeX/\LaTeX{} for paragraph layouts and an efficient mix of
-plain \TeX{} and \LaTeX{} syntaxes.
-
-Users not so knowledgeable in the \TeX{} syntax (for cause of having
-been exposed only to \LaTeX{} ``introductions'')
-have the possibility explained earlier to use nested
-|enumerate| environments, of course this means mastering
-another syntax.
-However, using as here the \TeX{} primitive |\par|,\footnote{\csa{par} is
- redefined by \LaTeX{} but this is of no immediate
- relevance here.} and basic skip registers
-|\leftskip|, |\rightskip|, \csa{parfillskip}, ... is by far the
-surest way to completely understand and master what happens.
-Any user of \LaTeX{} should learn their
-signification.
-
-\subsection{Again the table of contents of this part}\label{ssec:again}
+\subsection{A 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. With all the recent additions to the documentation there is
-not enough room here, so we wrap it up in a figure environment and
-it will show \hyperref[toc:floating]{\color{niceone}on the next page.}
-
+page.\footnote{using \url{http://ctan.org/pkg/mdframed} one may
+ do similar constructs compatible with pagebreaks.}
+We wrap it up in a \hyperref[toc:floating]{figure environment} showing up
+\vpageref{toc:floating}.
-\setcounter{tocdepth}{3}
-\begin{figure*}[th!]\centering
+\begin{figure*}[htbp!]\centering
\colorlet{subsecnum}{black}
\colorlet{secbackground}{green!30}
\colorlet{tocbackground}{red!20!green!20}
@@ -1100,9 +1626,9 @@ it will show \hyperref[toc:floating]{\color{niceone}on the next page.}
% toutes les toc, pas visibletoc.
\etocframedstyle[1]{}
-\tableofcontents \label{toc:floating} \ref{toc:partone}
+\tableofcontents \label{toc:floating} \ref{toc:overview}
\vspace{-\baselineskip}
-\centeredline{|\tableofcontents \ref{toc:partone}|
+\centeredline{|\tableofcontents \ref{toc:overview}|
(\emph{cf.} \autoref{ssec:again} and \hyperref[toc:clone]{\color{niceone}this other toc})}
\end{figure*}
@@ -1113,8 +1639,14 @@ is in use also for \hyperref[toc:clone]{\color{niceone}this other toc}, and the
reader is referred to \hyperref[toc:clone]{\color{niceone}its location} for the
coding used.
-\section{Surprising uses of \etoc}
-\label{sec:surprising}
+\vfill\eject
+% \clearpage
+% 11 octobre 2013 ceci était une section avant:
+\part{Surprising uses of \etoc}
+\label{part:surprising}
+
+\thispartstats
+%% (pas de sous-section)
% This variant uses macros rather than boxes, which allows greater flexibility.
@@ -1123,91 +1655,39 @@ coding used.
\newcommand*\lastsubname {}
\newcommand*\firstsubnumber {}
\newcommand*\lastsubnumber {}
-\newcommand*\thissectionstatsaux{}
+\newcommand*\thisspecialstatsaux{}
-\newcommand*{\thissectionstats}{%
- \edef\oldtocdepth{\arabic{tocdepth}}%
- \setcounter{tocdepth}{2}%
+\newcommand*{\thisspecialstats}{%
\setcounter{mycounti}{0}%
- \def\thissectionstatsaux{% ou plus simple si on ne veut pas le lien.
+ \def\thisspecialstatsaux{% ou plus simple si on ne veut pas le lien.
\let\firstsubname\etocthelinkedname
\let\firstsubnumber\etocthelinkednumber
- \def\thissectionstatsaux{}}
+ \def\thisspecialstatsaux{}}
\begingroup
\etocsetstyle{subsection} {} {}
- {\thissectionstatsaux
+ {\thisspecialstatsaux
\stepcounter{mycounti}%
\let\lastsubname\etocthelinkedname
\let\lastsubnumber\etocthelinkednumber }
- {Here are some statistics for this section. It contains \arabic{mycounti}
- subsections. The name of
+ {Here are some statistics for this part. It contains \arabic{mycounti}
+ sections. The name of
its first is
- \emph{\color{cyan}\firstsubname{}} and the corresponding number is
- {\color{cyan}\firstsubnumber}. The name of the last subsection is
- \emph{\color{teal}\lastsubname{}} and its number is
- {\color{teal}\lastsubnumber}.}%
+ \emph{\firstsubname{}} and the corresponding number is
+ {\firstsubnumber}. The name of the last section is
+ \emph{\lastsubname{}} and its number is
+ {\lastsubnumber}.}%
\etocsettocstyle {}{}
\etocinline
+ \etocsetnexttocdepth {1}%
\localtableofcontents
\endgroup
- \setcounter{tocdepth}{\oldtocdepth}%
}
\makeatother
-% more general version:
-% \makeatletter
-% \newcommand*\firstsubname{}
-% \newcommand*\lastsubname{}
-% \newcommand*\firstsubnumber{}
-% \newcommand*\lastsubnumber{}
-% \renewcommand*{\thispartstats}[1][section]{%
-% \edef\oldtocdepth{\arabic{tocdepth}}%
-% \setcounter{tocdepth}{\csname Etoc@#1@@\endcsname}%
-% \begingroup
-% \etocsetstyle{book}{}{}{}{}%
-% \etocsetstyle{part}{}{}{}{}%
-% \etocsetstyle{chapter}{}{}{}{}%
-% \etocsetstyle{section}{}{}{}{}%
-% \etocsetstyle{subsection}{}{}{}{}%
-% \etocsetstyle{subsubsection}{}{}{}{}%
-% \etocsetstyle{paragraph}{}{}{}{}%
-% \etocsetstyle{subparagraph}{}{}{}{}%
-% \setcounter{mycounti}{0}%
-% \def\thispartstatsaux{% ou plus simple si on ne veut pas le lien.
-% \toks@\expandafter{\etocthename}%
-% \edef\firstsubname{\noexpand\hyperlink{\Hy@tocdestname}{\the\toks@}}%
-% \toks@\expandafter{\etocthenumber}%
-% \edef\firstsubnumber{\noexpand\hyperlink{\Hy@tocdestname}{\the\toks@}}%
-% \def\thispartstatsaux{}}
-% \etocsetstyle{#1}
-% {}
-% {}
-% {\thispartstatsaux
-% \stepcounter{mycounti}%
-% \toks@\expandafter{\etocthename}%
-% \edef\lastsubname{\noexpand\hyperlink{\Hy@tocdestname}{\the\toks@}}%
-% \toks@\expandafter{\etocthenumber}%
-% \edef\lastsubnumber{\noexpand\hyperlink{\Hy@tocdestname}{\the\toks@}}%
-% }
-% {}%
-% \etocsettocstyle{}
-% {\arabic{mycounti}
-% #1\ifnum\c@mycounti>1 s\fi. The name of
-% its first is
-% \emph{\color{cyan}\firstsubname{}} and the corresponding number is
-% {\color{cyan}\firstsubnumber}. The name of the last #1 is
-% \emph{\color{teal}\lastsubname{}} and its number is
-% {\color{teal}\lastsubnumber}.
-% Click on the names or numbers to get confirmation!}%
-% \etocinline
-% Here are some statistics for this unit: it has\localtableofcontents\par
-% \endgroup
-% \setcounter{tocdepth}{\oldtocdepth}}
-% \makeatother
-
-\thissectionstats
-
-\subsection{The TOC of TOCs}
+
+\thisspecialstats
+
+\section{The TOC of TOCs}
\begingroup % \endgroup just after the \tableofcontents command
\etocinline
@@ -1220,21 +1700,17 @@ coding used.
{{\color{niceone}\etocname}}
{}
\etocsettocstyle{}{}
-\setcounter{tocdepth}{0}
+\etocsetnexttocdepth{0}
Here is the numbered and linked list of all tables of contents which are
-displayed within this document:
-\tableofcontents\endgroup. And to obtain
-it here we just wrote:\footnote{click the `\protect\thevisibletoc'
- in the list to get confirmation... and click on the previous `\number
- \numexpr\csname c@visibletoc\endcsname-1\relax' for a surprise...
-\\ The \hyperref[toc:floating]{\color{niceone}floating TOC} \number
- \numexpr\csname c@visibletoc\endcsname-2\relax\ is responsible for
- some numbering madness here: the numbers are listed
+displayed within this document:\footnote{The TOCs put in
+ floats may change the order: the numbers are listed
in the order the TOCs appear in the document; but the numbering
itself is from the order of the TOCs in the \emph{source} of
- this document... }\par\smallskip
+ this document... }
+\tableofcontents\endgroup. And to obtain
+it here we just wrote:\par\smallskip
{\leftskip1cm\rightskip2cm
\ttfamily\small\baselineskip11pt \noindent Here is the
numbered and linked list of all tables of contents which are
@@ -1275,12 +1751,13 @@ it here we just wrote:\footnote{click the `\protect\thevisibletoc'
of bookmarks done to \csa{addcontentsline} by the |hyperref| package,
as pdf bookmarks don't make
much sense here (and would elicit a complaint
- of |hyperref| that the bookmark level is `unknown').
-
+ of |hyperref| that the bookmark level is `unknown').\footnote{
The package provides a starred variant
- \staritb{etoctoccontentsline}, which will allow the creation
+ \staritb{etoctoccontentsline}, which does allow the creation
of bookmarks and has a third mandatory argument which is the
- Level to be used by these bookmarks.
+ Level to be used by these bookmarks; depending on the context
+ the starred as well as the non-starred variants may be
+ profitably preceded by \csa{phantomsection}.}
Finally, the preamble of the document did
|\etocsetlevel{visibletoc}{6}|. The level |6| (or anything
@@ -1304,14 +1781,13 @@ Here are the implementation details:
\begingroup
\begin{verbatim}
-. . . in the preamble:
+ < in the preamble >
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
{\stepcounter{visibletoc}\etoctoccontentsline{visibletoc}{\thevisibletoc}}
\etocsetlevel{visibletoc}{6}
-. . .
\begin{document}
-. . . document body
+ < document body >
\subsection{Surprising uses of etoc}
\begingroup
\etocinline
@@ -1321,7 +1797,7 @@ Here are the implementation details:
\etocsetstyle{visibletoc}
{\etocskipfirstprefix}{, }{{\color{niceone}\etocname}}{}
\etocsettocstyle{}{} % don't set any title, rules or frame or multicol!
- \setcounter{tocdepth}{0} % display only the `visibletoc' entries from .toc
+ \etocsetnexttocdepth{0} % display only the `visibletoc' entries from .toc
Here is the numbered and linked list of all tables of contents which are
displayed within this document: \tableofcontents.
@@ -1336,12 +1812,12 @@ defined style for level |0| (which is normally the level for
chapters). To keep these changes strictly local the simplest
manner is to put everything inside a group.
-Subsection \ref{subsec:interverting} gives another use of the
+The \autoref{subsec:interverting} gives another use of the
shuffling of levels.
-\subsection{Arbitrary ``Lists Of...''}
-
+\section{Arbitrary ``Lists Of...'', \csbhyp{etoctoccontentsline}}
+\label{etoctoccontentsline}
This idea of interverting the levels is very powerful and allows
to let \etoc display lists of arbitrary things contained in the
@@ -1377,8 +1853,7 @@ argument:
\newcommand{\exercisetotoc}{\etoctoccontentsline*{exercise}{\theexerci}{2}}
\end{verbatim}
-This example originates with question |94766| on the
-\TeX-StackExchange site. The counter |exerci| is already
+The counter |exerci| is already
incremented by the |exerci| theorem environment, and
provides the correct destination for the link added by package
|hyperref|. The command \csa{exercisetotoc} adds for each exercise a line
@@ -1387,7 +1862,7 @@ unit with name `|exercise|'. A
four-column list, including the sections, can then be
typeset with the following code:
\begin{verbatim}
- \setcounter{tocdepth}{2} % sections are at level 1 and will show up
+ \etocsetnexttocdepth{2} % sections are at level 1 and will show up
\begingroup
\etocsetlevel{exercise}{2} % but:
\etocsetlevel{chapter}{3} % no chapters
@@ -1406,23 +1881,33 @@ typeset with the following code:
\end{verbatim}
-In the above, recall that \LaTeX{} counters are global. The
-current |tocdepth| value is |2|, and if not reset it will prevent
-|hyperref| to assign bookmarks to sub-subsections (level |3|).
-The global |hyperref| option \emph{bookmarksdepth} can be
-used to avoid having to systematically reset |tocdepth| after
-having changed it.
+\section{A TOC with a fancy layout}
+
+Here is a table of contents where
+the sections from a given chapter are to be represented by a number
+range (like 18--22 for a given chapter, 42--49 for another one ...
+of course to be inserted automatically in the TOC).
+
+This is not an image inclusion, the TOC is produced from its original
+|tex| source inserted in this document after replacement of
+|part|, |chapter| or |section| with |dummypart|, |dummychapter| and
+|dummysection| (and there is also a dummy page count). We
+copied the line styles used in the original and
+displayed the table of contents following:
+\begin{verbatim}
+ \etocsetlevel{dummypart} {-1} \etocsetlevel{part} {2}
+ \etocsetlevel{dummychapter}{0} \etocsetlevel{chapter}{2}
+ \etocsetlevel{dummysection}{1} \etocsetlevel{section}{2}
+ \etocsetnexttocdepth{1}
+\end{verbatim}
+Each chapter displays the numbers of only the first and the last sections it
+ contains. See the
+source file |etoc.dtx| for the details of how this is done.
+Another technique for doing this kind of things is explained in
+ \autoref{ssec:statistics}.
-\subsection{A TOC with a fancy layout}
-Another question (numbered |61297|) on the \TeX{} StackExchange
-site was about using \LaTeX{} to obtain a table of contents where
-the sections from a given chapter would be represented by a number
-range (like 18--22 for a given chapter, 42--49 for another one ...
-of course to be inserted automatically in the TOC). Here is
-the result of my effort at using \etoc for this specific problem. How
-this was done will be found on the above cited site.
%\clearpage
@@ -1504,7 +1989,7 @@ this was done will be found on the above cited site.
\rule{.2\linewidth}{2pt}}%
}
- \setcounter{tocdepth}{1}
+ \etocsetnexttocdepth{1}
\tableofcontents
@@ -1669,26 +2154,10 @@ this was done will be found on the above cited site.
\ifnum\tempcount<100
\repeat
\endgroup
-This is not an image inclusion, the TOC is produced from its original
-|tex| source inserted in this document after replacement of
-|part|, |chapter| or |section| with |dummypart|, |dummychapter| and
-|dummysection| (and there is also a dummy page count). We
-copied the line styles used in the original and
-displayed the table of contents following:
-\begin{verbatim}
- \etocsetlevel{dummypart} {-1} \etocsetlevel{part} {2}
- \etocsetlevel{dummychapter}{0} \etocsetlevel{chapter}{2}
- \etocsetlevel{dummysection}{1} \etocsetlevel{section}{2}
- \setcounter{tocdepth}{1}
-\end{verbatim}
-Each chapter displays the numbers of only the first and the last sections it
- contains. A technique for doing this is explained in the
- \autoref{ssec:statistics}.
+\section{Another compatibility mode}
-\subsection{Another compatibility mode}
-
-As explained in the section \ref{ssub:compat}, the commands
+As explained in \autoref{ssub: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
@@ -1712,7 +2181,7 @@ the document class defaults:
Here is how to proceed. One puts in the preamble:
\begingroup
-\def\MacroFont{\small\ttfamily\baselineskip11pt\relax}
+\def\MacroFont{\ttfamily\small\hyphenchar\font45 \baselineskip11pt\relax}
\begin{verbatim}
\makeatletter
\newcommand{\MyStandardTOC}{%
@@ -1772,12 +2241,12 @@ 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:partone}}
+\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=3
+ {\ifnum\etocthenumber=5
\etocsetstyle{subsection}
{\par\nopagebreak\begingroup
\leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
@@ -1806,33 +2275,53 @@ are printed exactly as in the default (except for the subsections of one
specific user-chosen section and except for the color of the section numbers),
with no need to specify explicitely any length, font or other formatting
instructions. But we had to examine the |scrartcl| sources to determine what to
-use for \csa{leftskip} and \csa{rightskip} for our customized subsection
+use for \csa{leftskip} and \csa{rightskip} for our customized section
entries.
-Also, a fancier layout has been commented out.
-\subsection{The TOC as a tree}\label{tocastree}
+\section{The TOC as a tree}\label{tocastree}
Using |tikz|\footnote{\url{http://ctan.org/pkg/pgf}} and the package
-|tikz-qtree|\footnote{\url{http://ctan.org/pkg/tikz-qtree}} we shall display the
-table of contents of this part as a tree. The technique (this whole subsection
-perhaps should have double dangerous-bend signs) is to use the \etoc modified
-command \csa{tableofcontents} not for typesetting, but to prepare a
-macro, or rather here a token list with name \csa{treetok}, with all the
-instructions to be executed later. Putting \csa{etocnumber} or \csa{etocname}
+|forest|\footnote{\url{http://ctan.org/pkg/forest}} we shall display the table
+of contents of this part as a tree. The technique is to
+use the \etoc modified command \csa{tableofcontents} not for typesetting, but to
+prepare a macro, or rather here a \emph{token list} variable, with all the
+instructions to be executed later. \textsc{Leslie Lamport}'s book has no mention
+whatsoever of token lists, and \LaTeX{} gives the impression to not really
+expect the general user to ever hear about them (or delimited macros); this
+whole section and the next are thus for
+advanced users.
+
+Putting the \csa{etocnumber} and \csa{etocname}
commands in \csa{treetok} would be of no use: to which number or name would they
-refer to, in such a delayed execution? Rather the \emph{contents} of
-\csa{etocthenumber} or \csa{etocthename} are added with suitable decoration to
-\csa{treetok}: the \etoc line styles are modified to expand once
-\csa{etocthename} (for example) at the time of the execution and then add the
-outcome to \csa{treetok} for later execution in a |tikzpicture|.
+then refer to, in a delayed execution?
+
+We need to store, not the macro names, but the macro contents. And also we wish
+to maintain the correct |hyperref| hyperlinks.\footnote{This manual up to the
+version of May 14, 2013 used package |qtikz-tree| but there were problems with
+hyperlinks. No such problem arises either when using |forest| or the native
+|tikz| syntax for trees (which will be illustrated in the next section).} The
+hyperlink information put by \etoc inside \csa{etocname}, etc\dots, is just a
+pointer, not storable for later use; but the package provides
+\csa{etocthelinkednumber}, \csa{etocthelinkedname}, and \csa{etocthelinkedpage}
+whose contents contain the hyperlink in a form which can be stored and later
+reused.
+
+The various \etoc styles for sections, subsections, \dots, use a
+macro |\appendtotok| whose r\^ole is to append to a given token
+list variable the once-expanded macro given as second argument.
+The token list register used is called |\treetok|. All this will happen
+in reaction to a |\tableofcontents| command, but \emph{nothing} is
+yet printed in the process.\footnote{There is always a \csa{par},
+which here is not a problem, but can be suppressed if need be via
+the command \csb{etocinline} or its synonym \csb{etocnopar}.} This
+is the later job of a |forest| environment containing the contents
+of |\treetok|.
\newtoks\treetok
\newtoks\tmptok
-\newcommand*\qtreenode{}
-
-\newcommand*\appendtotok[2]{% #1=token list, #2=macro, expands once #2
+\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter
{\expandafter\the\expandafter #1#2}}
@@ -1841,158 +2330,174 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|.
% 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\qtreenode{ [.{\noexpand\parbox{2cm}{\the\tmptok}}}%
+ \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\qtreenode{ [.{\noexpand\parbox{6cm}{\the\tmptok}}}%
+ \edef\foresttreenode{ [{\noexpand\parbox{6cm}{\the\tmptok}}}%
}
\etocsetstyle{section}
{\etocskipfirstprefix}
{\appendtotok\treetok{ ]}}
- {\PrepareSectionNode \appendtotok\treetok\qtreenode}
+ {\PrepareSectionNode \appendtotok\treetok\foresttreenode}
{\appendtotok\treetok{ ]}}
\etocsetstyle{subsection}
{\etocskipfirstprefix}
{\appendtotok\treetok{ ]}}
- {\PrepareSubsectionNode \appendtotok\treetok\qtreenode}
+ {\PrepareSubsectionNode \appendtotok\treetok\foresttreenode}
{\appendtotok\treetok{ ]}}
\etocsettocstyle
- {\treetok{\Tree [.{\hyperref[part:one]{Overview}}}}
+ {\treetok{[{\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ]}}
-\setcounter{tocdepth}{2}
-\smallskip
-\tableofcontents \ref{toc:partone}
-
-{\centering
- \begin{tikzpicture}[grow'=right]
- \tikzset{sibling distance=1ex,
- level 1/.style={level distance=3cm},
- level 2/.style={level distance=6cm},
- every level 0 node/.style={draw,fill=cyan!5,inner sep=6pt},
- every level 1 node/.style={draw,circle,thick,fill=blue!5},
- every level 2 node/.style={draw,thick,fill=red!5},
- edge from parent/.style= {%
- draw, thick, color=teal,
- edge from parent path=
- {[dashed](\tikzparentnode.east) -- (\tikzchildnode.west)}}
- }
- \the\treetok
- \end{tikzpicture}
-\par
-}
-\smallskip
-
-We told \etoc to insert the |hyperref|
-links inside the argument to the
- \csa{Tree} command (from package |tikz-qtree|).%
-\footnote{this uses the macro \csa{etocthelinkedname} introduced with
-package version |1.07f|. The same effect was achieved in earlier versions
-in a more complicated
-manner.} But here in
- our use of |tikz-qtree| we have been confronted with the problem that the
- hyperlinks, even if correctly added to the \csa{treetok} token list, appear
- in the final document in wrong locations (except for the bottom section and
-the bottom subsection nodes).
-\footnote{|dvipdfmx| complains:\quad
-|** WARNING ** Annotation out of page boundary.|\quad
-|Current page's MediaBox: [0 0 595.276 841.89]|\quad
-|Annotation: [94.3997 1200.33 146.512 1209.98]|.
-I read on the internet that there is some problem with |pgf| with regards to
-hyperlinks, but I don't know if this is the same issue (as this is my first
-ever use of TikZ). [2013/03/01]\\
-Update [2013/03/03]: it \emph{does} work when using the regular TikZ syntax
-for trees, so perhaps there is here some interaction with |tikz-qtree|. See next section.}
-
-Here is the code used, the whole thing being with double dangerous-bend
-signs, I shall not comment much the actual \LaTeX{} programming used
-therein:
+
+% 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{2}
+ \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*}
+
+
+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:
\begingroup
-\def\MacroFont{\small\ttfamily\baselineskip10pt\relax}
+\def\MacroFont{\ttfamily\small\hyphenchar\font45 \baselineskip10pt\relax}
\begin{verbatim}
-\newtoks\treetok \newtoks\tmptok \newcommand*\qtreenode{}
-\newcommand*{\appendtotok}[2]{% #1=token list, #2=macro, expands once #2
+\newtoks\treetok
+\newtoks\tmptok
+
+\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter
{\expandafter\the\expandafter #1#2}}
-\newcommand*{\PrepareSectionNode}{%
+\newcommand*\PrepareSectionNode{%
\tmptok {\centering\bfseries}%
\appendtotok\tmptok\etocthelinkedname
- \edef\qtreenode{ [.{\noexpand\parbox{2cm}{\the\tmptok}}}%
+ \edef\foresttreenode{ [{\noexpand\parbox{2cm}{\the\tmptok}}}%
}
+
\newcommand*{\PrepareSubsectionNode}{%
\tmptok {\raggedright}%
\appendtotok\tmptok\etocthelinkedname
- \edef\qtreenode{ [.{\noexpand\parbox{6cm}{\the\tmptok}}}%
+ \edef\foresttreenode{ [{\noexpand\parbox{6cm}{\the\tmptok}}}%
}
-%%%% only sections and subsections:
+
\etocsetstyle{section}
{\etocskipfirstprefix}
{\appendtotok\treetok{ ]}}
- {\PrepareSectionNode \appendtotok\treetok\qtreenode}
+ {\PrepareSectionNode \appendtotok\treetok\foresttreenode}
{\appendtotok\treetok{ ]}}
+
\etocsetstyle{subsection}
{\etocskipfirstprefix}
{\appendtotok\treetok{ ]}}
- {\PrepareSubsectionNode \appendtotok\treetok\qtreenode}
+ {\PrepareSubsectionNode \appendtotok\treetok\foresttreenode}
{\appendtotok\treetok{ ]}}
\etocsettocstyle
- {\treetok{\Tree [.Overview}}
+ {\treetok{[{\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ]}}
-% See the tikz-qtree (David Chiang) documentation for the Qtree syntax of
-% Alexis Dimitriadis (the spaces at various places before the square
-% brackets are important).
-
-% The whole effect of \tableofcontents will be to fill the token list
-% \treetok according to the syntax expected by tikz-qtree. The opening
-% portion of \etocsettocstyle initializes \treetok, and the closing portion
-% adds a final square bracket. A \global is needed as etoc always creates a
-% group when typesetting a TOC.
-
-% This QTree syntax has the advantage to use square brackets and not braces,
-% which eases things quite a bit in a TeX context. The next section explains
-% how to create a token list with the original TikZ syntax for trees.
-
-\tableofcontents \ref{toc:partone}
-% Time now to display the tree (see tikz-qtree documentation)
-\begin{tikzpicture}[grow'=right]
-\tikzset{sibling distance=1ex,
- level 1/.style={level distance=4cm},
- level 2/.style={level distance=6cm},
- every level 0 node/.style={draw,fill=cyan!5,inner sep=6pt},
- every level 1 node/.style={circle,draw,thick,fill=blue!5},
- every level 2 node/.style={draw,thick,fill=red!5},
- edge from parent/.style= {%
- draw, thick, color=teal,
- edge from parent path=
- {[dashed](\tikzparentnode.east) -- (\tikzchildnode.west)}}
- }
-\the\treetok
-\end{tikzpicture}
-\end{verbatim}
-\endgroup
+% forest does not like @\the\treetok if \treetok is empty. On first latex
+% run, this will be the case because the TOC style defined above will not
+% have been executed, as the label {toc:overview} does not refer to a valid
+% TOC yet. So we must give a safe default value to \treetok
+\treetok{[{run latex again}]}
-\subsection{The TOC as a molecule}\label{ssec:molecule}
+\begin{figure*}[th!]\centering
+ \etocsetnexttocdepth{2}
+ \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}}{},
+ rectangle, thick, fill=cyan!5, inner sep=6pt,
+ @\the\treetok
+ \end{forest}
+\end{figure*}
+\end{verbatim}
+\endgroup
-It is also possible to construct a TOC tree obeying the TikZ syntax for trees:
-this is a more complicated task for the \etoc line styles for reasons related to
-the importance of braces in \TeX{}, they need, when filling up the token list to
-be always balanced at each step (unfortunately \textsc{Leslie Lamport}'s book
-has no mention whatsoever of token lists, and \LaTeX{} does not really expect
-users to know about them; this whole section is thus for advanced users).
+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
+%\csa{hypersetup}\texttt{\{hidelinks\}} % ok pour hyphénation
+%\csa{hypersetup}|{hidelinks}| % pas ok
+|\hypersetup{hidelinks}| % ok maintenant 12 octobre 2013
+ in the |.toc| file. But at the time the
+|\treetok| contents are unpacked the |\hyperlink| commands
+originating in
+|\etocthelinkedname|, etc\dots{} will be executed in the normal
+environment for links (which, in this document, is to colorize
+them). Rather than having \etoc's code try to guess what the current ``style''
+for links is (a concept not really provided by |hyperref| it
+seems) and store it in |\etocthelinkedname|, etc\dots, I opted for
+the simpler solution to leave it up to the user to recreate
+whatever conditions are desired. So here it is necessary to re-issue
+|\hypersetup{hidelinks}| in the |figure| environment.
+
+There are some other examples in this documentation where
+|\tableofcontents| is used to prepare material for later
+typesetting, as for example (see \autoref{ssec:statistics}) for
+printing the statistics at the start of each Part: the code there
+uses save boxes, so the problem of the appearance of the links
+does not arise then, they will be stored as ready to be re-used
+boxes.
+
+
+\section{The TOC as a molecule}\label{ssec:molecule}
+
+It is also possible to construct a TOC tree obeying the TikZ
+syntax for trees: but this is a more complicated task for the
+\etoc line styles for reasons related to the way braces are
+handled by \TeX{} (they need, when filling up the token list to be
+always balanced at each step, else complicated tricks must be
+employed.)
The simplest strategy is to allocate a token list (or use a macro) for each
level used: we may need a \csa{parttok}, a \csa{chaptertok}, a
@@ -2001,19 +2506,11 @@ up the total \csa{treetok}. As we are interested here in the table of
contents of this (or another) document part, only a \csa{sectiontok} and a
\csa{subsectiontok} will be needed.
-And the nice thing is that now, our hyperlinks do work. As mentioned already we
-can not use the commands \csa{etocname}, etc\dots, for delayed execution. We can
-on the other hand store the current values of \csa{etocthename}, etc\dots, but
-don't get then the |hyperref| links. Earlier versions of this documentation
-explained how to do things with |\hyperlink| and |\Hy@tocdestname|, but since
-|1.07f|, the package provides \csa{etocthelinkedname}, etc\dots, specifically
-for
-this kind of task.
\begingroup
-\def\MacroFont{\small\ttfamily\baselineskip10pt\relax}
+\def\MacroFont{\ttfamily\small\hyphenchar\font45 \baselineskip10pt\relax}
\begin{verbatim}
-% \newtoks\treetok
+% \newtoks\treetok % already done earlier
\newtoks\sectiontok \newtoks\subsectiontok \newcommand*{\treenode}{}
\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
@@ -2025,7 +2522,6 @@ this kind of task.
\edef\treenode{node {\the\tmptok}}%
}
-\setcounter{tocdepth}{2}
\etocsetstyle{section}
{\etocskipfirstprefix}
{\appendchildtree\treetok\sectiontok}
@@ -2039,31 +2535,15 @@ this kind of task.
{\appendchildtree\sectiontok\subsectiontok}
\etocsettocstyle
- {\treetok{\node {\hyperref[part:one]{Overview}}}}
+ {\treetok{\node {\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ;}}
-\tableofcontents \ref{toc:partone}
-\end{verbatim}
-
-
-At this stage, \cs{treetok} has been prepared, and a TikZ picture can be
-created (it uses the TikZ library |trees| for its ``cyclic'' grow method):
-\begin{verbatim}
-\begin{center}
- \begin{tikzpicture}
- [grow cyclic,
- level 1/.style={level distance=4cm,sibling angle=60},
- level 2/.style={level distance=2cm,sibling angle=60},
- every node/.style={ball color=red,circle,text=cyan},
- edge from parent path={[dashed,very thick,color=cyan]
- (\tikzparentnode) --(\tikzchildnode)}]
- \the\treetok
- \end{tikzpicture}
-\end{center}
+% moved to the inside of the figure environment for correct \pageref{toc:molecule}
+% \etocsetnexttocdepth{2}
+% \tableofcontents \label{toc:molecule} \ref{toc:overview}
\end{verbatim}
\endgroup
-
\newtoks\sectiontok
\newtoks\subsectiontok
\newcommand*\treenode {}
@@ -2092,44 +2572,79 @@ created (it uses the TikZ library |trees| for its ``cyclic'' grow method):
\subsectiontok\expandafter{\treenode}}
{\appendchildtree\sectiontok\subsectiontok}
-\setcounter{tocdepth}{2}
-
\etocsettocstyle
- {\treetok{\node {\hyperref[part:one]{Overview}}}}
+ {\treetok{\node {\hyperref[part:overview]{Overview}}}}
{\global\appendtotok\treetok{ ;}}
-\tableofcontents \ref{toc:partone}
+\begin{figure*}[th!]\centering
+\etocsetnexttocdepth{2}
+ \tableofcontents \label{toc:molecule}\ref{toc:overview}
+ \hypersetup{hidelinks}%
+ \begin{tikzpicture}
+ [grow cyclic,
+ level 1/.style={level distance=4cm,sibling angle=120},
+ 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}
+ \centeredline{A table of contents as a ``molecule.''}
+\end{figure*}
+
+% Pour que \pageref fonctionne correctement, je dois mettre
+% le \tableofcontents dans la figure.
+
-\begin{center}
+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).
+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:
+\begingroup
+\def\MacroFont{\ttfamily\small\hyphenchar\font45 \baselineskip10pt\relax}
+\begin{verbatim}
+\begin{figure*}[th!]\centering
+ \etocsetnexttocdepth{2}
+ \tableofcontents \label{toc:molecule} \ref{toc:overview}
+ \hypersetup{hidelinks}%
\begin{tikzpicture}
[grow cyclic,
- level 1/.style={level distance=4cm,sibling angle=60},
+ level 1/.style={level distance=4cm,sibling angle=120},
level 2/.style={level distance=2cm,sibling angle=60},
- every node/.style={ball color=red,circle,text=cyan},
+ 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{center}
+\end{figure*}
+\end{verbatim}
+\endgroup
+
+
-This is nice, and especially so as this ``molecule TOC'' is fully hyperlinked!
-I don't know why it goes wrong for the trees
-constructed with the \cs{Tree} command of package |tikz-qtree|, contrarily to
-those coded as here with the original ``child'' TikZ syntax.
+This \hyperref[toc:molecule]{TikZ TOC} is fully hyperlinked, like the
+previous
+\hyperref[toc:forest]{Forest TOC}.
\etocsettocstyle
{\treetok{\node {\autoref{part:globalcmds}}}}
{\global\appendtotok\treetok{ ;}}
+\etocsetnexttocdepth {subsection}
\tableofcontents \ref{toc:globalcmds}
\noindent
-\parbox{4cm}{\begin{tikzpicture}
+\parbox{4cm}{\hypersetup{hidelinks}%
+ \begin{tikzpicture}
[grow cyclic,
level 1/.style={level distance=2.5cm,sibling angle=60},
- level 2/.style={level distance=1cm,sibling angle=50},
- every node/.style={ball color=red,circle,text=cyan},
+ level 2/.style={level distance=1cm,sibling angle=45},
+ every node/.style={ball color=red!50,circle,text=black},
edge from parent path={[very thick,color=cyan]
(\tikzparentnode) --(\tikzchildnode)}]
\the\treetok
@@ -2137,19 +2652,20 @@ those coded as here with the original ``child'' TikZ syntax.
\begin{minipage}{\dimexpr\linewidth-4cm\relax}
On the side, the (fully hyperlinked) table of contents of
\autoref{part:globalcmds}.
- \def\MacroFont{\small\ttfamily\hyphenchar\font-1 \baselineskip10pt\relax}%
+ \def\MacroFont{\ttfamily\small\hyphenchar\font-1 \baselineskip10pt\relax}%
\begin{verbatim}
\etocsettocstyle
{\treetok{\node {\autoref{part:globalcmds}}}}
{\global\appendtotok\treetok{ ;}}
+\etocsetnexttocdepth {subsection}
\tableofcontents \ref{toc:globalcmds}
\noindent
-\parbox{4cm}{%
+\parbox{4cm}{\hypersetup{hidelinks}%
\begin{tikzpicture}
[grow cyclic,
level 1/.style={level distance=2.5cm,sibling angle=60},
- level 2/.style={level distance=1cm,sibling angle=50},
- every node/.style={ball color=red,circle,text=cyan},
+ level 2/.style={level distance=1cm,sibling angle=45},
+ every node/.style={ball color=red!50,circle,text=black},
edge from parent path={[very thick,color=cyan]
(\tikzparentnode) --(\tikzchildnode)}]
\the\treetok
@@ -2158,11 +2674,12 @@ those coded as here with the original ``child'' TikZ syntax.
\end{verbatim}
\end{minipage}
-\part{Package commands for line styles}
+% \vfill\eject
-\thispartstats
+\part{Package commands for the toc line styles}
+\label{part:linestyles}
-\setcounter{tocdepth}{3}
+\thispartstats
\etocsetstyle{section}
{\begin{enumerate}[leftmargin=.75cm, label=\etocifnumbered
@@ -2172,7 +2689,7 @@ those coded as here with the original ``child'' TikZ syntax.
% (try \section{\fbox{A}} with and without xcolor). The fix
% was to \protect the \fbox used in the |enumitem| label.
% Strangely enough, with |hyperref| active, the problem did
-% not show up. Anyhow I now use \fcolorbox reather than \fbox
+% not show up. Anyhow I now use \fcolorbox rather than \fbox
% and there is no problem anymore. Also I don't have now to
% use \normalcolor which already needed protection.
{\normalsize\bfseries\rmfamily\item}
@@ -2198,13 +2715,17 @@ those coded as here with the original ``child'' TikZ syntax.
\etocruledstyle[1]{\etocfontminusone\color{green}%
\fboxrule1pt\fboxsep1ex
\framebox[\linewidth]
- {\normalcolor\hss Contents of this second part\hss}}
+ {\normalcolor\hss Contents of \autoref{part:linestyles}\hss}}
+
+% \clearpage
\localtableofcontents \label{toc:a}
\section{The \csbhyp{etocsetstyle} command}
-
+\label{etocsetstyle}
\subsection{The \csbhyp{etocname} and \csbhyp{etocpage} commands}
+\label{etocname}
+\label{etocpage}
Let us explain how \etoc was used to produce the table of
contents displayed at the beginning of this second part.
@@ -2283,6 +2804,7 @@ links are kept in the commands \csa{etocname}, \csa{etocnumber} and
\csa{etocpage} (this last one will have a link only if |hyperref| was passed option \emph{linktoc=all}.)
\subsection{The \csbhyp{etocskipfirstprefix} command}
+\label{etocskipfirstprefix}
The chosen |subsubsection| style also uses the command
\csb{etocskipfirstprefix}, which, if present, \emph{must} be
@@ -2302,6 +2824,8 @@ where no provision is made for them and added the definitive:
This is also the situation with the default package line styles!
\subsection{The \csbhyp{etocnumber} command}
+\label{etocnumber}
+
So far, our specifications would use the numbering generated
by the |enumerate| environments, but of course we generally want
the actual numbers as found in the |.toc| file. This is
@@ -2322,6 +2846,7 @@ without needing an added |\protect|.
\subsubsection{The \csbhyp{etocifnumbered} switch}
+\label{etocifnumbered}
The \csa{fbox} would give an unaesthetic result in the case of
an unnumbered section (which ended up in the table of
@@ -2358,6 +2883,9 @@ this: |{...(page \etocpage)\par}|.
\subsection{The \csbhyp{etocthename}, \csbhyp{etocthenumber}, and
\csbhyp{etocthepage} commands}
+\label{etocthename}
+\label{etocthenumber}
+\label{etocthepage}
It is sometimes desirable to have access to the name, number
and page number without the hyperref link data: something
@@ -2372,6 +2900,7 @@ contexts (for example in a label specification) they should be
preceded by |\protect|.
\subsection{The \csbhyp{etoclink} command}
+\label{etoclink}
The command \csb{etoclink}\marg{linkname} can be used in the line style
specifications in a manner analogous to the argument-less
@@ -2391,6 +2920,11 @@ The command \csa{etoclink} is robust.
\subsection{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber},
\csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands.}
+\label{etocthelinkedname}
+\label{etocthelinkednumber}
+\label{etocthelinkedpage}
+\label{etocthelink}
+
This is for advanced uses by advanced users.
@@ -2414,9 +2948,9 @@ which allows to make a link with an arbitrary name.
All these commands are fragile.
-\section{The \csbhyp{etocsetlevel} command}
+\section{The \csbhyp{etocsetlevel} command}\label{etocsetlevel}
-As already explained in the section \ref{sec:surprising}, one
+As already explained in \autoref{part:surprising}, one
can inform \etoc of a level to associate to a given sectioning
command with \csa{etocsetlevel}. For example:
\begin{verbatim}
@@ -2434,8 +2968,12 @@ matters is that the line styles have been set. If for example
has already been done (and it has been done by the package
itself in its definition of its own line styles).
-The accepted levels run from |-2| to |6| inclusive. Anything else is
-mapped to |6|, which is a dummy level, never displayed. The package
+The accepted levels run from |-2| to |6| inclusive. Anything else is
+mapped to |6|, which is a dummy level, never displayed\footnote{as explained in
+\autoref{etocsettocdepth.toc}, this is not quite true as associating a unit name
+to the numeric level |-3| is
+allowed for special tricks, but one should not assign a line style to any name
+with numeric level |-3|.}. The package
does:
\begin{verbatim}
\etocsetlevel{book}{-2}
@@ -2451,18 +2989,20 @@ does:
are illustrated by the main table of contents of this
document.
-These level assignments can be modified at anytime: see the
-section \ref{sec:surprising} for various applications of this technique. As one
+These level assignments can be modified at anytime: see
+\autoref{part:surprising} for various applications of this
+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}
-\setcounter{tocdepth}{3}
+\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
% commands, so \etoctoclines could have been used, too.
\etocmarkboth\contentsname
\etocmulticolstyle[1] % one-column display
- {\noindent\bfseries\Large
+ {\pdfbookmark[1]{Table of contents}{MAINTOC}% create a bookmark in the pdf
+ \noindent\bfseries\Large
\leaders\hrule height1pt\hfill
\MakeUppercase{Table of Contents}}
\begingroup % use a group to limit the scope of the
@@ -2494,7 +3034,7 @@ Let us switch to the color red, and also add this command to the |.toc| file:
\color{red!50}
\addtocontents{toc}{\string\color{red!50}}
-\def\MacroFont{\footnotesize\ttfamily}
+\def\MacroFont{\ttfamily \footnotesize\hyphenchar\font45 }
\begin{verbatim}
\color{red!50} % changing text color
\addtocontents{toc}{\string\color{red!50}} % and also in the .toc file
@@ -2543,23 +3083,19 @@ multi-lingual document, as the |babel| package writes to the |.toc| file the
language changes occurring in the document.
-%\clearpage
+% \clearpage
-\part{Package commands for toc display styles}
+\part{Package commands for the toc display style}
\label{part:globalcmds}
-
-\thispartstats
-
-
\begin{verbatim}
-\setcounter{tocdepth}{-3}
-\localtableofcontents \label{toc:globalcmds}
+\invisiblelocaltableofcontents \label{toc:globalcmds}
\end{verbatim}
-\setcounter{tocdepth}{-3}
-\localtableofcontents \label{toc:globalcmds}
+\invisiblelocaltableofcontents \label{toc:globalcmds}
+
+\thispartstats
\section{Specifying the toc display style}
@@ -2578,7 +3114,7 @@ shortcuts:
\etocruled[1]{Title} (or \etoclocalruled[1]{Title})
\end{verbatim}
-\subsection{The command \csbhyp{etocruledstyle}}
+\subsection{The command \csbhyp{etocruledstyle}}\label{etocruledstyle}
The general format of \csa{etocruledstyle} is:\\
\centerline{\color{blue}\csa{etocruledstyle}%
@@ -2600,11 +3136,11 @@ the \hyperref[toc:a]{%
\etocruledstyle[1]{\etocfontminusone\color{green}%
\fboxrule1pt\fboxsep1ex
\framebox[\linewidth]
- {\normalcolor\hss Contents of this second part\hss}}
+ {\normalcolor\hss Contents of this part\hss}}
\end{verbatim}
-\subsection{The command \csbhyp{etocmulticolstyle}}
+\subsection{The command \csbhyp{etocmulticolstyle}}\label{etocmulticolstyle}
This is also a command with one optional and one mandatory argument:\\
\centerline{\color{blue}\csa{etocmulticolstyle}%
@@ -2636,7 +3172,7 @@ And there is also
\csa{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}.
-\subsubsection{The command \csbhyp{etoctocstyle}}
+\subsubsection{The command \csbhyp{etoctocstyle}}\label{etoctocstyle}
\centeredline{\color{blue}\csa{etoctocstyle}\oarg{kind}%
\marg{number\_of\_columns}\marg{title}}
@@ -2646,8 +3182,11 @@ And there is also
where |kind| is one of |chapter|, |section|, . . . and defaults
to |chapter| or |section| depending on the document class.
-\paragraph{\texorpdfstring{\csb{etoc\-toc\-style\-with\-marks}}{etoctocstylewithmarks}}%
+\paragraph{\texorpdfstring{\csbhyp{etoc\-toc\-style\-with\-marks}}{etoctocstylewithmarks}}%
\leavevmode\unskip{\color{blue}\oarg{kind}\marg{number\_of\_columns}\marg{title}\marg{mark}}
+\label{etoctocstylewithmarks}
+\label{etoctocstylewithmarksnouc}
+
\centeredline
{=\csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|%
|{\kind*{|\itshape title \ttfamily\upshape\string\markboth%
@@ -2663,6 +3202,8 @@ which does not uppercase.
\paragraph{really?}
\subsection{The command \csbhyp{etocruled}}
+\label{etocruled}
+\label{etoclocalruled}
As a shortcut to set the style with \csb{etocruledstyle} and
then issue a
@@ -2673,6 +3214,7 @@ affected, there is:\\
And the local form will be \csb{etoclocalruled}.
\subsection{The commands \csbhyp{etocframedstyle} and \csbhyp{etocframed}}
+\label{etocframedstyle}\label{etocframed}
Same mechanism:\\
\centerline{\color{blue}\csa{etocframedstyle}%
@@ -2687,8 +3229,10 @@ inside the \meta{title} argument to \csa{etocframedstyle} or
\csa{etoclocalframed}.
\subsection{Headings, titles, \csbhyp{etocinnertopsep}}
+\label{etocinnertopsep}
+\label{etocoldpar}
-[\emph{modified in v1.07}] There is a slight difference
+There is a slight difference
between \csa{etocmulticolstyle} and \csa{etocruledstyle} or
\csa{etocframedstyle}. For \csa{etocmulticolstyle} the mandatory
\meta{heading} argument can be something like:
@@ -2700,42 +3244,21 @@ document preparation system}). This means that multiline
contents arguments to \csa{etocruledstyle} or
\csa{etocframedstyle} must be enclosed in something like a \csa{parbox}.
-[\emph{new in v1.07}] The command \csa{etocmulticolstyle} now
+The command \csa{etocmulticolstyle} now
also accepts horizontal mode material in its mandatory
argument \meta{heading}: it internally automatically adds a
closing |\par|. So one can use for example
-|\etocmulticolstyle{Hello World}|. Speaking of |\par|, there
-is a |multicols| aspect which has nothing to do with \etoc,
-the input on the left creates a compilation error:
-\begingroup\renewcommand\columnseprule{.4pt}
-\begin{multicols}{2}
-\begin{verbatim}
-\begin{multicols}{2}[hello\par world]
-someone here?
-\end{multicols}
-\end{verbatim}
-\columnbreak
-\begin{verbatim}
-\let\oldpar\par
-\begin{multicols}{2}[hello\oldpar world]
- at least me.
-\end{multicols}
-\end{verbatim}
-\end{multicols}
-\endgroup
-But the version on the right does not (it disguises |\par| so as to be
-acceptable). \etoc provides
-\csb{etocoldpar} as a substitute for |\par| (it does
-|\let\etocoldpar\par| just before the |multicols|
-environment and automatically adds it to close the heading,
-before the vertical skip of value
-\csa{etocinnertopsep}).\footnote{this command \csa{etocoldpar} (=
-working \csa{par} in the argument to \csa{etocmulticolstyle}) is
-not related to the switch \csa{etocinline} whose purpose is to
-tell \etoc not to do a \csa{par} before the table of
-contents.} The command \csb{etocoldpar} can also be used
-explicitely in the mandatory argument to
-\csa{etocmulticolstyle}.
+|\etocmulticolstyle{Hello World}|.
+
+As \csa{etocmulticolstyle} does not accept |\par| in is optional heading
+argument, \etoc provides \csb{etocoldpar} as a substitute for |\par| (it does
+|\let\etocoldpar\par| just before the |multicols| environment and
+automatically adds it to close the heading, before the vertical skip of value
+\csa{etocinnertopsep}).\footnote{this command \csa{etocoldpar} (= working
+ \csa{par} in the argument to \csa{etocmulticolstyle}) is not related to the
+ switch \csa{etocinline} whose purpose is to tell \etoc not to do a \csa{par}
+ before the table of contents.} The command \csb{etocoldpar} can also be used
+explicitely in the mandatory argument to \csa{etocmulticolstyle}.
An important dimension used by all three of \csa{etocmulticolstyle},
@@ -2748,6 +3271,7 @@ value is |2ex| and it is changed by
\subsection{The command \csbhyp{etocsettocstyle}}
+\label{etocsettocstyle}
This is a command with two mandatory arguments:\\
\centerline{\color{blue}\csa{etocsettocstyle}\marg{before\_toc}%
@@ -2775,14 +3299,28 @@ The previously described commands \csa{etocmulticolstyle},
\marg{after\_toc}.
\subsection{The compatibility mode \csbhyp{etocstandarddisplaystyle}}
+\label{etocstandarddisplaystyle}
\etoc will then emulate what the document class would have
done regarding the global display style of the table of
contents, in its absence. All customizing from inside the
class should be obeyed, too.
+\subsection{The command \csbhyp{etocinline}}
+\label{etocinline}
+\label{etocnopar}
+
+With |\etocinline|, or its synonym |\etocnopar|, the |\tableofcontents|
+command and its variants do not first issue a |\par|. This way, the table of
+contents can be printed in an inline style; or, if is is used only for
+preparing some token list or macro, it will leave nothing in the token stream
+on execution.
+
\section{Starred variants of the \csbhyp{tableofcontents}
etc... commands}
+\label{etocaftertitlehook}
+\label{etocaftercontentshook}
+\label{etocmemoirtoctotocfmt}
The \toc, \localtoc, \csa{etocmulticol}, etc... have starred
variants (the star must be before the other arguments). For
@@ -2834,36 +3372,38 @@ 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 part \ref{part:globalcmds}.
+beginning of this \autoref{part:globalcmds}.
\begin{verbatim}
\KOMAoptions{toc=left}
\etocstandarddisplaystyle % necessary for the display to obey toc=left
\etocstandardlines
-\setcounter{tocdepth}{3}
\tableofcontents \ref{toc:globalcmds}
\end{verbatim}
\KOMAoptions{toc=left}
\etocstandarddisplaystyle
\etocstandardlines
-\setcounter{tocdepth}{3}
\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.
-
-% \clearpage
+line styles and some colors added (it has been put in a float which appears
+\vpageref{toc:b}).\footnote{for reasons currently mysterious to me, when I do
+ not de-activate the two-column mode in the figure with the |[1]| optional
+ argument to \csa{etocframedstyle}, there is a color leak from the
+ \csa{color}|\{red\}| line which was added to the |.toc|, not stopped by the
+ \csa{normalcolor} following it. This happens with all three \etoc styles using
+ a |multicols| environment, and has nothing to do with the other color
+ commands, for the frame or the background. |[2013/10/13] 1.07g|}
\begin{verbatim}
\etocdefaultlines
-\begingroup % we use a group to limit the scope of the next commands
+\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}}
-%\renewcommand{\etocbkgcolorcmd}{\relax}
% set up the top and bottom rules
\renewcommand{\etoctoprule}{\hrule height 1pt}
\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
@@ -2876,15 +3416,17 @@ line styles and some colors added.
\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
% use \fcolorbox to set up a colored frame for the title
\fboxrule1pt
-\etocframedstyle{\normalsize\rmfamily\itshape
+\renewcommand{\etocbelowtocskip}{0pt\relax}
+\etocframedstyle [1]{\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 the
- current page. It has the label |toc:b|.}}}
-% set up a label for future (or earlier...) reference
-\setcounter{tocdepth}{3}
+ 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}
@@ -2908,30 +3450,37 @@ line styles and some colors added.
\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
% use \fcolorbox to set up a colored frame for the title
\fboxrule1pt
-\etocframedstyle{\normalsize\rmfamily\itshape
+\renewcommand{\etocbelowtocskip}{-.5\baselineskip\relax}
+\etocframedstyle [1]{\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 the
- current page. It has the label |toc:b|.}}}
-% set up a label for future (or earlier...) reference
+ 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
+% 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 (??)) 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.
+
\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, not for print!
-
-
-%\clearpage
+document, probably not for print! (although I like it, but my personal taste in
+such matters does not seem to be highly shared).
\begingroup
-\setcounter{tocdepth}{3}
\newsavebox{\forsubsections}
-\etocsetstyle{part}{\etocskipfirstprefix}{. \upshape}{\bfseries\etocname:~~}{}
+\etocsetstyle{part}{\upshape. \etocskipfirstprefix}{. \upshape}{\bfseries\etocname:~~}{}
\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }{\mdseries\etocname}{}
\etocsetstyle{subsection}
{\begin{lrbox}{\forsubsections}\upshape\etocskipfirstprefix}
@@ -2941,29 +3490,30 @@ document, not for print!
\etocsetstyle{subsubsection}{ (\itshape\etocskipfirstprefix}
{, }{\etocname}{\/\upshape)}
\etocsettocstyle{Here is the inline table of contents. }{.\par}
-\tableofcontents
+\tableofcontents \label{toc:crazyinline}
\endgroup
-Here is the code which has been used:
+Here is the code which has been used:\footnote{as this new version of the
+ documentation has some sections before the first part, we had to take special
+ measures in the \emph{begin} code for level |part|. }
\begin{verbatim}
\begingroup
-\setcounter{tocdepth}{3}
\newsavebox{\forsubsections}
-\etocsetstyle{part}{\etocskipfirstprefix}{. \upshape}{\bfseries\etocname:~~}{}
-\etocsetstyle{section}{\itshape\etocskipfirstprefix}{, }{\mdseries\etocname}{}
+\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)}
+ {; }{\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
+%% \clearpage
\part{Using and customizing \etoc}
\label{part:custom}
@@ -3064,7 +3614,7 @@ currently defined, not the ones from the cloned toc.
\subsection{The package default line styles: \csbhyp{etocdefaultlines}}
-
+\label{etocdefaultlines}
Activating the use of the package default line styles\footnote{they were written
at a very early stage in the development of the package, and version |1.07e|
@@ -3111,7 +3661,7 @@ medium series; we modify the \csa{etocfontone} command for that.
being printed as chapters, and subsections as sections.
}}}
\etocdefaultlines
-\setcounter{tocdepth}{1}
+\etocsetnexttocdepth{1}
\begingroup
\etocsetlevel{section}{0}
\etocsetlevel{subsection}{1}
@@ -3131,7 +3681,7 @@ medium series; we modify the \csa{etocfontone} command for that.
}}}
\etocdefaultlines
-\setcounter{tocdepth}{1}
+\etocsetnexttocdepth{1}
\begingroup
\etocsetlevel{section}{0}
@@ -3144,20 +3694,15 @@ medium series; we modify the \csa{etocfontone} command for that.
\subsection{One more example TOC layout}
-I got motivated by a
-question\footnote{\href{http://tex.stackexchange.com/questions/83184/how-to-change-style-and-color-of-table-of-content}{tex.stackexchange.com/questions/83184}}
-I saw on the \TeX{} StackExchange site. I copied the color RGB
-specifications from an answer which had been provided to the
-question. The \csa{etocframedstyle} puts the title on the top
+The \csa{etocframedstyle} puts the title on the top
rule in a centered position. This is not very convenient for
this example so we included the title as part of the
\meta{start} code at section level, to get it \emph{inside}
the frame.
-\begingroup\def\MacroFont{\footnotesize\ttfamily}%
+\begingroup\def\MacroFont{\ttfamily\footnotesize\hyphenchar\font45 }%
\begin{verbatim}
-\setcounter{tocdepth}{3}
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
\definecolor{secbackground}{RGB}{0,177,235}
@@ -3229,23 +3774,8 @@ the frame.
\endgroup
-The coding is a bit involved\footnote{and reveals the author's
-preference for the \TeX{} syntax...} as it does not use any additional
-package. Also, it was written at some early stage and I have not revised it
-since.
-A better solution would be to use some package to set
-up a background color possibly extending accross pages, as the
-framed style (which we used to get this background
-color) can only deal with material short enough to fit on one
-page.
-
-Regarding colors, generally speaking all color commands inside
-\etoc are initially defined to do nothing, and the choice to
-use or not colors is left to the user.
-
-\clearpage
-\setcounter{tocdepth}{3}
+% \clearpage
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
@@ -3313,18 +3843,32 @@ use or not colors is left to the user.
\etocframedstyle[1]{}
-\tableofcontents \label{toc:clone} \ref{toc:globalcmds}
-
+\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
+ author's preference for the \TeX{} syntax...} as it does not use any
+additional
+package. Also, it was written at some early stage and I have not revised it
+since.
-\section{Customizing \etoc}
+A better solution would be to use some package to set
+up a background color possibly extending accross pages, as the
+framed style (which we used to get this background
+color) can only deal with material short enough to fit on one
+page.
+Regarding colors, generally speaking all color commands inside
+\etoc are initially defined to do nothing, and the choice to
+use or not colors is left to the user.
+\section{Customizing \etoc}
\subsection{Customizing the \etoc pre-defined line styles}
-
We will simply list the relevant commands as defined in the
package. Customizing them goes through suitable
\csa{renewcommand}s:
@@ -3459,6 +4003,7 @@ accepted here.
% \clearpage
\part{Tips}
+\label{part:tipsandtricks}
\thispartstats
@@ -3492,10 +4037,11 @@ accepted here.
\subsection{Interverting the levels}
\label{subsec:interverting}
-Let us display and count all subsections occurring in this document (see
-section \ref{sec:surprising} for other uses of this technique):
+Let us display and count all subsections occurring in this
+document (see \autoref{part:surprising} for other uses of
+this technique):
\begin{verbatim}
-\setcounter{tocdepth}{2}
+\etocsetnexttocdepth{2}
\begingroup
\etocsetlevel{part}{3}
\etocsetlevel{section}{3}
@@ -3511,7 +4057,7 @@ section \ref{sec:surprising} for other uses of this technique):
\endgroup
\end{verbatim}
-\setcounter{tocdepth}{2}
+\etocsetnexttocdepth{2}
\begingroup
\etocdefaultlines
@@ -3535,9 +4081,6 @@ section \ref{sec:surprising} for other uses of this technique):
\endgroup
-\setcounter{tocdepth}{3}
-
-
\subsection{Displaying statistics}\label{ssec:statistics}
Each part of this document starts with a paragraph telling how many sections and
@@ -3549,12 +4092,12 @@ there is one or none). However, one cannot modify then the font or the color
(using the \TeX{} primitive \csa{setbox} rather than the \LaTeX{} \csa{sbox}
would allow to change the color of the un-boxed saved box). If such a need
arises, one must switch from boxes to macros, and store the |hyperref| data for
-later use as was done in the code presented in the \autoref{ssec:molecule}. We
-did this for the first paragraph of the \autoref{sec:surprising}.
+later use as was done in the code presented in \autoref{ssec:molecule}. We
+did this for the first paragraph of \autoref{part:surprising}.
But first, the coding of \csa{thispartstats}:\par
\begingroup
-\def\MacroFont{\footnotesize\ttfamily\relax}
+\def\MacroFont{\footnotesize\ttfamily\hyphenchar\font45 \relax}
\begin{verbatim}
\newsavebox\firstnamei \newsavebox\firstnumberi
\newsavebox\lastnamei \newsavebox\lastnumberi
@@ -3564,29 +4107,27 @@ But first, the coding of \csa{thispartstats}:\par
\newcommand*{\thispartstatsauxi}{} \newcommand*{\thispartstatsauxii}{}
\newcommand*{\oldtocdepth}{}
\newcommand*{\thispartstats}{%
- \edef\oldtocdepth{\arabic{tocdepth}}%
- \setcounter{tocdepth}{2}%
\setcounter{mycounti}{0}%
\setcounter{mycountii}{0}%
\def\thispartstatsauxi{%
- \sbox{\firstnamei}{\color{cyan}\etocname}%
- \sbox{\firstnumberi}{\color{cyan}\etocnumber}%
+ \sbox{\firstnamei}{\etocname}%
+ \sbox{\firstnumberi}{\etocnumber}%
\def\thispartstatsauxi{}}%
\def\thispartstatsauxii{%
- \sbox{\firstnameii}{\color{cyan}\etocname}%
- \sbox{\firstnumberii}{\color{cyan}\etocnumber}%
+ \sbox{\firstnameii}{\etocname}%
+ \sbox{\firstnumberii}{\etocnumber}%
\def\thispartstatsauxii{}}%
\begingroup
\etocsetstyle{subsection} {} {}
{\thispartstatsauxii
\stepcounter{mycountii}%
- \sbox{\lastnameii}{\color{teal}\etocname}%
- \sbox{\lastnumberii}{\color{teal}\etocnumber}} {}%
+ \sbox{\lastnameii}{\etocname}%
+ \sbox{\lastnumberii}{\etocnumber}} {}%
\etocsetstyle{section} {} {}
{\thispartstatsauxi
\stepcounter{mycounti}%
- \sbox{\lastnamei}{\color{teal}\etocname}%
- \sbox{\lastnumberi}{\color{teal}\etocnumber}}
+ \sbox{\lastnamei}{\etocname}%
+ \sbox{\lastnumberi}{\etocnumber}}
{Here are some statistics for this part: it contains \arabic{mycounti}
section\ifnum\value{mycounti}>1 s\fi{} and \arabic{mycountii}
subsection\ifnum\value{mycountii}>1 s\fi. The name of the first section is
@@ -3597,45 +4138,44 @@ But first, the coding of \csa{thispartstats}:\par
subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}%
\etocinline % don't do a \par automatically (but this is not used, actually).
\etocsettocstyle {}{}
+ \etocsetnexttocdepth{2}%
\localtableofcontents % to be used at the top level of a Part.
\endgroup
- \setcounter{tocdepth}{\oldtocdepth}%
}
\end{verbatim}
%\endgroup
And now, the variant which was used for
- \autoref{sec:surprising}, with macros rather than boxes:
+ \autoref{part:surprising}, with macros rather than boxes:
\begin{verbatim}
\makeatletter
\newcommand*\firstsubname {} \newcommand*\lastsubname {}
\newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {}
-\newcommand*\thissectionstatsaux{}
-
-\newcommand*{\thissectionstats}{%
- \edef\oldtocdepth{\arabic{tocdepth}}%
- \setcounter{tocdepth}{2}%
+\newcommand*\thisspecialstatsaux{}
+\newcommand*{\thisspecialstats}{%
\setcounter{mycounti}{0}%
- \def\thissectionstatsaux{% ou plus simple si on ne veut pas le lien.
+ \def\thisspecialstatsaux{% ou plus simple si on ne veut pas le lien.
\let\firstsubname\etocthelinkedname
\let\firstsubnumber\etocthelinkednumber
- \def\thissectionstatsaux{}}
+ \def\thisspecialstatsaux{}}
\begingroup
\etocsetstyle{subsection} {} {}
- {\thissectionstatsaux
+ {\thisspecialstatsaux
\stepcounter{mycounti}%
\let\lastsubname\etocthelinkedname
\let\lastsubnumber\etocthelinkednumber }
- {Here are some statistics for this section. It contains \arabic{mycounti}
- subsections. The name of its first is \emph{\color{cyan}\firstsubname{}}
- and the corresponding number is {\color{cyan}\firstsubnumber}. The name of
- the last subsection is \emph{\color{teal}\lastsubname{}} and its number is
- {\color{teal}\lastsubnumber}.}%
+ {Here are some statistics for this part. It contains \arabic{mycounti}
+ sections. The name of
+ its first is
+ \emph{\firstsubname{}} and the corresponding number is
+ {\firstsubnumber}. The name of the last section is
+ \emph{\lastsubname{}} and its number is
+ {\lastsubnumber}.}%
\etocsettocstyle {}{}
\etocinline
+ \etocsetnexttocdepth {1}%
\localtableofcontents
\endgroup
- \setcounter{tocdepth}{\oldtocdepth}%
}
\makeatother
\end{verbatim}
@@ -3658,6 +4198,26 @@ the time of the first TOC displaying command.
command: some sort of truce can be achieved if \etoc is loaded last, hence is
the winner.
+ \begin{framed}
+ Do not modify the |\tableofcontents| command like this:
+ \centeredline{|\let\oldtableofcontents\tableofcontents|}
+ \centeredline{|\renewcommand\tableofcontents{\oldtableofcontents\mystuff}|}
+ as this will make the |\label/\ref| mechanism impossible. Rather you may do
+ \centeredline{|\renewcommand\etocaftertochook{\mystuff}|} although this
+ could interfere with \csb{etocsetnexttocdepth} which uses this hook; also
+ available: |\etocaftercontentshook| which is executed a bit earlier (but
+ only if the |tocdepth| was not at the ``|none|'' level), just before the
+ closing part of the toc display style (and thus still within a group.)
+ \end{framed}
+
+ \etoc used to be incompatible with package
+ |tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}}; it now cohabits, sort
+ of, as it deactivates |tovsec2|'s modification of |\tableofcontents| (done in
+ the style above) and also cancels its other |toc|-related macros, but
+ reimplements partially their functionality with \csb{etocsettocdepth.toc}. By
+ the way, at least two latex runs are necessary for new uses of this command in
+ a document to have an effect in tables of contents.
+
When a \localtoc is inserted by the user in the document, a
line containing an \etoc inner command and an identification
number is added to the |.toc| file. The correct local table of
@@ -3671,7 +4231,7 @@ arguments. The macros \csa{etocname}, \csa{etocnumber}, and
that the \emph{linktoc=all} option of |hyperref| tells it to
put a link also in the page number corresponding to a given
toc entry). For example, the tables of contents of the present document are
-all fully linked.\footnote{except the \hyperref[tocastree]{Qtree TOC} ...}
+all fully linked.
It is possible to customize (using package |tocloft| for
example) throughout the document the macros \csa{l@section},
@@ -3680,12 +4240,13 @@ table of contents typeset by \etoc in compatibility mode.
It is possible to use simultaneously \etoc and
{\color{niceone}|tableof|}\footnote{\url{http://www.ctan.org/pkg/tableof}}. For the
-advanced uses such as what is done in the \autoref{ssec:molecule} it is
+advanced uses such as what is done in \autoref{ssec:molecule} it is
important
to know that |tableof| adds one level of grouping inside the |.toc| file itself.
So when one needs to make some information \csa{global}, one can not wait to be
at the level of the second argument of \csa{etocsettocstyle}, as
-|tableof| will already have closed the group then. The \csa{global} things must
+|tableof| will already have closed the group then. The \csa{global} things (on
+volatile data) must
be done at the latest in the \meta{finish} part of the top (or last) sectioning
level used.
This only applies of course to \csa{tableofcontents} or
@@ -3739,38 +4300,48 @@ groups. All TOCs are typeset inside groups.
to run latex a certain number of times to let the produced
document get its final appearance (at least twice).\par
-\bigskip
-This is the documentation as of \docdate, printed from the source file with the
-time stamp ``\dtxtimestamp''. The package version is \pkgversion, of
- \pkgdate. See the source for copyright and license information.\par
+\section{Timestamp}
+This is the documentation as of \texttt{\docdate}, printed from the source file
+with the time stamp \texttt{\dtxtimestamp}. The package version is
+\texttt{\pkgversion}, of \texttt{\pkgdate}.
-\part{The code}
-
-This source file |etoc.dtx| produces
-|etoc.sty| when one does |latex etoc.dtx| or |pdflatex etoc.dtx|
-(an |etoc.ins| file is also produced, for
-distributions expecting it for installation). Two more runs
-are necessary to finish producing the documentation. The
-|etoc.sty| file should be moved to a suitable location within
-the \TeX{} installation.
-\section{Implementation}
+\part{The code}
\makeatletter
-\StopEventually{\check@checksum\end{document}}
+
\let\check@percent\original@check@percent
\makeatother
-Writing-up source code comments is hopefully for a future
-release.
+\small
+
+\def\MacroFont{\ttfamily\hyphenchar\font45
+ \baselineskip11pt\relax }
+
+\section{Implementation}
+
+\StopEventually{\normalsize\ifnum\NoSourceCode=1
+ \texttt{%
+ This documentation has been compiled without inclusion of the source
+ code. To produce the documentation with source code included:\endgraf
+ \ \ \ \ run latex on etoc.dtx (or on etoc.tex if available), \endgraf
+ \ \ \ \ (or first run tex on etoc.ins if available to produce
+ etoc.tex)\endgraf
+ \ \ \ \ then twice latex on etoc.tex,\endgraf
+ \ \ \ \ then dvipdfmx on etoc.dvi\endgraf}
+\fi
+\end{document}}
+
+% Writing-up source code comments is hopefully for a future
+% release.
% I don't want to have to type at this location (far from the top of the
% file) explicitly the package version or version date, as it is
% inconvenient to have to remember to do this when updating the package.
-% Also, I prefer not to add macros to the |.sty| file giveing the package
-% date, name, or version. So I cut out the following from the real macrocode
+% Also, I prefer not to add macros to the |.sty| file giving the package
+% date, name, or version. So I extracted this from the real macrocode
% environment (leaving out the \init@crossref.)
\makeatletter
\begingroup
@@ -3809,7 +4380,6 @@ release.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{multicol}
-%% \RequirePackage{xspace} %% REMOVED (1.07b)
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
% \end{macrocode}
@@ -3817,7 +4387,7 @@ release.
% \begin{macrocode}
\newtoks\Etoc@toctoks
\def\Etoc@par{\par}
-\newcommand*{\etocinline}{\def\Etoc@par{}}
+\def\etocinline{\def\Etoc@par{}}
\let\etocnopar\etocinline
\newif\ifEtoc@jj % book
\newif\ifEtoc@j % part
@@ -3842,16 +4412,21 @@ release.
\newif\ifEtoc@notactive
\newcounter{etoc@tocid}
\newif\ifEtoc@mustclosegroup
-\def\etoc@{\etoc@} % Delimiter in \Etoc@getnb etc.. macros. This def added 1.07f
+\def\etoc@{\etoc@}
+% \end{macrocode}
+% |1.07g| uses a second counter; this could be avoided, but ok, let's not be
+% that strict.
+% \begin{macrocode}
+\newcounter{etoc@tocdepth}% 1.07g
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
\@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}}
\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m@ne
-\chardef\Etoc@@zero@@ 0
-\let\Etoc@@one@@ \@ne
-\let\Etoc@@two@@ \tw@
+\let\Etoc@@zero@@ \z@
+\let\Etoc@@one@@ \@ne
+\let\Etoc@@two@@ \tw@
\let\Etoc@@three@@ \thr@@
\chardef\Etoc@@four@@ 4
\chardef\Etoc@@five@@ 5
@@ -3865,7 +4440,21 @@ release.
\def\Etoc@@three@{three}
\def\Etoc@@four@{four}
\def\Etoc@@five@{five}
-%\def\Etoc@@six@{six}
+% \end{macrocode}
+% |1.07g|
+% \begin{macrocode}
+\expandafter\def\csname Etoc@-3@@\endcsname {-\thr@@}
+\expandafter\let\csname Etoc@-2@@\endcsname \Etoc@@minustwo@@
+\expandafter\let\csname Etoc@-1@@\endcsname \Etoc@@minusone@@
+\expandafter\let\csname Etoc@0@@\endcsname \Etoc@@zero@@
+\expandafter\let\csname Etoc@1@@\endcsname \Etoc@@one@@
+\expandafter\let\csname Etoc@2@@\endcsname \Etoc@@two@@
+\expandafter\let\csname Etoc@3@@\endcsname \Etoc@@three@@
+\expandafter\let\csname Etoc@4@@\endcsname \Etoc@@four@@
+\expandafter\let\csname Etoc@5@@\endcsname \Etoc@@five@@
+\expandafter\let\csname Etoc@6@@\endcsname \Etoc@@six@@
+\let\Etoc@all@@ \Etoc@@five@@
+\let\Etoc@none@@ \Etoc@minf
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -3904,11 +4493,15 @@ release.
\expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@
\expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@
\else
+ \ifnum#2=-\thr@@
+ \expandafter\let \csname Etoc@#1@@\expandafter\endcsname
+ \csname Etoc@-3@@\endcsname
+ \else
\PackageWarning{etoc}
{unexpected value `#2' in \string\etocsetlevel.^^J%
Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}%
\expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@
-\fi\fi\fi}
+\fi\fi\fi\fi}
\etocsetlevel{book}{-2}
\etocsetlevel{part}{-1}
\etocsetlevel{chapter}{0}
@@ -4270,13 +4863,13 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocthename {}
-\newcommand*\etocthenumber {}
-\newcommand*\etocthepage {}
-\newcommand*\etocthelinkedname {}
-\newcommand*\etocthelinkednumber {}
-\newcommand*\etocthelinkedpage {}
-\newcommand*\etocthelink {}
+\let\etocthename \@empty
+\let\etocthenumber \@empty
+\let\etocthepage \@empty
+\let\etocthelinkedname \@empty
+\let\etocthelinkednumber \@empty
+\let\etocthelinkedpage \@empty
+\let\etocthelink \@empty
\DeclareRobustCommand*{\etocname} {}
\DeclareRobustCommand*{\etocnumber}{}
\DeclareRobustCommand*{\etocpage} {}
@@ -4307,10 +4900,9 @@ release.
\closein\Etoc@tf}}
{\typeout{No file \jobname .toc.}}
% \end{macrocode}
-% placeholder for comments
+% 1.07d: parskip and |\@nobreakfalse| stuff moved to |\Etoc@tableofcontents|
% \begin{macrocode}
-\def\Etoc@openouttoc{% formerly \Etoc@starttoc
-%% 1.07d: parskip and \@nobreakfalse stuff moved to \Etoc@tableofcontents
+\def\Etoc@openouttoc{%
\ifEtoc@hyperref
\ifx\hyper@last\@undefined
\IfFileExists{\jobname .toc}
@@ -4325,7 +4917,7 @@ release.
\newwrite \tf@toc
\immediate \openout \tf@toc \jobname .toc\relax
\fi
- \gdef\Etoc@openouttoc{}% 1.07d, rather than using a boolean
+ \gdef\Etoc@openouttoc{}%
}
% \end{macrocode}
% placeholder for comments
@@ -4396,14 +4988,19 @@ release.
\Etoc@next}
\let\etoc@startlocaltoc\@gobble
% \end{macrocode}
-% placeholder for comments
+% |1.07g| suppresses the printing of |--unknown etoc ref: run latex again--| as
+% sometimes one uses |\localtableofcontents| to prepare something else, and one
+% does not want at any output of text at all even in an intermediate run.
+%
+% Also |1.07g| has |\etocaftertochook| to help with
+% |\invisiblelocaltableofcontents| (and then I did |\etocsetnexttocdepth|).
% \begin{macrocode}
\def\Etoc@localtableofcontents#1{%
\edef\Etoc@tmp{#1}%
\ifnum\Etoc@tmp<\@ne
\PackageWarning{etoc}
{Unknown toc id: run LaTeX to get references right}%
- \leavevmode --unknown etoc ref: run latex again--\par
+%%\leavevmode --unknown etoc ref: run latex again--\par (REMOVED IN 1.07g)
\let\Etoc@next\@gobble\else\let\Etoc@next\@firstofone\fi
\Etoc@next
{\edef\etoc@startlocaltoc##1{%
@@ -4413,7 +5010,9 @@ release.
\global\Etoc@stoptocfalse
\global\Etoc@notactivetrue
\Etoc@tableofcontents}%
- \endgroup\ifEtoc@mustclosegroup\endgroup\fi}
+ \endgroup\ifEtoc@mustclosegroup\endgroup\fi
+ \etocaftertochook % 1.07g
+}
% \end{macrocode}
% |[2013/03/07]|: I discover a \csa{@namedef} trick to construct the
% \csa{Etoc@again} space delimited macro:\\
@@ -4446,42 +5045,46 @@ release.
\global\Etoc@notactivefalse
\Etoc@tableofcontents
\endgroup
- \ifEtoc@mustclosegroup\endgroup\fi}%
+ \ifEtoc@mustclosegroup\endgroup\fi
+ \etocaftertochook % 1.07g
+ }%
\fi
\fi\fi\fi\Etoc@next}
% \end{macrocode}
-% placeholder for comments
+% |1.07g| for consistency Etoc@ prefix added.
% \begin{macrocode}
-\def\table@fcontents{%
+\def\Etoc@table@fcontents{%
\refstepcounter{etoc@tocid}%
\Etoc@tocwithidfalse
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
-\def\localtable@fcontents{%
+\def\Etoc@localtable@fcontents{%
\refstepcounter{etoc@tocid}%
\addtocontents{toc}
{\string\etoc@startlocaltoc{\arabic{etoc@tocid}}}%
\Etoc@tocwithidtrue
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
% \end{macrocode}
-% placeholder for comments
+% |1.07g| defines |\etoctableofcontents| to be able to undo the evil and
+% brutal doings of some packages with |\tableofcontents|.
% \begin{macrocode}
-\newcommand*\etocaftertitlehook{}
-\newcommand*\etocaftercontentshook{}
-\renewcommand*\tableofcontents{%
+\let\etocaftertitlehook \@empty
+\let\etocaftercontentshook \@empty
+\def\etoctableofcontents{%
\Etoc@openouttoc
\Etoc@par
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
\def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}%
\@ifstar
- {\def\Etoc@aftertitlehook{}\table@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
+ {\def\Etoc@aftertitlehook{}\Etoc@table@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}}
+\let\tableofcontents\etoctableofcontents
\newcommand*\localtableofcontents{%
\Etoc@openouttoc
\Etoc@par
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
\@ifstar
- {\def\Etoc@aftertitlehook{}\localtable@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
+ {\def\Etoc@aftertitlehook{}\Etoc@localtable@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@localtable@fcontents}}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -4491,26 +5094,29 @@ release.
\let\Etoc@@next\@firstofone\else
\let\Etoc@@next\@gobble
\fi
-\Etoc@@next{#1\ifEtoc@parskip\parskip\z@skip\fi %1.07d
+\Etoc@@next{\Etoc@storetocdepth % 1.07g
+ #1\ifEtoc@parskip\parskip\z@skip\fi %1.07d
\Etoc@aftertitlehook
\let\Etoc@savedcontentsline\contentsline
\let\contentsline\Etoc@etoccontentsline
\Etoc@toctoc
\let\Etoc@@next\relax
- \ifEtoc@tocwithid\else
+ \ifEtoc@tocwithid\else
\ifEtoc@localtoc
\ifEtoc@notactive
\def\Etoc@@next{\Etoc@localtocfalse
\global\Etoc@notactivefalse
\Etoc@toctoc}%
- \fi\fi\fi
- \Etoc@@next
- \etocaftercontentshook
- #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here
+ \fi\fi
+ \fi
+ \Etoc@@next
+ \Etoc@resettocdepth % 1.07g
+ \etocaftercontentshook
+ #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
+\def\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
\long\def\etoc@setstyle#1#2#3#4#5{%
\long\expandafter\def
\csname Etoc@begin@\csname Etoc@#1@\endcsname\endcsname {#2}%
@@ -4523,54 +5129,53 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocfontminustwo {\normalfont \LARGE \bfseries}
-\newcommand*\etocfontminusone {\normalfont \large \bfseries}
-\newcommand*\etocfontzero {\normalfont \large \bfseries}
-\newcommand*\etocfontone {\normalfont \normalsize \bfseries}
-\newcommand*\etocfonttwo {\normalfont \normalsize}
-\newcommand*\etocfontthree {\normalfont \footnotesize}
+\def\etocfontminustwo {\normalfont \LARGE \bfseries}
+\def\etocfontminusone {\normalfont \large \bfseries}
+\def\etocfontzero {\normalfont \large \bfseries}
+\def\etocfontone {\normalfont \normalsize \bfseries}
+\def\etocfonttwo {\normalfont \normalsize}
+\def\etocfontthree {\normalfont \footnotesize}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocsepminustwo {4ex \@plus .5ex \@minus .5ex}
-\newcommand*\etocsepminusone {4ex \@plus .5ex \@minus .5ex}
-\newcommand*\etocsepzero {2.5ex \@plus .4ex \@minus .4ex}
-\newcommand*\etocsepone {1.5ex \@plus .3ex \@minus .3ex}
+\def\etocsepminustwo {4ex \@plus .5ex \@minus .5ex}
+\def\etocsepminusone {4ex \@plus .5ex \@minus .5ex}
+\def\etocsepzero {2.5ex \@plus .4ex \@minus .4ex}
+\def\etocsepone {1.5ex \@plus .3ex \@minus .3ex}
%%\newcommand*\etocseptwo{1ex \@plus .15ex \@minus .15ex} % modified in 1.07e
-\newcommand*\etocseptwo {.5ex \@plus .1ex \@minus .1ex}
-\newcommand*\etocsepthree {.25ex \@plus .05ex \@minus .05ex}
+\def\etocseptwo {.5ex \@plus .1ex \@minus .1ex}
+\def\etocsepthree {.25ex \@plus .05ex \@minus .05ex}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocbaselinespreadminustwo {1}
-\newcommand*\etocbaselinespreadminusone {1}
-\newcommand*\etocbaselinespreadzero {1}
-\newcommand*\etocbaselinespreadone {1}
-\newcommand*\etocbaselinespreadtwo {1}
-\newcommand*\etocbaselinespreadthree {.9}
+\def\etocbaselinespreadminustwo {1}
+\def\etocbaselinespreadminusone {1}
+\def\etocbaselinespreadzero {1}
+\def\etocbaselinespreadone {1}
+\def\etocbaselinespreadtwo {1}
+\def\etocbaselinespreadthree {.9}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocminustwoleftmargin {1.5em plus 0.5fil}
-\newcommand*\etocminustworightmargin {1.5em plus -0.5fil}
-\newcommand*\etocminusoneleftmargin {1em}
-\newcommand*\etocminusonerightmargin {1em}
-\newcommand*\etoctoclineleaders
+\def\etocminustwoleftmargin {1.5em plus 0.5fil}
+\def\etocminustworightmargin {1.5em plus -0.5fil}
+\def\etocminusoneleftmargin {1em}
+\def\etocminusonerightmargin {1em}
+\def\etoctoclineleaders
{\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}}
-\newcommand*\etocabbrevpagename {p.~}
-\newcommand*\etocpartname {\partname}
-\newcommand*\etocbookname {Book}
+\def\etocabbrevpagename {p.~}
+\def\etocpartname {\partname}
+\def\etocbookname {Book}
% \end{macrocode}
% placeholder for comments
% The macro \csa{etocdefaultlines} was initially called \csa{etoctoclines}. Now
% \csa{etoctoclines} just does \csa{Etoc@standardfalse}.
-% \begin{macrocode}
-\def\etocdefaultlines{\Etoc@standardfalse
-% \end{macrocode}
% Version |1.07e| has rewritten entirely the stuff related to penalties and
% \csa{addvspace}, as this was not satisfactory in the earlier versions, which
-% were written at a early stage in the development of the package.
+% were written at a early stage in the development of the
+% package. Actually I am not fully satisfied with these line styles.
% \begin{macrocode}
+\def\etocdefaultlines{\Etoc@standardfalse %
%% `book' in memoir class:
\etoc@setstyle{@minustwo}
{\addpenalty\@M\etocskipfirstprefix}
@@ -4703,18 +5308,18 @@ release.
% \begin{macrocode}
\etoc@setstyle{@four}{}{}{}{}%
\etoc@setstyle{@five}{}{}{}{}%
-}
+} % end of \etocdefaultlines!
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
-\newcommand*\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
-\newcommand*\etoccolumnsep{2em}
-\newcommand*\etocmulticolsep{0ex}
-\newcommand*\etocmulticolpretolerance{-1}
-\newcommand*\etocmulticoltolerance{200}
-\newcommand*\etocdefaultnbcol{2}
-\newcommand*\etocinnertopsep{2ex}
+\def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
+\def\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
+\def\etoccolumnsep{2em}
+\def\etocmulticolsep{0ex}
+\def\etocmulticolpretolerance{-1}
+\def\etocmulticoltolerance{200}
+\def\etocdefaultnbcol{2}
+\def\etocinnertopsep{2ex}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -4730,8 +5335,6 @@ release.
\setlength{\columnsep}{\etoccolumnsep}%
\setlength{\multicolsep}{\etocmulticolsep}%
\begin{multicols}{#1}[#2\etocoldpar\addvspace{\etocinnertopsep}]}
-% 2013/01/29: erroneous \etocsepminusone at last replaced by \etocinnertopsep
-% and definition of \etocoldpar added as multicols chokes on \par as part of #2
{#2\par\addvspace{\etocinnertopsep}%
\pretolerance\etocmulticolpretolerance
\tolerance\etocmulticoltolerance}}
@@ -4742,17 +5345,17 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocinnerbottomsep{3.5ex}
-\newcommand*\etocinnerleftsep{2em}
-\newcommand*\etocinnerrightsep{2em}
-\newcommand*\etoctoprule{\hrule}
-\newcommand*\etocleftrule{\vrule}
-\newcommand*\etocrightrule{\vrule}
-\newcommand*\etocbottomrule{\hrule}
-\newcommand*\etoctoprulecolorcmd{\relax}
-\newcommand*\etocbottomrulecolorcmd{\relax}
-\newcommand*\etocleftrulecolorcmd{\relax}
-\newcommand*\etocrightrulecolorcmd{\relax}
+\def\etocinnerbottomsep{3.5ex}
+\def\etocinnerleftsep{2em}
+\def\etocinnerrightsep{2em}
+\def\etoctoprule{\hrule}
+\def\etocleftrule{\vrule}
+\def\etocrightrule{\vrule}
+\def\etocbottomrule{\hrule}
+\def\etoctoprulecolorcmd{\relax}
+\def\etocbottomrulecolorcmd{\relax}
+\def\etocleftrulecolorcmd{\relax}
+\def\etocrightrulecolorcmd{\relax}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -4787,8 +5390,8 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand\etocframedmphook{\relax}
-\newcommand*\etocbkgcolorcmd{\relax}
+\long\def\etocframedmphook{\relax}
+\def\etocbkgcolorcmd{\relax}
\def\Etoc@relax{\relax}
\newbox\etoc@framed@titlebox
\newbox\etoc@framed@contentsbox
@@ -5023,7 +5626,7 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand*\etocstandarddisplaystyle{\etocarticlestyle}
+\def\etocstandarddisplaystyle{\etocarticlestyle}
\newcommand*\etocmarkboth[1]{%
\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
\newcommand*\etocmarkbothnouc[1]{\@mkboth{#1}{#1}}
@@ -5085,11 +5688,102 @@ release.
\addcontentsline {toc}{#1}{#2}}
\DeclareRobustCommand*{\etoctoccontentsline}
{\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}}
-\newcommand*\etocstandardlines{\Etoc@standardtrue}
-\newcommand*\etoctoclines{\Etoc@standardfalse} % 1.07b
-\etocdefaultlines % for initialization
+% \end{macrocode}
+% Added for version |1.07g [2013/10/13]|. Motivated by a demand about
+% |tovsec2|. But it is impossible to make |tocvsec2| compatible, if not
+% re-doing all `toc' macros in |tocvsec2| (|v1.3, 2011/08/07|). I do not
+% retain the stack idea, which does not convince me as useful. The empty
+% line in the |.toc| file is put there by |tocvsec2| (see its code line 143).
+%
+% I take this opportunity to add to the toc file
+% |\let\etoc@startlocaltoc\@gobble| in case |etoc| is not detected, I should
+% possibly have done that long ago (like I did in |tableof|).
+%
+%
+% \begin{macrocode}
+\def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth }
+\def\Etoc@resettocdepth {\global\c@tocdepth\c@etoc@tocdepth }
+\def\etocobeytoctocdepth
+ {\def\Etoc@settocdepth {\afterassignment\Etoc@@settocdepth\global\c@tocdepth}}
+\def\Etoc@@settocdepth {\ifnum\c@tocdepth>\c@etoc@tocdepth
+ \global\c@tocdepth\c@etoc@tocdepth\fi }
+\def\etocignoretoctocdepth {\let\Etoc@settocdepth\count@ }
+\def\etocsettocdepth {\futurelet\Etoc@nexttoken\Etoc@set@tocdepth }
+\def\Etoc@set@tocdepth {\ifx\Etoc@nexttoken\bgroup
+ \expandafter\Etoc@set@tocdepth@
+ \else\expandafter\Etoc@set@toctocdepth@
+ \fi }
+\def\Etoc@set@tocdepth@ #1{\@ifundefined {Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsettocdepth\space ignored}}
+ {\global\c@tocdepth\csname Etoc@#1@@\endcsname}%
+}
+\def\Etoc@set@toctocdepth@ #1#{\Etoc@set@toctocdepth@@ }%
+% \end{macrocode}
+% |1.07g| The |\expandafter\protect\csname | is because of |@@minustwo@@| which
+% we don't
+% want to expand to |-\tw@|, because we want alphabetical levels to remain so;
+% and all others are non-expandable. I could have used a |\mathchardef| for
+% |@@minustwo@@|.
+% \begin{macrocode}
+\def\Etoc@set@toctocdepth@@ #1{%
+ \@ifundefined{Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsettocdepth.toc ignored}}
+ {\addtocontents {toc}
+ {\protect\Etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}%
+}
+% \end{macrocode}
+% placeholder for comments.
+% \begin{macrocode}
+\def\Etoc@tocvsec@err #1{\PackageError {etoc}
+ {the command \protect#1\space is incompatible with etoc}
+ {use \protect\etocsettocdepth.toc as replacement (check the manual)}%
+}%
+\AtBeginDocument {%
+ \@ifpackageloaded {tocvsec2}
+ {\def\maxtocdepth #1{\Etoc@tocvsec@err \maxtocdepth }%
+ \def\settocdepth #1{\Etoc@tocvsec@err \settocdepth }%
+ \def\resettocdepth {\@ifstar {\Etoc@tocvsec@err \resettocdepth }%
+ {\Etoc@tocvsec@err \resettocdepth }%
+ }%
+ \def\save@tocdepth #1#2#3{}% % if etoc is added to file previously
+ \let\reset@tocdepth\relax % using tocvsec2
+ \let\remax@tocdepth\relax
+ \let\tableofcontents\etoctableofcontents
+ \PackageWarning {etoc}
+ {package tocvsec2 detected and its modification of^^J
+ \protect\tableofcontents\space reverted. Use
+ \protect\etocsettocdepth.toc as a replacement^^J
+ for the tocvsec2 toc-related commands}}{}%
+}%
+\addtocontents {toc}{\protect\@ifundefined{etocsetstyle}%
+ {\let\protect\Etoc@settocdepth\count@
+ \let\protect\etoc@startlocaltoc\protect\@gobble }{}}%
+% \end{macrocode}
+% |1.07g|
+% \begin{macrocode}
+\def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }%
+\def\invisiblelocaltableofcontents
+ {\etocsetnexttocdepth {-3}\localtableofcontents }%
+\def\etocsetnexttocdepth #1{%
+ \@ifundefined{Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsetnextocdepth\space ignored}}
+ {\edef\etocaftertochook {\global\c@tocdepth\the\c@tocdepth\space
+ \let\noexpand\etocaftertochook\noexpand\@empty }%
+ \global\c@tocdepth\csname Etoc@#1@@\endcsname}%
+}%
+% \end{macrocode}
+% Initializations.
+% \begin{macrocode}
+\def\etocstandardlines {\Etoc@standardtrue}
+\def\etoctoclines {\Etoc@standardfalse}
+\etocdefaultlines
\etocstandardlines
\etocstandarddisplaystyle
+\etocobeytoctocdepth
+\let\etocaftertochook\@empty
\endinput
% \end{macrocode}
% \MakePercentComment
@@ -5109,8 +5803,9 @@ release.
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum{2622}
+\CheckSum{2861}
+\csname check@checksum\endcsname
\Finale
%%
%% End of file `etoc.dtx'.
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins
index 03e47de9e7f..6f3018e1d79 100644
--- a/Master/texmf-dist/source/latex/etoc/etoc.ins
+++ b/Master/texmf-dist/source/latex/etoc/etoc.ins
@@ -1,30 +1,53 @@
-\def\pkgname{etoc}
-\def\pkgdate{2013/03/07}
-\def\pkgversion{v1.07f}
-\def\pkgdescription{Completely customisable TOCs (jfB)}
+\def\pkgname {etoc} \def\pkgdate {2013/10/13} \def\pkgversion {v1.07g}
+\def\pkgdescription {Completely customisable TOCs (jfB)}
+\def\doctimestamp {Time-stamp <13-10-2013 23:44:43 CEST *>}
%%
-%% Package `etoc' by Jean-Francois Burnol
-%% Copyright (C) 2012, 2013 by Jean-Francois Burnol
+%% Package: etoc
+%% Version: 2013/10/13 v1.07g
+%% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
%%
-%% This file `etoc.ins' is provided for compatibility with TeX distributions
-%% expecting to find it for installation of `etoc.sty'.
+%% Run tex on this file to extract etoc.sty and etoc.tex from etoc.dtx
%%
-%% As usual `latex etoc.ins' produces `etoc.sty' from the source `etoc.dtx'
-%% (an already existing etoc.sty in the same repertory will be overwritten)
+%% At least three ways to produce etoc.pdf:
+%% (1) latex etoc.dtx (three times), then dvips, then ps2pdf
+%% (2) pdflatex etoc.dtx (three times)
+%% (3) latex etoc.tex (three times), then dvipdfmx
%%
-%% Move `etoc.sty' to a suitable location:
-%% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty
+%% 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/pdflatex.
%%
-%% The generated auxiliary files may be discarded. See `etoc.dtx' for the
-%% statements of copyright and conditions of distribution or modification.
+%% Installation:
+%% etoc.sty->TDS:tex/latex/etoc/etoc.sty
+%% etoc.dtx->TDS:source/latex/etoc/etoc.dtx
+%% etoc.pdf->TDS:doc/latex/etoc/etoc.pdf
%%
\input docstrip.tex
\askforoverwritefalse
\def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
\string\ProvidesPackage{\pkgname}^^J%
-\space[\pkgdate\space\pkgversion\space\pkgdescription]}
-\generate{\usepreamble\pkgpreamble
-\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
+\space[\pkgdate\space\pkgversion\space\pkgdescription]}%
+\generate{\nopreamble
+\file{\pkgname.tex}{\from{\pkgname.dtx}{driver}}%
+\usepreamble\pkgpreamble
+\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}%
+\catcode32=13\relax% active space
+\let =\space%
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* etoc.sty}
+\Msg{*}
+\Msg{* To produce the documentation run latex thrice on file etoc.tex}
+\Msg{* and then run dvipdfmx on file etoc.dvi}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
\endbatchfile
\endinput
%%
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty
index 6296a45dde2..a84b3be14fc 100644
--- a/Master/texmf-dist/tex/latex/etoc/etoc.sty
+++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty
@@ -22,19 +22,19 @@
%% in the same archive or directory.)
%%
\ProvidesPackage{etoc}
- [2013/03/07 v1.07f Completely customisable TOCs (jfB)]
+ [2013/10/13 v1.07g Completely customisable TOCs (jfB)]
%%
-%% Package `etoc' by Jean-Francois Burnol
-%% Copyright (C) 2012, 2013 by Jean-Francois Burnol
+%% Package: etoc
+%% Version: 2013/10/13 v1.07g
+%% Copyright (C) 2012-2013 by Jean-Francois Burnol <jfbu at free dot fr>
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{multicol}
-%% \RequirePackage{xspace} %% REMOVED (1.07b)
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
\newtoks\Etoc@toctoks
\def\Etoc@par{\par}
-\newcommand*{\etocinline}{\def\Etoc@par{}}
+\def\etocinline{\def\Etoc@par{}}
\let\etocnopar\etocinline
\newif\ifEtoc@jj % book
\newif\ifEtoc@j % part
@@ -56,13 +56,14 @@
\newif\ifEtoc@notactive
\newcounter{etoc@tocid}
\newif\ifEtoc@mustclosegroup
-\def\etoc@{\etoc@} % Delimiter in \Etoc@getnb etc.. macros. This def added 1.07f
+\def\etoc@{\etoc@}
+\newcounter{etoc@tocdepth}% 1.07g
\@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}}
\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m@ne
-\chardef\Etoc@@zero@@ 0
-\let\Etoc@@one@@ \@ne
-\let\Etoc@@two@@ \tw@
+\let\Etoc@@zero@@ \z@
+\let\Etoc@@one@@ \@ne
+\let\Etoc@@two@@ \tw@
\let\Etoc@@three@@ \thr@@
\chardef\Etoc@@four@@ 4
\chardef\Etoc@@five@@ 5
@@ -76,6 +77,18 @@
\def\Etoc@@three@{three}
\def\Etoc@@four@{four}
\def\Etoc@@five@{five}
+\expandafter\def\csname Etoc@-3@@\endcsname {-\thr@@}
+\expandafter\let\csname Etoc@-2@@\endcsname \Etoc@@minustwo@@
+\expandafter\let\csname Etoc@-1@@\endcsname \Etoc@@minusone@@
+\expandafter\let\csname Etoc@0@@\endcsname \Etoc@@zero@@
+\expandafter\let\csname Etoc@1@@\endcsname \Etoc@@one@@
+\expandafter\let\csname Etoc@2@@\endcsname \Etoc@@two@@
+\expandafter\let\csname Etoc@3@@\endcsname \Etoc@@three@@
+\expandafter\let\csname Etoc@4@@\endcsname \Etoc@@four@@
+\expandafter\let\csname Etoc@5@@\endcsname \Etoc@@five@@
+\expandafter\let\csname Etoc@6@@\endcsname \Etoc@@six@@
+\let\Etoc@all@@ \Etoc@@five@@
+\let\Etoc@none@@ \Etoc@minf
\def\Etoc@levellist{}
\def\Etoc@newlevel#1{%
\def\Etoc@levellist@elt{\noexpand\Etoc@levellist@elt\noexpand}%
@@ -111,11 +124,15 @@
\expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@minustwo@@
\expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@
\else
+ \ifnum#2=-\thr@@
+ \expandafter\let \csname Etoc@#1@@\expandafter\endcsname
+ \csname Etoc@-3@@\endcsname
+ \else
\PackageWarning{etoc}
{unexpected value `#2' in \string\etocsetlevel.^^J%
Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}%
\expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@
-\fi\fi\fi}
+\fi\fi\fi\fi}
\etocsetlevel{book}{-2}
\etocsetlevel{part}{-1}
\etocsetlevel{chapter}{0}
@@ -410,13 +427,13 @@
}%
\Etoc@getnbr #4\hspace\relax\etoc@
}
-\newcommand*\etocthename {}
-\newcommand*\etocthenumber {}
-\newcommand*\etocthepage {}
-\newcommand*\etocthelinkedname {}
-\newcommand*\etocthelinkednumber {}
-\newcommand*\etocthelinkedpage {}
-\newcommand*\etocthelink {}
+\let\etocthename \@empty
+\let\etocthenumber \@empty
+\let\etocthepage \@empty
+\let\etocthelinkedname \@empty
+\let\etocthelinkednumber \@empty
+\let\etocthelinkedpage \@empty
+\let\etocthelink \@empty
\DeclareRobustCommand*{\etocname} {}
\DeclareRobustCommand*{\etocnumber}{}
\DeclareRobustCommand*{\etocpage} {}
@@ -443,8 +460,7 @@
\Etoc@readtoc\Etoc@tf
\closein\Etoc@tf}}
{\typeout{No file \jobname .toc.}}
-\def\Etoc@openouttoc{% formerly \Etoc@starttoc
-%% 1.07d: parskip and \@nobreakfalse stuff moved to \Etoc@tableofcontents
+\def\Etoc@openouttoc{%
\ifEtoc@hyperref
\ifx\hyper@last\@undefined
\IfFileExists{\jobname .toc}
@@ -459,7 +475,7 @@
\newwrite \tf@toc
\immediate \openout \tf@toc \jobname .toc\relax
\fi
- \gdef\Etoc@openouttoc{}% 1.07d, rather than using a boolean
+ \gdef\Etoc@openouttoc{}%
}
\def\Etoc@toctoc{%
\global\Etoc@vfalse
@@ -528,7 +544,7 @@
\ifnum\Etoc@tmp<\@ne
\PackageWarning{etoc}
{Unknown toc id: run LaTeX to get references right}%
- \leavevmode --unknown etoc ref: run latex again--\par
+%%\leavevmode --unknown etoc ref: run latex again--\par (REMOVED IN 1.07g)
\let\Etoc@next\@gobble\else\let\Etoc@next\@firstofone\fi
\Etoc@next
{\edef\etoc@startlocaltoc##1{%
@@ -538,7 +554,9 @@
\global\Etoc@stoptocfalse
\global\Etoc@notactivetrue
\Etoc@tableofcontents}%
- \endgroup\ifEtoc@mustclosegroup\endgroup\fi}
+ \endgroup\ifEtoc@mustclosegroup\endgroup\fi
+ \etocaftertochook % 1.07g
+}
\def\Etoc@getrefno #1#2\etoc@ {#1}
\def\Etoc@getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter
\Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}}
@@ -560,59 +578,65 @@
\global\Etoc@notactivefalse
\Etoc@tableofcontents
\endgroup
- \ifEtoc@mustclosegroup\endgroup\fi}%
+ \ifEtoc@mustclosegroup\endgroup\fi
+ \etocaftertochook % 1.07g
+ }%
\fi
\fi\fi\fi\Etoc@next}
-\def\table@fcontents{%
+\def\Etoc@table@fcontents{%
\refstepcounter{etoc@tocid}%
\Etoc@tocwithidfalse
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
-\def\localtable@fcontents{%
+\def\Etoc@localtable@fcontents{%
\refstepcounter{etoc@tocid}%
\addtocontents{toc}
{\string\etoc@startlocaltoc{\arabic{etoc@tocid}}}%
\Etoc@tocwithidtrue
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
-\newcommand*\etocaftertitlehook{}
-\newcommand*\etocaftercontentshook{}
-\renewcommand*\tableofcontents{%
+\let\etocaftertitlehook \@empty
+\let\etocaftercontentshook \@empty
+\def\etoctableofcontents{%
\Etoc@openouttoc
\Etoc@par
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
\def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}%
\@ifstar
- {\def\Etoc@aftertitlehook{}\table@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
+ {\def\Etoc@aftertitlehook{}\Etoc@table@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}}
+\let\tableofcontents\etoctableofcontents
\newcommand*\localtableofcontents{%
\Etoc@openouttoc
\Etoc@par
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
\@ifstar
- {\def\Etoc@aftertitlehook{}\localtable@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
+ {\def\Etoc@aftertitlehook{}\Etoc@localtable@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@localtable@fcontents}}
\newcommand\etocsettocstyle[2]{%
\def\Etoc@tableofcontents
{\ifnum\c@tocdepth>\Etoc@minf
\let\Etoc@@next\@firstofone\else
\let\Etoc@@next\@gobble
\fi
-\Etoc@@next{#1\ifEtoc@parskip\parskip\z@skip\fi %1.07d
+\Etoc@@next{\Etoc@storetocdepth % 1.07g
+ #1\ifEtoc@parskip\parskip\z@skip\fi %1.07d
\Etoc@aftertitlehook
\let\Etoc@savedcontentsline\contentsline
\let\contentsline\Etoc@etoccontentsline
\Etoc@toctoc
\let\Etoc@@next\relax
- \ifEtoc@tocwithid\else
+ \ifEtoc@tocwithid\else
\ifEtoc@localtoc
\ifEtoc@notactive
\def\Etoc@@next{\Etoc@localtocfalse
\global\Etoc@notactivefalse
\Etoc@toctoc}%
- \fi\fi\fi
- \Etoc@@next
- \etocaftercontentshook
- #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here
-\newcommand*\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
+ \fi\fi
+ \fi
+ \Etoc@@next
+ \Etoc@resettocdepth % 1.07g
+ \etocaftercontentshook
+ #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here
+\def\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
\long\def\etoc@setstyle#1#2#3#4#5{%
\long\expandafter\def
\csname Etoc@begin@\csname Etoc@#1@\endcsname\endcsname {#2}%
@@ -622,35 +646,35 @@
\csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname {#4}%
\long\expandafter\def
\csname Etoc@end@\csname Etoc@#1@\endcsname\endcsname {#5}}
-\newcommand*\etocfontminustwo {\normalfont \LARGE \bfseries}
-\newcommand*\etocfontminusone {\normalfont \large \bfseries}
-\newcommand*\etocfontzero {\normalfont \large \bfseries}
-\newcommand*\etocfontone {\normalfont \normalsize \bfseries}
-\newcommand*\etocfonttwo {\normalfont \normalsize}
-\newcommand*\etocfontthree {\normalfont \footnotesize}
-\newcommand*\etocsepminustwo {4ex \@plus .5ex \@minus .5ex}
-\newcommand*\etocsepminusone {4ex \@plus .5ex \@minus .5ex}
-\newcommand*\etocsepzero {2.5ex \@plus .4ex \@minus .4ex}
-\newcommand*\etocsepone {1.5ex \@plus .3ex \@minus .3ex}
+\def\etocfontminustwo {\normalfont \LARGE \bfseries}
+\def\etocfontminusone {\normalfont \large \bfseries}
+\def\etocfontzero {\normalfont \large \bfseries}
+\def\etocfontone {\normalfont \normalsize \bfseries}
+\def\etocfonttwo {\normalfont \normalsize}
+\def\etocfontthree {\normalfont \footnotesize}
+\def\etocsepminustwo {4ex \@plus .5ex \@minus .5ex}
+\def\etocsepminusone {4ex \@plus .5ex \@minus .5ex}
+\def\etocsepzero {2.5ex \@plus .4ex \@minus .4ex}
+\def\etocsepone {1.5ex \@plus .3ex \@minus .3ex}
%%\newcommand*\etocseptwo{1ex \@plus .15ex \@minus .15ex} % modified in 1.07e
-\newcommand*\etocseptwo {.5ex \@plus .1ex \@minus .1ex}
-\newcommand*\etocsepthree {.25ex \@plus .05ex \@minus .05ex}
-\newcommand*\etocbaselinespreadminustwo {1}
-\newcommand*\etocbaselinespreadminusone {1}
-\newcommand*\etocbaselinespreadzero {1}
-\newcommand*\etocbaselinespreadone {1}
-\newcommand*\etocbaselinespreadtwo {1}
-\newcommand*\etocbaselinespreadthree {.9}
-\newcommand*\etocminustwoleftmargin {1.5em plus 0.5fil}
-\newcommand*\etocminustworightmargin {1.5em plus -0.5fil}
-\newcommand*\etocminusoneleftmargin {1em}
-\newcommand*\etocminusonerightmargin {1em}
-\newcommand*\etoctoclineleaders
+\def\etocseptwo {.5ex \@plus .1ex \@minus .1ex}
+\def\etocsepthree {.25ex \@plus .05ex \@minus .05ex}
+\def\etocbaselinespreadminustwo {1}
+\def\etocbaselinespreadminusone {1}
+\def\etocbaselinespreadzero {1}
+\def\etocbaselinespreadone {1}
+\def\etocbaselinespreadtwo {1}
+\def\etocbaselinespreadthree {.9}
+\def\etocminustwoleftmargin {1.5em plus 0.5fil}
+\def\etocminustworightmargin {1.5em plus -0.5fil}
+\def\etocminusoneleftmargin {1em}
+\def\etocminusonerightmargin {1em}
+\def\etoctoclineleaders
{\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}}
-\newcommand*\etocabbrevpagename {p.~}
-\newcommand*\etocpartname {\partname}
-\newcommand*\etocbookname {Book}
-\def\etocdefaultlines{\Etoc@standardfalse
+\def\etocabbrevpagename {p.~}
+\def\etocpartname {\partname}
+\def\etocbookname {Book}
+\def\etocdefaultlines{\Etoc@standardfalse %
%% `book' in memoir class:
\etoc@setstyle{@minustwo}
{\addpenalty\@M\etocskipfirstprefix}
@@ -780,15 +804,15 @@
\addpenalty{-\@highpenalty}}%
\etoc@setstyle{@four}{}{}{}{}%
\etoc@setstyle{@five}{}{}{}{}%
-}
-\newcommand*\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
-\newcommand*\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
-\newcommand*\etoccolumnsep{2em}
-\newcommand*\etocmulticolsep{0ex}
-\newcommand*\etocmulticolpretolerance{-1}
-\newcommand*\etocmulticoltolerance{200}
-\newcommand*\etocdefaultnbcol{2}
-\newcommand*\etocinnertopsep{2ex}
+} % end of \etocdefaultlines!
+\def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
+\def\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
+\def\etoccolumnsep{2em}
+\def\etocmulticolsep{0ex}
+\def\etocmulticolpretolerance{-1}
+\def\etocmulticoltolerance{200}
+\def\etocdefaultnbcol{2}
+\def\etocinnertopsep{2ex}
\newcommand\etocmulticolstyle[2][\etocdefaultnbcol]{%
\etocsettocstyle
{\let\etocoldpar\par
@@ -808,17 +832,17 @@
\else \let\Etoc@next\@gobble\fi
\Etoc@next{\end{multicols}}%
\addvspace{\etocbelowtocskip}}}
-\newcommand*\etocinnerbottomsep{3.5ex}
-\newcommand*\etocinnerleftsep{2em}
-\newcommand*\etocinnerrightsep{2em}
-\newcommand*\etoctoprule{\hrule}
-\newcommand*\etocleftrule{\vrule}
-\newcommand*\etocrightrule{\vrule}
-\newcommand*\etocbottomrule{\hrule}
-\newcommand*\etoctoprulecolorcmd{\relax}
-\newcommand*\etocbottomrulecolorcmd{\relax}
-\newcommand*\etocleftrulecolorcmd{\relax}
-\newcommand*\etocrightrulecolorcmd{\relax}
+\def\etocinnerbottomsep{3.5ex}
+\def\etocinnerleftsep{2em}
+\def\etocinnerrightsep{2em}
+\def\etoctoprule{\hrule}
+\def\etocleftrule{\vrule}
+\def\etocrightrule{\vrule}
+\def\etocbottomrule{\hrule}
+\def\etoctoprulecolorcmd{\relax}
+\def\etocbottomrulecolorcmd{\relax}
+\def\etocleftrulecolorcmd{\relax}
+\def\etocrightrulecolorcmd{\relax}
\def\etoc@ruledheading #1{%
\hb@xt@\linewidth{\color@begingroup
\hss #1\hss\hskip-\linewidth
@@ -844,8 +868,8 @@
\else \let\Etoc@next\@gobble\fi
\Etoc@next{\end{multicols}}%
\addvspace{\etocbelowtocskip}}}
-\newcommand\etocframedmphook{\relax}
-\newcommand*\etocbkgcolorcmd{\relax}
+\long\def\etocframedmphook{\relax}
+\def\etocbkgcolorcmd{\relax}
\def\Etoc@relax{\relax}
\newbox\etoc@framed@titlebox
\newbox\etoc@framed@contentsbox
@@ -1056,7 +1080,7 @@
\csname tocbasic@@after@hook\endcsname}}
\let\etocscrbookstyle\etocscrartclstyle
\let\etocscrreprtstyle\etocscrartclstyle
-\newcommand*\etocstandarddisplaystyle{\etocarticlestyle}
+\def\etocstandarddisplaystyle{\etocarticlestyle}
\newcommand*\etocmarkboth[1]{%
\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
\newcommand*\etocmarkbothnouc[1]{\@mkboth{#1}{#1}}
@@ -1112,11 +1136,73 @@
\addcontentsline {toc}{#1}{#2}}
\DeclareRobustCommand*{\etoctoccontentsline}
{\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}}
-\newcommand*\etocstandardlines{\Etoc@standardtrue}
-\newcommand*\etoctoclines{\Etoc@standardfalse} % 1.07b
-\etocdefaultlines % for initialization
+\def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth }
+\def\Etoc@resettocdepth {\global\c@tocdepth\c@etoc@tocdepth }
+\def\etocobeytoctocdepth
+ {\def\Etoc@settocdepth {\afterassignment\Etoc@@settocdepth\global\c@tocdepth}}
+\def\Etoc@@settocdepth {\ifnum\c@tocdepth>\c@etoc@tocdepth
+ \global\c@tocdepth\c@etoc@tocdepth\fi }
+\def\etocignoretoctocdepth {\let\Etoc@settocdepth\count@ }
+\def\etocsettocdepth {\futurelet\Etoc@nexttoken\Etoc@set@tocdepth }
+\def\Etoc@set@tocdepth {\ifx\Etoc@nexttoken\bgroup
+ \expandafter\Etoc@set@tocdepth@
+ \else\expandafter\Etoc@set@toctocdepth@
+ \fi }
+\def\Etoc@set@tocdepth@ #1{\@ifundefined {Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsettocdepth\space ignored}}
+ {\global\c@tocdepth\csname Etoc@#1@@\endcsname}%
+}
+\def\Etoc@set@toctocdepth@ #1#{\Etoc@set@toctocdepth@@ }%
+\def\Etoc@set@toctocdepth@@ #1{%
+ \@ifundefined{Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsettocdepth.toc ignored}}
+ {\addtocontents {toc}
+ {\protect\Etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}%
+}
+\def\Etoc@tocvsec@err #1{\PackageError {etoc}
+ {the command \protect#1\space is incompatible with etoc}
+ {use \protect\etocsettocdepth.toc as replacement (check the manual)}%
+}%
+\AtBeginDocument {%
+ \@ifpackageloaded {tocvsec2}
+ {\def\maxtocdepth #1{\Etoc@tocvsec@err \maxtocdepth }%
+ \def\settocdepth #1{\Etoc@tocvsec@err \settocdepth }%
+ \def\resettocdepth {\@ifstar {\Etoc@tocvsec@err \resettocdepth }%
+ {\Etoc@tocvsec@err \resettocdepth }%
+ }%
+ \def\save@tocdepth #1#2#3{}% % if etoc is added to file previously
+ \let\reset@tocdepth\relax % using tocvsec2
+ \let\remax@tocdepth\relax
+ \let\tableofcontents\etoctableofcontents
+ \PackageWarning {etoc}
+ {package tocvsec2 detected and its modification of^^J
+ \protect\tableofcontents\space reverted. Use
+ \protect\etocsettocdepth.toc as a replacement^^J
+ for the tocvsec2 toc-related commands}}{}%
+}%
+\addtocontents {toc}{\protect\@ifundefined{etocsetstyle}%
+ {\let\protect\Etoc@settocdepth\count@
+ \let\protect\etoc@startlocaltoc\protect\@gobble }{}}%
+\def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }%
+\def\invisiblelocaltableofcontents
+ {\etocsetnexttocdepth {-3}\localtableofcontents }%
+\def\etocsetnexttocdepth #1{%
+ \@ifundefined{Etoc@#1@@}
+ {\PackageWarning{etoc}
+ {Unknown sectioning unit #1, \protect\etocsetnextocdepth\space ignored}}
+ {\edef\etocaftertochook {\global\c@tocdepth\the\c@tocdepth\space
+ \let\noexpand\etocaftertochook\noexpand\@empty }%
+ \global\c@tocdepth\csname Etoc@#1@@\endcsname}%
+}%
+\def\etocstandardlines {\Etoc@standardtrue}
+\def\etoctoclines {\Etoc@standardfalse}
+\etocdefaultlines
\etocstandardlines
\etocstandarddisplaystyle
+\etocobeytoctocdepth
+\let\etocaftertochook\@empty
\endinput
%%
%% End of file `etoc.sty'.