summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/etoc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-12-10 01:31:54 +0000
committerKarl Berry <karl@freefriends.org>2012-12-10 01:31:54 +0000
commit7565eef64053e06881b3bc55e1a20bc7af0b15bb (patch)
treed526b457cd2e04d23a31b86528f375390d11896f /Master/texmf-dist/source/latex/etoc
parenteb3f5f9a64a4553a16273f9ff5cfe99d10f27dd8 (diff)
etoc
git-svn-id: svn://tug.org/texlive/trunk@28483 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/etoc')
-rw-r--r--Master/texmf-dist/source/latex/etoc/etoc.dtx537
-rw-r--r--Master/texmf-dist/source/latex/etoc/etoc.ins20
2 files changed, 285 insertions, 272 deletions
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx
index 353d832f5dc..a561cf81640 100644
--- a/Master/texmf-dist/source/latex/etoc/etoc.dtx
+++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx
@@ -1,15 +1,17 @@
% -*- coding: iso-latin-1; -*-
-%% Package `etoc' by Jean-Francois Burnol
-%% Copyright (C) 2012 by Jean-Francois Burnol
%<*ins>
+\def\lasttimestamp{Time-stamp: <07-12-2012 20:15:47 CET jfb>}
\def\pkgname{etoc}
-\def\pkgdate{2012/12/01}
-\def\pkgversion{v1.05}
+\def\pkgdate{2012/12/07}
+\def\pkgversion{v1.06}
\def\pkgdescription{easily customizable TOCs (jfB)}
%</ins>
+%%
+%% Package `etoc' by Jean-Francois Burnol
+%% Copyright (C) 2012 by Jean-Francois Burnol
+%%
%<*none>
-\def\lasttimestamp{Time-stamp: <01-12-2012 13:48:11 CET jfb>}
-\def\docdate{2012/12/01}
+\def\docdate{2012/12/07}
\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4}
\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp}
\ProvidesFile{\pkgname.dtx}
@@ -57,18 +59,19 @@
%</none>
%<*ins>
%-------------------------------------------------------------------------------
-%%
%% This file `etoc.ins' is provided for compatibility with TeX distributions
%% expecting to find it for installation of `etoc.sty'.
%%
-%% As usual `latex etoc.ins' produces `etoc.sty' from the source `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)
%%
-%% Put the `etoc.sty' file in a suitable location within the TeX installation:
-%% etoc.sty -> ................/tex/latex/etoc/
+%% Put the `etoc.sty' file in a suitable location within the TeX
+%% installation: etoc.sty -> ................/tex/latex/etoc/
%%
-%% The generated auxiliary files may be discarded. See `etoc.dtx' for the
-%% statements of copyright and conditions of distribution or modification.
+%% The generated auxiliary files may be discarded.
+%%
+%% See `etoc.dtx' for the statements of copyright and conditions of
+%% distribution or modification.
%%
\input docstrip.tex
\askforoverwritefalse
@@ -94,6 +97,7 @@
\usepackage{enumitem}
\usepackage{color}
\usepackage{xcolor}
+
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\definecolor{BLUE}{RGB}{0,0,255}
@@ -141,8 +145,7 @@ pdfpagemode=UseOutlines}
\usepackage{etoc}
\newcommand\etoc{%
-\texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}\xspace}
-{\textbackslash etoc\xspace}}
+\texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}}{etoc}\xspace}
\hyphenation{toc-depth sec-num-depth etoc-framed-style etoc-ruled-style}
\hyphenation{etoc-toc-style-with-marks etoc-ruled etoc-framed}
@@ -378,13 +381,12 @@ to the look of a document, at least for the |article|, |book|,
classes.
After declaring a document division name to \etoc with
-\cs{etocsetlevel}, and if the document class does things in a
-manner analogous as the standard classes, then the
-\cs{etocstandardlines} compatibility switch should be
-functional. But at any rate the \etoc default line styles and
-the ones defined via \cs{etocsetstyle} will work. Except that
-maybe \etoc will fail to separate the number from the
-name.
+\cs{etocsetlevel}, the \cs{etocstandardlines} compatibility switch
+should be functional under the condition that the document class does
+things in a manner analogous to the standard classes. But at any rate
+the \etoc default line styles and the ones defined via \cs{etocsetstyle}
+will work. Except that maybe \etoc will fail to separate the number from
+the name.
\section{Arbitrarily many TOCs, and local ones too}
@@ -456,7 +458,7 @@ obeyed. As an example here is the table of contents of Part
\renewcommand{\etocbkgcolorcmd}{\color{green!5}}
\fboxsep1ex
-\etocframed*[1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone I am from
+\etocframed[1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone I am from
\hyperref[toc:c]{far away}}}}
\label{toc:d}
\ref{toc:c}
@@ -474,12 +476,11 @@ TOC with id 2 at the beginning of this part.} 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}|. The
-reason is that the doubly cloned TOC has no way of knowing that
-it is a clone of a clone, and what `local' means will
-erroneously be construed as being decided by the location of
-the first clone, not the original. So to clone again, one
-should use the original: \toc|\ref{toc:c}|.
+However one should not use elsewhere \toc|\ref{toc:d}|. Due to the way
+\etoc implements the cloning,\footnote{The double cloning had a
+ different (but also wrong) effect in |v1.05| compared to |v1.06|.}
+ 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}|.
The \cs{label} command should follow \toc before the reference via
\cs{ref} to the other TOC. Indeed a \cs{label} following it is
@@ -497,24 +498,22 @@ line in the source file starting with the first
\vspace{-.25cm}
\begin{verbatim}
-\setcounter{tocdepth}{-2}
+\setcounter{tocdepth}{-3}
\localtableofcontents \label{toc:partone}
-\setcounter{tocdepth}{2}
\end{verbatim}
-The |tocdepth| being set to -2, nothing at all was inserted in the
-page (for the same effect one must use -3 in the |memoir|
-class; and -3 works in all classes) but
-now that it has been reset to 2, we can display the TOC with
-the simple command:
+The |tocdepth| being set to -3, nothing at all was inserted in the page
+(\etoc
+cancels printing even the heading of the TOC if the |tocdepth| is -2 or
+less, except for the |memoir| class for which it needs to be -3 or less).
+We can then display the TOC with:
\begin{verbatim}
+\setcounter{tocdepth}{3}
+\subsection{Local table of contents for this part}
\tableofcontents \ref{toc:partone}
\end{verbatim}
\subsection{Local table of contents for this part}
-This sub-section heading was manually added to the
-document source, it is not part of the TOC style.
-
\setcounter{tocdepth}{3}
\begingroup
@@ -538,26 +537,28 @@ document source, it is not part of the TOC style.
\renewcommand{\etocinnerleftsep}{0pt}
\renewcommand{\etocinnerrightsep}{0pt}
-\newcommand\shiftedwhiterule[1]{%
-\hbox to \linewidth{\color{white}%
-\hskip\leftskip\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#1}
+\newcommand\shiftedwhiterule[2]{%
+ \hbox to \linewidth{\color{white}%
+ \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
+\vskip#2}
-\etocsetstyle{subsubsection}{}
-{\shiftedwhiterule{6pt}}
+\etocsetstyle{subsubsection}{\etocskipfirstprefix}
+{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
-\leftskip2.25cm\noindent
+\leftskip2.3cm\hangindent1cm\rightskip.5cm\noindent
\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
\nointerlineskip\vskip3pt}
{}
\etocsetstyle{subsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{6pt}}
+{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
-\leftskip1.5cm\noindent
+\leftskip1.5cm\hangindent.8cm\rightskip.5cm\noindent
\hbox to .75cm{\color{subsecnum}\etocnumber\hss}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par
\nointerlineskip\vskip3pt}
{}
@@ -575,7 +576,8 @@ document source, it is not part of the TOC style.
{\hfil \bfseries\large Contents of Part One\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{blue}{\kern1cm\hbox to .5cm{\etocnumber\hss}%
- \etocname\hfill\hbox{\etocpage\hskip.2cm}}%
+ \etocname\hfill
+{\hbox to .5cm{\hss\etocpage\hskip.1cm}}}%
\vskip6pt}
{}
@@ -593,7 +595,7 @@ frame borders have been set to have the same color as the one
which serves as background for the entire thing. This design
(with other colors) is in use also for
\hyperref[toc:clone]{\color{green!35!blue!75}this other toc},
-and the coding used has been included in its subsection.
+and the coding used is to be found at its location.
\part{Package commands for line styles}
@@ -601,15 +603,22 @@ and the coding used has been included in its subsection.
\setcounter{tocdepth}{3}
\etocsetstyle{section}
-{\begin{enumerate}[leftmargin=0pt,label=]}
+{\begin{enumerate}[leftmargin=.75cm, label=\etocifnumbered
+ {{\fboxrule1pt\fcolorbox{green}{white}{\etocnumber}}}{}]}
+% Dec 7, 2012. I hit upon a problem whose origin I found was
+% with xcolor, as xcolor modifies \fbox
+% (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
+% and there is no problem anymore. Also I don't have now to
+% use \normalcolor which already needed protection.
{\normalsize\bfseries\rmfamily\item}
-{\etocifnumbered{\makebox[1cm][c]{\color{green}\fboxrule1pt
- \fbox{\protect\normalcolor\etocnumber}}}{\hspace{1cm}}
-\etocname (page \etocpage)}
+{\etocname (page \etocpage)}
{\end{enumerate}}
\etocsetstyle{subsection}
-{\begin{enumerate}[label=\etocnumber, leftmargin=1cm]}
+{\begin{enumerate}[leftmargin=0cm, label=\etocnumber]}
{\normalfont \item}
{\etocname (p.~\etocpage)}
{\end{enumerate}}
@@ -624,7 +633,6 @@ and the coding used has been included in its subsection.
\fboxrule1pt\fboxsep1ex
\framebox[\linewidth]
{\normalcolor\hss Contents of this second part\hss}}
-
\localtableofcontents \label{toc:a}
\section{The \csbhyp{etocsetstyle} command}
@@ -651,7 +659,6 @@ obtained in the following manner:%
\begingroup\small
\begin{verbatim}
\setcounter{tocdepth}{3}
-
\etocsetstyle{section}
{\begin{enumerate}}
{\normalsize\bfseries\rmfamily\item}
@@ -727,14 +734,12 @@ This is also the situation with the default package line styles!
\subsubsection{secnum\-depth and tocdepth}
-The \LaTeX{} counter |secnumdepth|
-decides which levels are numbered and
-automatically written to the |.toc| file. Its functioning
-is completely independent from the \etoc package. The counter
-|tocdepth|
-decides the finest level displayed in the table of contents: its
-local value is obeyed by \etoc, and as \toc can now be used arbitrarily
-times, this is an important customization lever.
+The \LaTeX{} counter |secnumdepth| decides down to which level division
+headings are numbered. Numbered or not they are (at least in the standard
+classes) written to the |.toc| file. The counter |tocdepth| decides then the
+finest level which will be displayed in the table of contents: its local
+value is obeyed by \etoc, and as the \toc command and its variants may now
+be used multiple times, this is an important customization lever.
\subsection{The \csbhyp{etocsetlevel} command}
@@ -784,31 +789,27 @@ Rather than just \cs{etocnumber} we then used something like
\subsubsection{The \csbhyp{etocifnumbered} switch}
-The \cs{fbox} would give an unaesthetic result in the case of an unnumbered
-section (which ended up in the table of contents via an \cs{addcontentsline}
-command).
-
-The \cs{etocifnumbered}\marg{A}\marg{B} command executes \meta{A} if
-the number exists, and \meta{B} if not. So our final code could be:
+The \cs{fbox} would give an unaesthetic result in the case of
+an unnumbered section (which ended up in the table of
+contents via an \cs{addcontentsline} command).\footnote{as
+ seen below we use \cs{fcolorbox} rather than \cs{fbox}. Due
+ to some redefinition made by package |xcolor|, had we used
+ \cs{fbox} (and not used |hyperref|) we would have needed
+ \cs{protect}\cs{fbox}.}
+
+The \cs{etocifnumbered}\marg{A}\marg{B} command executes
+\meta{A} if the number exists, and \meta{B} if not. So we use
+it in the code which was finally chosen for the |section| level:
\begin{verbatim}
\etocsetstyle{section}
-{\begin{enumerate}[label=\etocifnumbered{\etocnumber}{}]}
+{\begin{enumerate}[leftmargin=.75cm, label=\etocifnumbered
+ {{\fboxrule1pt\fcolorbox{green}{white}{\etocnumber}}}{}]}
{\normalsize\bfseries\rmfamily\item}
{\etocname (page \etocpage)}
{\end{enumerate}}
-\end{verbatim}
-We used, actually:
-\begin{verbatim}
-\etocsetstyle{section}
-{\begin{enumerate}[leftmargin=0pt,label=]}
-{\normalsize\bfseries\rmfamily\item}
-{\etocifnumbered{\makebox[1cm][c]{\color{green}\fboxrule1pt
- \fbox{\protect\normalcolor\etocnumber}}{\hspace{1cm}}
-\etocname (page \etocpage)}
-{\end{enumerate}}
\etocsetstyle{subsection}
-{\begin{enumerate}[label=\etocnumber, leftmargin=1cm]}
+{\begin{enumerate}[leftmargin=0cm, label=\etocnumber]}
{\normalfont \item}
{\etocname (p.~\etocpage)}
{\end{enumerate}}
@@ -832,8 +833,6 @@ The package predefines for use in its default line styles:
\newcommand\etocfontone{\normalfont \normalsize \bfseries}
\newcommand\etocfonttwo{\normalfont \normalsize}
\newcommand\etocfontthree{\normalfont \footnotesize}
-\newcommand\etocfontfour{\normalfont \footnotesize}
-\newcommand\etocfontfive{\normalfont \footnotesize}
\end{verbatim}
The same font is used for
the name, number, and page number, at each level (up to subsubsection).
@@ -994,11 +993,11 @@ We then switch to our set-up from the previous part and add to it:
\label{part:globalcmds}
\begin{verbatim}
-\setcounter{tocdepth}{-2}
+\setcounter{tocdepth}{-3}
\localtableofcontents \label{toc:globalcmds}
\end{verbatim}
-\setcounter{tocdepth}{-2}
+\setcounter{tocdepth}{-3}
\localtableofcontents \label{toc:globalcmds}
\setcounter{tocdepth}{3}
@@ -1382,7 +1381,7 @@ re-displaying another toc, only its contents are transferred:
both the line styles and the global style are the ones
currently defined, not the ones from the cloned toc.
-\subsection{An example design}
+\subsection{An example}
I got motivated by a
@@ -1421,32 +1420,34 @@ the frame.
\renewcommand{\etocinnerleftsep}{0pt}
\renewcommand{\etocinnerrightsep}{0pt}
-\newcommand\shiftedwhiterule[1]{%
-\hbox to \linewidth{\color{white}%
-\hskip\leftskip\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#1}
+\newcommand\shiftedwhiterule[2]{%
+ \hbox to \linewidth{\color{white}%
+ \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
+\vskip#2}
-\etocsetstyle{subsubsection}{}
-{\shiftedwhiterule{6pt}}
+\etocsetstyle{subsubsection}{\etocskipfirstprefix}
+{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
-\leftskip2.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hskip.2cm}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
+\leftskip2.5cm\hangindent1cm\rightskip1cm\noindent
+\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
\nointerlineskip\vskip3pt}
{}
\etocsetstyle{subsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{6pt}}
+{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
-\leftskip1.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hskip.2cm}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
-\nointerlineskip\vskip3pt}
+\leftskip1.5cm\hangindent1cm\rightskip1cm\noindent
+\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
+\nointerlineskip\vskip6pt}
{}
\newcommand{\coloredstuff}[2]{%
\leftskip0pt\rightskip0pt\parskip0pt
- \fboxsep0pt % \colorbox uses \fboxsep!
+ \fboxsep0pt % \colorbox uses \fboxsep also when no frame!
\noindent\colorbox{secbackground}
{\parbox{\linewidth}{%
\vskip5pt
@@ -1459,10 +1460,12 @@ the frame.
that other TOC (click me!)}\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{white}{\hbox to 1.5cm{\hss\etocnumber\hskip.2cm}%
- \etocname\hfill\hbox{\etocpage\hskip.2cm}}%
+ \etocname\hfill
+\hbox{\etocpage\hskip.2cm}}%
\vskip6pt}
{}
-\etocframedstyle[1]{} % title is not there!
+
+\etocframedstyle[1]{}
\tableofcontents \label{toc:clone} \ref{toc:globalcmds}
\endgroup
\end{verbatim}
@@ -1503,38 +1506,34 @@ use or not colors is left to the user.
\renewcommand{\etocinnerleftsep}{0pt}
\renewcommand{\etocinnerrightsep}{0pt}
-\newcommand\shiftedwhiterule[1]{%
-\hbox to \linewidth{\color{white}%
-\hskip\leftskip\leaders\vrule height1pt\hfil}\nointerlineskip
-\vskip#1}
+\newcommand\shiftedwhiterule[2]{%
+ \hbox to \linewidth{\color{white}%
+ \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
+\vskip#2}
-\etocsetstyle{subsubsection}{}
-{\shiftedwhiterule{6pt}}
+\etocsetstyle{subsubsection}{\etocskipfirstprefix}
+{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
-\leftskip2.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hskip.2cm}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
+\leftskip2.5cm\hangindent1cm\rightskip1cm\noindent
+\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
\nointerlineskip\vskip3pt}
{}
\etocsetstyle{subsection}{\etocskipfirstprefix}
-{\shiftedwhiterule{6pt}}
+{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
-\leftskip1.5cm\noindent
-\hbox to 1cm{\color{subsecnum}\etocnumber\hskip.2cm}%
-\color{black}\etocname\hfill\hbox{\etocpage\hskip.2cm}\par
-\nointerlineskip\vskip3pt}
+\leftskip1.5cm\hangindent1cm\rightskip1cm\noindent
+\hbox to 1cm{\color{subsecnum}\etocnumber\hss}%
+\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill
+\rlap{\hbox to 1cm{\hss\etocpage\hskip.2cm}}\par
+\nointerlineskip\vskip6pt}
{}
\newcommand{\coloredstuff}[2]{%
\leftskip0pt\rightskip0pt\parskip0pt
- \fboxsep0pt % \colorbox uses \fboxsep
-% si j'utilise des \hrule à l'intérieur de la parbox je suis
-% obligé de mettre ici
-% \color{secbackground}
-% de plus il y a un filet infinitésimal après ou avant les \hrule dont
-% je ne comprends pas l'origine [erreurs d'arrondis pour des
-% conversions en arithmétique interne?]
+ \fboxsep0pt % \colorbox uses \fboxsep also when no frame!
\noindent\colorbox{secbackground}
{\parbox{\linewidth}{%
\vskip5pt
@@ -1547,7 +1546,8 @@ use or not colors is left to the user.
that other TOC (click me!)}\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{white}{\hbox to 1.5cm{\hss\etocnumber\hskip.2cm}%
- \etocname\hfill\hbox{\etocpage\hskip.2cm}}%
+ \etocname\hfill
+\hbox{\etocpage\hskip.2cm}}%
\vskip6pt}
{}
@@ -1576,8 +1576,6 @@ package. Customizing them goes through suitable
\newcommand\etocfontone{\normalfont \normalsize \bfseries}
\newcommand\etocfonttwo{\normalfont \normalsize}
\newcommand\etocfontthree{\normalfont \footnotesize}
-\newcommand\etocfontfour{\normalfont \footnotesize}
-\newcommand\etocfontfive{\normalfont \footnotesize}
\newcommand\etocsepminustwo{4ex plus .5ex minus .5ex}
\newcommand\etocsepminusone{4ex plus .5ex minus .5ex}
@@ -1784,35 +1782,56 @@ contain the |hyperref| links, if present (note that the
in the page number corresponding to a given toc entry). The
tables of contents of the present document are fully linked.
-The contents of the |.toc| file are read into memory by \etoc
-once, at the \cs{begin\{document\}} (and not at the first
-\toc). The input stream opened by \etoc for reading is then
-closed but the |.toc| file is of course left opened for write
-operations, with the exact same instructions as used by the
-standard \LaTeX{} classes.
+The contents of the |.toc| file (if it exists) are read into
+memory by \etoc once, at the time of \cs{usepackage\{etoc\}}.
+The |.toc| file will be opened for write operations only at
+the time of the first TOC displaying command. \footnote{up to
+ version |v1.05| both things were done by \etoc at
+ \cs{begin\{document\}}.} \footnote{As soon as the |.toc|
+ file is opened for write, it becomes empty, so its contents
+ should be read by other packages or user defined macros
+ before the first TOC displaying command (this is the same
+ situation in the standard classes with the standard \toc
+ command.)}
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. This is the only kind of
-data written by \etoc to the |.toc| file (of course it does
-mean that if you remove usage of \etoc from the document, you
-should trash the |.toc| file). The correct local table of
+number is added to the |.toc| file. The correct local table of
contents will be displayed only on the next |latex| run.
+This is the only kind of data written by \etoc to the |.toc|
+file, but of course it does mean that if you remove usage of
+\etoc from the document, you should trash the |.toc| file.
+The commands written by \etoc to the |.toc| file do nothing
+when not used by \etoc itself, so other packages may
+also read the |.toc| file and execute its
+contents.\footnote{see previous footnote.}
+
If the document class does not use the extension |.toc| for
the file where the TOC data is preserved, then \etoc will
fail. If the data written in the |.toc| file does not contain
the name, number and page numbers in \cs{contentsline} lines,
then \etoc will fail. If the typesetting of entries of type
\emph{kind} is not done by a macro with name \cs{l@kind}, then
-\etoc will fail. If these macros are redefined after the
-\cs{begin\{document\}} then \etoc will fail. However if they
-are defined before and \etoc is instructed of their level by
-commands such as \cs{etocsetlevel\{kind\}\{2\}} then
-\cs{etocstandardlines} should be functional. You may customize
-the standard styles throughout the document (with |tocloft|
-for example) and \etoc should respond in compatibility mode as
-expected.
+\etoc will fail.
+
+The macros \cs{l@section}, \cs{l@subsection} . . ., more
+generally \cs{l@kind} where \emph{kind} has been declared to
+\etoc with \cs{etocsetlevel} may be customized throughout the
+document and it is their current definitions which will be
+used in compatibility mode.\footnote{in versions up to
+ |v1.05|, the default definitions of \cs{l@section} etc . .
+ . were re-established (to their values at the
+ \cs{begin\{document\}}, or at the latest \cs{etocsetlevel})
+ only temporarily by \etoc at the time of displaying a TOC
+ in compatibility mode. This made it impossible to customize
+ them by trying to add for example some font changing prefix
+ to the pre-existing macro (but customization via commands
+ of packages like |tocloft| which re-define \cs{l@section}
+ to have customizing hooks did work as advertised). The new
+ implementation in |v1.06| changes the meaning of
+ \cs{l@section} and similar macros only at the time of
+ actually typesetting the tables of contents.}
\subsection{\TeX nical matters}
@@ -1852,10 +1871,15 @@ document get its final appearance (at least twice).
In certain extreme cases (\emph{e.g.} if one removes the
|hyperref| package from a previously hyperlinked document),
one must trash the previous |.aux| and |.toc| files. But
-adding \cs{usepackage\{hyperref\}} to a non-hyperlinked source
-should cause no trouble at all (the old |.toc| file will not
-be used, the new one, whose format differs, will be used on
-the next run).
+adding \cs{usepackage\{hyperref\}} to a non-hyperlinked
+source should cause no trouble at all (the old |.toc| file
+will not be used, the new one, whose format differs, will be
+used on the next run).\footnote{Note however than an error
+ results when one adds \cs{usepackage\{hyperref\}} to a
+ document having some \cs{label}'s and \cs{ref}'s, and that
+ one must run |latex| another time or trash the |.aux| file to
+ get rid of the error. This is related neither with \etoc nor with the
+|.toc| file.}
\part{The code}
@@ -1877,9 +1901,12 @@ the \TeX{} installation.
Writing-up source code comments is hopefully for a future
release.
-% I don't want to have to type explicitly the package version number
-% and version date. I cut out this from the real macrocode environment,
-% leaving out for example the \init@crossref.
+% 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
+% environment (leaving out the \init@crossref.)
\makeatletter
\begingroup
\topsep\MacrocodeTopsep
@@ -1945,6 +1972,7 @@ release.
\newif\ifEtoc@notactive
\newcounter{etoc@tocid}
\newif\ifEtoc@mustclosegroup
+\newif\ifEtoc@tocopenedforwrite
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -1970,19 +1998,10 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\def\Etoc@Lazarus{%
-\def\Etoc@Lazarus@elta##1\Etoc@Lazarus@eltb##2{\let##1##2}%
-\Etoc@Lazaruslist}
-\def\Etoc@Lazaruslist{}
-% \end{macrocode}
-% placeholder for comments
-% \begin{macrocode}
-\def\Etoc@newdisciple#1#2{%
- \def\Etoc@Lazarus@elta{\noexpand\Etoc@Lazarus@elta\noexpand}%
- \def\Etoc@Lazarus@eltb{\noexpand\Etoc@Lazarus@eltb\noexpand}%
- \edef\Etoc@Lazaruslist{\Etoc@Lazaruslist
- \Etoc@Lazarus@elta#1
- \Etoc@Lazarus@eltb#2}}
+\def\Etoc@levellist{}
+\def\Etoc@newlevel#1{%
+ \def\Etoc@levellist@elt{\noexpand\Etoc@levellist@elt\noexpand}%
+ \edef\Etoc@levellist{\Etoc@levellist\Etoc@levellist@elt#1}}
\def\etocsetlevel#1#2{%
\let\Etoc@next\@firstofone
\ifcase#2\or\or\or\or\or
@@ -1993,16 +2012,7 @@ release.
\expandafter\def\csname Etoc@#1@\endcsname{minusone}%
\expandafter\let\csname Etoc@#1@@\endcsname\m@ne
\let\Etoc@next\@gobble\fi\fi\fi
- \if@noskipsec
- \else
- \expandafter\expandafter\expandafter
- \let\expandafter\expandafter\csname Etoc@savedl@#1\endcsname
- \csname l@#1\endcsname
- \expandafter\let \csname l@#1\endcsname\Etoc@lxyz
- \fi
- \expandafter\expandafter\expandafter\Etoc@newdisciple
- \expandafter\expandafter
- \csname l@#1\endcsname\csname Etoc@savedl@#1\endcsname
+ \expandafter\Etoc@newlevel\csname l@#1\endcsname
\Etoc@next
{\ifcase#2\relax
\expandafter\let \csname Etoc@#1@@\endcsname\Etoc@@zero@@
@@ -2043,10 +2053,6 @@ release.
% placeholder for comments
% \begin{macrocode}
\AtBeginDocument{%
-\def\Etoc@Lazarus@elta#1\Etoc@Lazarus@eltb#2{\let#2#1\let#1\Etoc@lxyz}%
-\Etoc@Lazaruslist
-\let\Etoc@savedcontentsline\contentsline
-\let\contentsline\Etoc@etoccontentsline
\@ifpackageloaded{hyperref}
{\Etoc@hyperreftrue
\def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}}
@@ -2063,7 +2069,7 @@ release.
\Etoc@et@hop
{\Etoc@savedcontentsline{#1}}
{\Etoc@contents}}
- \let\etocskipfirstprefix\@thirdofthree
+\let\etocskipfirstprefix\@thirdofthree
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -2120,7 +2126,6 @@ release.
% \begin{macrocode}
\def\Etoc@etoccontentsline#1{%
\global\expandafter\let\expandafter\Etoc@tmp\csname Etoc@#1@@\endcsname
- \global\Etoc@partfalse
\Etoc@skipthisonefalse
\ifEtoc@hyperref
\def\Etoc@next{\expandafter\@gobbletwo\@gobblefour}%
@@ -2152,38 +2157,38 @@ release.
\ifEtoc@ii \Etoc@end@two\fi
\ifEtoc@i \Etoc@end@one\fi
\ifEtoc@ \else \def\Etoc@next{\Etoc@begin@zero}\fi
- \gdef\Etoc@contents{\Etoc@contents@zero}%
- \gdef\Etoc@prefix{\Etoc@prefix@zero}%
+ \def\Etoc@contents{\Etoc@contents@zero}%
+ \def\Etoc@prefix{\Etoc@prefix@zero}%
\or
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \Etoc@end@four\fi
\ifEtoc@iii \Etoc@end@three\fi
\ifEtoc@ii \Etoc@end@two\fi
\ifEtoc@i \else \def\Etoc@next{\Etoc@begin@one}\fi
- \gdef\Etoc@contents{\Etoc@contents@one}%
- \gdef\Etoc@prefix{\Etoc@prefix@one}%
+ \def\Etoc@contents{\Etoc@contents@one}%
+ \def\Etoc@prefix{\Etoc@prefix@one}%
\or
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \Etoc@end@four\fi
\ifEtoc@iii \Etoc@end@three\fi
\ifEtoc@ii \else \def\Etoc@next{\Etoc@begin@two}\fi
- \gdef\Etoc@contents{\Etoc@contents@two}%
- \gdef\Etoc@prefix{\Etoc@prefix@two}%
+ \def\Etoc@contents{\Etoc@contents@two}%
+ \def\Etoc@prefix{\Etoc@prefix@two}%
\or
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \Etoc@end@four\fi
\ifEtoc@iii \else \def\Etoc@next{\Etoc@begin@three}\fi
- \gdef\Etoc@contents{\Etoc@contents@three}%
- \gdef\Etoc@prefix{\Etoc@prefix@three}%
+ \def\Etoc@contents{\Etoc@contents@three}%
+ \def\Etoc@prefix{\Etoc@prefix@three}%
\or
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \else \def\Etoc@next{\Etoc@begin@four}\fi
- \gdef\Etoc@contents{\Etoc@contents@four}%
- \gdef\Etoc@prefix{\Etoc@prefix@four}%
+ \def\Etoc@contents{\Etoc@contents@four}%
+ \def\Etoc@prefix{\Etoc@prefix@four}%
\or
\ifEtoc@v \else \def\Etoc@next{\Etoc@begin@five}\fi
- \gdef\Etoc@contents{\Etoc@contents@five}%
- \gdef\Etoc@prefix{\Etoc@prefix@five}%
+ \def\Etoc@contents{\Etoc@contents@five}%
+ \def\Etoc@prefix{\Etoc@prefix@five}%
\else
\ifnum\Etoc@tmp=\m@ne
\ifEtoc@v \Etoc@end@five\fi
@@ -2193,9 +2198,8 @@ release.
\ifEtoc@i \Etoc@end@one\fi
\ifEtoc@ \Etoc@end@zero\fi
\ifEtoc@j \else \def\Etoc@next{\Etoc@begin@minusone}\fi
- \global\Etoc@parttrue
- \gdef\Etoc@contents{\Etoc@contents@minusone}%
- \gdef\Etoc@prefix{\Etoc@prefix@minusone}%
+ \def\Etoc@contents{\Etoc@contents@minusone}%
+ \def\Etoc@prefix{\Etoc@prefix@minusone}%
\else
\ifEtoc@v \Etoc@end@five\fi
\ifEtoc@iv \Etoc@end@four\fi
@@ -2205,10 +2209,11 @@ release.
\ifEtoc@ \Etoc@end@zero\fi
\ifEtoc@j \Etoc@end@minusone\fi
\ifEtoc@jj \else \def\Etoc@next{\Etoc@begin@minustwo}\fi
- \gdef\Etoc@contents{\Etoc@contents@minustwo}%
- \gdef\Etoc@prefix{\Etoc@prefix@minustwo}%
+ \def\Etoc@contents{\Etoc@contents@minustwo}%
+ \def\Etoc@prefix{\Etoc@prefix@minustwo}%
\fi
\fi
+ \ifnum\Etoc@tmp=\m@ne\Etoc@parttrue\else\Etoc@partfalse\fi
\Etoc@setflags{\Etoc@tmp}%
\fi\fi
\Etoc@next
@@ -2216,8 +2221,8 @@ release.
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\def\Etoc@lxyz #1#2{\global\@namedef{etocname }{\leavevmode #1\xspace}%
- \global\@namedef{etocpage }{\leavevmode #2\xspace}%
+\def\Etoc@lxyz #1#2{\@namedef{etocname }{\leavevmode #1\xspace}%
+ \@namedef{etocpage }{\leavevmode #2\xspace}%
\Etoc@getnb #1\relax\relax\etoc@
\ifEtoc@number\else\ifEtoc@part
\Etoc@getit #1\hspace\relax\etoc@\fi\fi}
@@ -2235,9 +2240,9 @@ release.
% \begin{macrocode}
\def\Etoc@getnb@nohyp #1#2#3\etoc@{%
\ifx #1\numberline
-\global\@namedef{etocnumber }{\leavevmode #2\xspace}\global\Etoc@numbertrue
+\@namedef{etocnumber }{\leavevmode #2\xspace}\Etoc@numbertrue
\else
-\global\@namedef{etocnumber }{\leavevmode\xspace}\global\Etoc@numberfalse
+\@namedef{etocnumber }{\leavevmode\xspace}\Etoc@numberfalse
\fi}
% \end{macrocode}
% placeholder for comments
@@ -2245,11 +2250,11 @@ release.
\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@{%
\def\Etoc@getnbr ##1##2##3\etoc@{%
\ifx ##1\numberline
- \global\@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5\xspace}%
- \global\Etoc@numbertrue
+ \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5\xspace}%
+ \Etoc@numbertrue
\else
- \global\@namedef{etocnumber }{\leavevmode\xspace}%
- \global\Etoc@numberfalse
+ \@namedef{etocnumber }{\leavevmode\xspace}%
+ \Etoc@numberfalse
\fi}%
\Etoc@getnbr #4\relax\relax\etoc@}
% \end{macrocode}
@@ -2257,21 +2262,21 @@ release.
% \begin{macrocode}
\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@{%
\def\Etoc@getname ##1\hspace\relax\etoc@{%
- \global\@namedef{etocname }{\leavevmode ##1\xspace}}%
+ \@namedef{etocname }{\leavevmode ##1\xspace}}%
\ifx \relax#2\else
- \global\@namedef{etocnumber }{\leavevmode #1\xspace}%
- \global\Etoc@numbertrue
+ \@namedef{etocnumber }{\leavevmode #1\xspace}%
+ \Etoc@numbertrue
\Etoc@getname #3\etoc@\fi}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@{%
\def\Etoc@getname ##1\hspace\relax\etoc@{%
- \global\@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}}%
+ \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5\xspace}}%
\def\Etoc@getnbr ##1\hspace##2##3\etoc@{%
\ifx\relax##2\else
- \global\@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5\xspace}%
- \global\Etoc@numbertrue
+ \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5\xspace}%
+ \Etoc@numbertrue
\Etoc@getname ##3\etoc@\fi}%
\Etoc@getnbr #4\hspace\relax\etoc@}
% \end{macrocode}
@@ -2299,40 +2304,41 @@ release.
\def\Etoc@readtoc#1{%
\ifeof #1
\let\Etoc@nextread\@gobble
+ \global\Etoc@toctoks=\expandafter{\the\Etoc@toctoks}%
\else
\let\Etoc@nextread\Etoc@readtoc
\read #1 to \Etoc@buffer
- \global\Etoc@toctoks=\expandafter\expandafter\expandafter
+ \Etoc@toctoks=\expandafter\expandafter\expandafter
{\expandafter\the\expandafter\Etoc@toctoks\Etoc@buffer}%
\fi
\Etoc@nextread{#1}%
}
+\IfFileExists{\jobname .toc}
+ {{\endlinechar=-1 \makeatletter
+ \newread\Etoc@tf
+ \openin\Etoc@tf\@filef@und
+ \Etoc@readtoc\Etoc@tf
+ \closein\Etoc@tf}}{\typeout{No file \jobname .toc.}}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
\def\Etoc@starttoc{%
\begingroup
\makeatletter
-\@ifpackageloaded{hyperref}
- {\ifx\hyper@last\@undefined
+\ifEtoc@hyperref
+ \ifx\hyper@last\@undefined
\ltx@ifpackageloaded {parskip}{\parskip \z@ }{}%
- \IfFileExists {\jobname .toc}{\Hy@WarningNoLine {old toc file
- detected, not used; run LaTeX again (cheers from etoc)}}{}%
- \expandafter\@gobble\fi}{}%
-{\IfFileExists{\jobname .toc}
- {\endlinechar=-1\relax
- \newread\Etoc@tf
- \openin\Etoc@tf\@filef@und
- \Etoc@readtoc\Etoc@tf
- \closein\Etoc@tf}
- {\typeout{No file \jobname .toc.}}}%
-\if@filesw \newwrite \tf@toc \immediate
-\openout \tf@toc \jobname .toc\relax \fi
-\@nobreakfalse \endgroup}
+ \IfFileExists {\jobname .toc}
+ {\Hy@WarningNoLine
+ {old toc file detected, not used; run LaTeX again (cheers from etoc)}%
+ \global\Etoc@toctoks={}}
+{}\fi\fi
+\if@filesw \newwrite \tf@toc
+\immediate \openout \tf@toc \jobname .toc\relax \fi \@nobreakfalse
+\endgroup}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\AtBeginDocument{\Etoc@starttoc}
\def\Etoc@toctoc{%
\global\Etoc@vfalse
\global\Etoc@ivfalse
@@ -2343,7 +2349,6 @@ release.
\global\Etoc@jfalse
\global\Etoc@jjfalse
\ifEtoc@standard
-\Etoc@Lazarus
\etoc@setstyle{@minustwo}{}{}{}{}%
\etoc@setstyle{@minusone}{}{}{}{}%
\etoc@setstyle{@zero}{}{}{}{}%
@@ -2352,7 +2357,9 @@ release.
\etoc@setstyle{@three}{}{}{}{}%
\etoc@setstyle{@four}{}{}{}{}%
\etoc@setstyle{@five}{}{}{}{}%
-\else
+\else
+\def\Etoc@levellist@elt##1{\let##1\Etoc@lxyz}%
+\Etoc@levellist
\let\numberline\@gobble
\let\booknumberline\numberline
\let\partnumberline\numberline
@@ -2377,14 +2384,14 @@ release.
\ifEtoc@localtoc
\ifEtoc@notactive
\ifnum #1=#2\relax
- \ifEtoc@jj \global\let\Etoc@localtop\Etoc@@minusone@@ \fi
- \ifEtoc@j \global\let\Etoc@localtop\Etoc@@zero@@ \fi
- \ifEtoc@ \global\let\Etoc@localtop\Etoc@@one@@ \fi
- \ifEtoc@i \global\let\Etoc@localtop\Etoc@@two@@ \fi
- \ifEtoc@ii \global\let\Etoc@localtop\Etoc@@three@@ \fi
- \ifEtoc@iii \global\let\Etoc@localtop\Etoc@@four@@ \fi
- \ifEtoc@iv \global\let\Etoc@localtop\Etoc@@five@@ \fi
- \ifEtoc@v \global\let\Etoc@localtop\Etoc@@six@@ \fi
+ \ifEtoc@jj \let\Etoc@localtop\Etoc@@minusone@@ \fi
+ \ifEtoc@j \let\Etoc@localtop\Etoc@@zero@@ \fi
+ \ifEtoc@ \let\Etoc@localtop\Etoc@@one@@ \fi
+ \ifEtoc@i \let\Etoc@localtop\Etoc@@two@@ \fi
+ \ifEtoc@ii \let\Etoc@localtop\Etoc@@three@@ \fi
+ \ifEtoc@iii \let\Etoc@localtop\Etoc@@four@@ \fi
+ \ifEtoc@iv \let\Etoc@localtop\Etoc@@five@@ \fi
+ \ifEtoc@v \let\Etoc@localtop\Etoc@@six@@ \fi
\def\Etoc@next{\global\Etoc@notactivefalse
\global\Etoc@vfalse
\global\Etoc@ivfalse
@@ -2397,7 +2404,7 @@ release.
\fi
\fi\fi
\Etoc@next}
-\def\etoc@startlocaltoc#1{\etoc@@startlocaltoc{#1}{\c@etoc@tocid}}
+\let\etoc@startlocaltoc\@gobble
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -2409,16 +2416,14 @@ release.
\leavevmode --unknown etoc ref: run latex again--\par
\let\Etoc@next\@gobble\else\let\Etoc@next\@firstofone\fi
\Etoc@next
- {\begingroup
- \edef\etoc@startlocaltoc##1{%
+ {\edef\etoc@startlocaltoc##1{%
\noexpand\etoc@@startlocaltoc{##1}{#1}}
\Etoc@localtoctrue
\let\Etoc@localtop\Etoc@@minustwo@@
\global\Etoc@stoptocfalse
\global\Etoc@notactivetrue
- \Etoc@tableofcontents
- \endgroup}%
- \ifEtoc@mustclosegroup\expandafter\endgroup\fi}
+ \Etoc@tableofcontents}%
+ \endgroup\ifEtoc@mustclosegroup\expandafter\endgroup\fi}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -2427,10 +2432,6 @@ release.
\Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}}
\def\Etoc@ref#1{\Etoc@localtableofcontents{\Etoc@getref{#1}}}
\def\Etoc@label#1{\label{#1}%
- \ifEtoc@tocwithid\else
- \addtocontents{toc}
- {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}%
- \fi
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
{\def\1{\Etoc@again}\expandafter
\gdef\1 {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}}
@@ -2449,16 +2450,15 @@ release.
\def\Etoc@next{\expandafter\Etoc@ref\@gobble}%
\else
\def\Etoc@next{\Etoc@localtocfalse
- \global\Etoc@notactivefalse
- \begingroup\Etoc@tableofcontents
- \ifEtoc@mustclosegroup\expandafter\endgroup\fi
- \endgroup}%
+ \global\Etoc@notactivefalse
+ \Etoc@tableofcontents
+ \endgroup
+ \ifEtoc@mustclosegroup\expandafter\endgroup\fi}%
\fi
\fi\fi\fi\Etoc@next}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
-\newcommand\etocaftertitlehook{}
\def\table@fcontents{\par
\refstepcounter{etoc@tocid}%
\Etoc@tocwithidfalse
@@ -2466,13 +2466,23 @@ release.
\def\localtable@fcontents{\par
\refstepcounter{etoc@tocid}%
\addtocontents{toc}
- {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}
+ {\string\etoc@startlocaltoc\string{\arabic{etoc@tocid}\string}}%
\Etoc@tocwithidtrue
\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
-\def\tableofcontents{\@ifstar
+% \end{macrocode}
+% placeholder for comments
+% \begin{macrocode}
+\newcommand\etocaftertitlehook{}
+\def\tableofcontents{\ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi
+ \global\Etoc@tocopenedforwritetrue
+ \begingroup
+ \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}%
+ \@ifstar
{\let\Etoc@aftertitlehook\relax\table@fcontents}
{\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
-\def\localtableofcontents{\@ifstar
+\def\localtableofcontents{\ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi
+ \global\Etoc@tocopenedforwritetrue
+ \begingroup\@ifstar
{\let\Etoc@aftertitlehook\relax\localtable@fcontents}
{\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
% \end{macrocode}
@@ -2483,6 +2493,8 @@ release.
{\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else
\let\Etoc@@next\@gobble\fi
\Etoc@@next{#1\Etoc@aftertitlehook
+ \let\Etoc@savedcontentsline\contentsline
+ \let\contentsline\Etoc@etoccontentsline
\Etoc@toctoc\let\Etoc@n@xt\relax
\ifEtoc@tocwithid\else
\ifEtoc@localtoc
@@ -2519,8 +2531,6 @@ release.
\newcommand\etocfontone{\normalfont \normalsize \bfseries}
\newcommand\etocfonttwo{\normalfont \normalsize}
\newcommand\etocfontthree{\normalfont \footnotesize}
-\newcommand\etocfontfour{\normalfont \footnotesize}
-\newcommand\etocfontfive{\normalfont \footnotesize}
% \end{macrocode}
% placeholder for comments
% \begin{macrocode}
@@ -3066,7 +3076,6 @@ release.
\endinput
% \end{macrocode}
% \MakePercentComment
-%</package>
\CharacterTable
{Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -3083,7 +3092,7 @@ release.
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum{2542}
+\CheckSum{2484}
\Finale
%%
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins
index f12eac492d3..1fed2b372ac 100644
--- a/Master/texmf-dist/source/latex/etoc/etoc.ins
+++ b/Master/texmf-dist/source/latex/etoc/etoc.ins
@@ -1,21 +1,25 @@
-%% Package `etoc' by Jean-Francois Burnol
-%% Copyright (C) 2012 by Jean-Francois Burnol
+\def\lasttimestamp{Time-stamp: <07-12-2012 20:15:47 CET jfb>}
\def\pkgname{etoc}
-\def\pkgdate{2012/12/01}
-\def\pkgversion{v1.05}
+\def\pkgdate{2012/12/07}
+\def\pkgversion{v1.06}
\def\pkgdescription{easily customizable TOCs (jfB)}
%%
+%% Package `etoc' by Jean-Francois Burnol
+%% Copyright (C) 2012 by Jean-Francois Burnol
+%%
%% This file `etoc.ins' is provided for compatibility with TeX distributions
%% expecting to find it for installation of `etoc.sty'.
%%
%% 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)
%%
-%% Put the `etoc.sty' file in a suitable location within the TeX installation:
-%% etoc.sty -> ................/tex/latex/etoc/
+%% Put the `etoc.sty' file in a suitable location within the TeX
+%% installation: etoc.sty -> ................/tex/latex/etoc/
+%%
+%% The generated auxiliary files may be discarded.
%%
-%% The generated auxiliary files may be discarded. See `etoc.dtx' for the
-%% statements of copyright and conditions of distribution or modification.
+%% See `etoc.dtx' for the statements of copyright and conditions of
+%% distribution or modification.
%%
\input docstrip.tex
\askforoverwritefalse