texlive[42182] Master/texmf-dist: overlays (29sep16)

commits+karl at tug.org commits+karl at tug.org
Thu Sep 29 22:34:36 CEST 2016


Revision: 42182
          http://tug.org/svn/texlive?view=revision&revision=42182
Author:   karl
Date:     2016-09-29 22:34:36 +0200 (Thu, 29 Sep 2016)
Log Message:
-----------
overlays (29sep16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/etoc/README.md
    trunk/Master/texmf-dist/doc/latex/etoc/etoc-DE.pdf
    trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
    trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
    trunk/Master/texmf-dist/source/latex/etoc/etoc.ins
    trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/etoc/README

Deleted: trunk/Master/texmf-dist/doc/latex/etoc/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/README	2016-09-29 20:34:14 UTC (rev 42181)
+++ trunk/Master/texmf-dist/doc/latex/etoc/README	2016-09-29 20:34:36 UTC (rev 42182)
@@ -1,181 +0,0 @@
-    Source:  etoc.dtx (v1.08h-2016/09/25)
-    Author:  Jean-Francois Burnol
-    Author:  Christine Roemer et al. (German tranlation)
-    Info:    Completely customisable TOCs
-    License: LPPL 1.3c
-    Copyright (C) 2012-2016 Jean-Francois Burnol.
-    Copyright (C) 2014-2016 Christine Roemer and collaborators for
-    the translation into German of the documentation.
-    <jfbu at free dot fr>    <Christine_Roemer at t-online dot de>
-
-
-
-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.
-
-Regarding the _global toc display_, etoc provides pre-defined styles
-based on a multi-column format, with, optionally, a ruled title or
-framed contents.
-
-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 local
-table of contents defined somewhere else in the document.
-
-Via _depth tags_, one gets an even finer control for each table of
-contents of which sectioning units it should, or not, display.
-
-The formatting inherited (and possibly customized by other packages)
-from the document class will be used when in compatibility mode.
-
-The assignment of levels to the sectioning units can be changed at any
-time, and etoc can thus be used in a quite general manner to 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.
-
-
-
-INSTALLATION
-
-
-The simplest is to download
-
-  http://mirrors.ctan.org/install/macros/latex/contrib/etoc.tds.zip
-
-and then run unzip etoc.tds.zip -d <DEST> where <DEST> is a
-TDS-compliant repertory.
-
-Else, to extract the package (.sty) and driver (.tex) files from
-etoc.dtx:
-
--   if etoc.ins is present: etex etoc.ins
--   without etoc.ins: etex etoc.dtx
-
-It is also possible to run latex or pdflatex directly on etoc.dtx.
-
-To produce etoc.pdf one can run pdflatex (thrice) directly on etoc.dtx
-or on the file etoc.tex which was extracted from previous step.
-
-Options can be set in etoc.tex:
-
--   scrdoc class options (paper size, font size, ...)
--   with or without source code,
--   with dvipdfmx or with latex+dvips or pdflatex.
-
-Release 1.08h sets pdflatex as default in etoc.tex (prior it was
-latex+dvipdfmx as it produces smaller PDFs) in order to allow inclusion
-via the use of package attachfile of about 25 code samples as file
-attachment annotations.
-
-Installation:
-
-    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-DE.pdf -> TDS:doc/latex/etoc/etoc-DE.pdf
-    README.md   -> TDS:doc/latex/etoc/README.md
-
-The other files may be discarded.
-
-
-
-LICENSE
-
-
-This Work may be distributed and/or modified under the conditions of the
-LaTeX Project Public License, in its version 1.3c. This version of this
-license is in
-
-  http://www.latex-project.org/lppl/lppl-1-3c.txt
-
-and the latest version of this license is in
-
-  http://www.latex-project.org/lppl.txt
-
-and version 1.3 or later is part of all distributions of LaTeX version
-2005/12/01 or later.
-
-The Authors of this Work are:
-
--   Jean-Francois Burnol <jfbu at free dot fr> for the source code and
-    English documentation, and
--   Christine Roemer <Christine_Roemer at t-online dot de> and
-    collaborators for the translation into German of the documentation.
-
-This Work consists of the main source file etoc.dtx and the derived
-files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf,
-etoc.dvi, etoc-DE.dvi.
-
-
-
-RECENT CHANGES
-
-
-v1.08h [2016/09/25]
-
-New functioning of \etocsetnexttocdepth: the tocdepth counter is
-modified only at the time of the table of contents, not before. This
-fixes an issue which arose when \etocsetnexttocdepth was used multiple
-times with no intervening table of contents.
-
-The PDF documentation includes about 25 LaTeX code snippets also as file
-attachment annotations, additionally to their verbatim typesetting. The
-ordering of the documentation contents has been slightly re-organized.
-
-A previous documentation-only update on 2016/09/09 added a new section
-with the (approximate) translation into etoc lingua of the book class
-toc style, for easy customizability.
-
-
-v1.08g [2015/08/29]
-
-Downgraded to a mere info message the etoc-issued warning (relative to
-\settocdepth/\maxtocdepth) under class memoir.
-
-
-v1.08f [2015/04/28]
-
-Minor changes to the documentation. \etocsetlevel more economical.
-
-
-v1.08e [2015/04/17]
-
-The command \etocchecksemptiness tells etoc to not print, from that
-point on, the headings of the local tables of contents if they have
-empty contents. This is mainly for class authors who might want to have
-their \section or \chapter automatically do a \localtableofcontents.
-Could prove also useful for batch conversions of documents. Thanks to
-Paul Gaborit who asked for such a feature.
-
-The command \etocnotocifnotoc extends this behaviour to global TOCs:
-indeed why should documents with no sectioning units take this as an
-excuse not to use package etoc ?
-
-The command \etocifwasempty{yes}{no} can be used for suitable extra
-action.
-
-A \tableofcontents\ref{foo} now expects foo to be a label to a _local_
-TOC. The use with foo a label to a _global_ TOC is not supported anymore
-as it had no utility and made the code more complex.
-
-The syntax \localtableofcontents\ref{foo} is now accepted as a synonym
-to the earlier syntax \tableofcontents\ref{foo}.
-
-
-v1.08d [2015/04/09]
-
-Translation into German of the additions made to the documentation for
-the 1.08x series of releases.
-
-Thanks to Christine Römer!

Modified: trunk/Master/texmf-dist/doc/latex/etoc/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/README.md	2016-09-29 20:34:14 UTC (rev 42181)
+++ trunk/Master/texmf-dist/doc/latex/etoc/README.md	2016-09-29 20:34:36 UTC (rev 42182)
@@ -1,6 +1,6 @@
 <!-- -->
 
-    Source:  etoc.dtx (v1.08h-2016/09/25)
+    Source:  etoc.dtx (v1.08i-2016/09/29)
     Author:  Jean-Francois Burnol
     Author:  Christine Roemer et al. (German tranlation)
     Info:    Completely customisable TOCs
@@ -71,8 +71,8 @@
 - with or without source code,
 - with dvipdfmx or with latex+dvips or pdflatex.
 
-Release 1.08h sets pdflatex as default in etoc.tex (prior it was
-latex+dvipdfmx as it produces smaller PDFs) in order to allow
+Since release 1.08h pdflatex is the default in etoc.tex (prior it
+was latex+dvipdfmx as it produces smaller PDFs) in order to allow
 inclusion via the use of package `attachfile` of about 25 code
 samples as file attachment annotations.
 
@@ -116,13 +116,38 @@
 RECENT CHANGES
 ==============
 
+v1.08i \[2016/09/29\]
+---------------------
+
+This fixes an issue dating back to `1.08e-2015/04/17`: under
+`\etocchecksemptiness` regime, some circumstances (such as adding to
+an already compiled document a `\localtableofcontents` before the
+main `\tableofcontents`) created an "`Undefined control sequence`
+`\Etoc at localtop`" error. Thanks to Denis Bitouzé for reporting the
+problem.
+
+On this occasion, `\etocdoesnotcheckemptiness` has been
+added to unset the flag.
+
+A rather more exotic issue was fixed: the emptiness check for
+local tocs could get confused if the `tocdepth` counter was varying
+in some specific ways from inside the `toc` file.
+
+After adding to a document a `\localtableofcontents`, two LaTeX
+passes are needed for etoc to get a chance to print the
+correct local contents. Formerly, etoc issued a Warning on
+the first pass; it now also induces LaTeX into
+announcing "There were undefined references", as this is nearer
+to the end of the log file and console output.
+
 v1.08h \[2016/09/25\]
 ---------------------
 
 New functioning of `\etocsetnexttocdepth`: the tocdepth counter is
-modified only at the time of the table of contents, not before.
-This fixes an issue which arose when `\etocsetnexttocdepth` was used
-multiple times with no intervening table of contents.
+modified only at the time of the table of contents, not before. This
+fixes an issue which arose when `\etocsetnexttocdepth` was used
+multiple times with no intervening table of contents. Thanks to
+Denis Bitouzé for reporting the problem.
 
 The PDF documentation includes about 25 LaTeX code snippets also
 as file attachment annotations, additionally to their verbatim

Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc-DE.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx	2016-09-29 20:34:14 UTC (rev 42181)
+++ trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx	2016-09-29 20:34:36 UTC (rev 42182)
@@ -2,12 +2,12 @@
 % N.B.: this dtx file is NOT for use with \DocInput. The latex source of the
 % user manual is not prefixed with percent signs.
 %<*none>
-\def\etocdtxtimestamp {Time-stamp: <25-09-2016 at 19:33:27 CEST>}%
+\def\etocdtxtimestamp {Time-stamp: <29-09-2016 at 11:13:23 CEST>}%
 %</none>
 %<*!readme>
 %%
 %% Package: etoc
-%% Version: 1.08h-2016/09/25
+%% Version: 1.08i-2016/09/29
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2016 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -17,14 +17,14 @@
 %%
 %</!readme>
 %<*insfile>
-\def\etocpkgdate        {2016/09/25}
-\def\etocdocdate        {2016/09/25}
-\def\etocpkgversion     {v1.08h}
+\def\etocpkgdate        {2016/09/29}
+\def\etocdocdate        {2016/09/29}
+\def\etocpkgversion     {v1.08i}
 \def\etocpkgdescription {Completely customisable TOCs (JFB)}
 %</insfile>
 %<*none>
-\def\etocDEpkgdate      {25.09.2016}
-\def\etocDEdocdate      {25.09.2016}
+\def\etocDEpkgdate      {29.09.2016}
+\def\etocDEdocdate      {29.09.2016}
 \def\etocDEDEdocdate    {09.04.2015}%
 \def\etocDEDEpkgversion {v1.08d}%
 % Definition of \etocLicense
@@ -35,7 +35,7 @@
     \catcode32=13\catcode`\\=12^^Brelax^^A
 ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
 {% Package: etoc
-% Version: 1.08h-2016/09/25
+% Version: 1.08i-2016/09/29
 % License: LPPL 1.3c
 % Copyright (C) 2012-2016 Jean-Francois Burnol <jfbu at free dot fr>
 % Copyright (C) 2014-2016 Christine Roemer <Christine_Roemer at t-online dot de>
@@ -69,7 +69,7 @@
 %<*readme>
 <!-- -->
 
-    Source:  etoc.dtx (v1.08h-2016/09/25)
+    Source:  etoc.dtx (v1.08i-2016/09/29)
     Author:  Jean-Francois Burnol
     Author:  Christine Roemer et al. (German tranlation)
     Info:    Completely customisable TOCs
@@ -140,8 +140,8 @@
 - with or without source code,
 - with dvipdfmx or with latex+dvips or pdflatex.
 
-Release 1.08h sets pdflatex as default in etoc.tex (prior it was
-latex+dvipdfmx as it produces smaller PDFs) in order to allow
+Since release 1.08h pdflatex is the default in etoc.tex (prior it
+was latex+dvipdfmx as it produces smaller PDFs) in order to allow
 inclusion via the use of package `attachfile` of about 25 code
 samples as file attachment annotations.
 
@@ -185,13 +185,39 @@
 RECENT CHANGES
 ==============
 
+v1.08i \[2016/09/29\]
+---------------------
+
+This fixes an issue dating back to `1.08e-2015/04/17`: under
+`\etocchecksemptiness` regime, some circumstances (such as adding to
+an already compiled document a `\localtableofcontents` before the
+main `\tableofcontents`) created an "`Undefined control sequence`
+`\Etoc at localtop`" error. Thanks to Denis Bitouzé for reporting the
+problem.
+
+On this occasion, `\etocdoesnotcheckemptiness` has been
+added to unset the flag.
+
+A rather more exotic issue was fixed: the emptiness check for
+local tocs could get confused if the `tocdepth` counter was varying
+in some specific ways from inside the `toc` file.
+
+After adding to a document a `\localtableofcontents`, two LaTeX
+passes are needed for etoc to get a chance to print the
+correct local contents. Formerly, etoc issued a Warning on
+the first pass; it now also induces LaTeX into
+announcing "There were undefined references", as this is nearer
+to the end of the log file and console output.
+
+
 v1.08h \[2016/09/25\]
 ---------------------
 
 New functioning of `\etocsetnexttocdepth`: the tocdepth counter is
-modified only at the time of the table of contents, not before.
-This fixes an issue which arose when `\etocsetnexttocdepth` was used
-multiple times with no intervening table of contents.
+modified only at the time of the table of contents, not before. This
+fixes an issue which arose when `\etocsetnexttocdepth` was used
+multiple times with no intervening table of contents. Thanks to
+Denis Bitouzé for reporting the problem.
 
 The PDF documentation includes about 25 LaTeX code snippets also
 as file attachment annotations, additionally to their verbatim
@@ -299,8 +325,8 @@
 %%  - with or without source code,
 %%  - with dvipdfmx or with latex/pdflatex.
 %%
-%% Release 1.08h sets pdflatex as default in etoc.tex (prior it was
-%% latex+dvipdfmx as it produces smaller PDFs) in order to allow
+%% Since release 1.08h pdflatex is the default in etoc.tex (prior it
+%% was latex+dvipdfmx as it produces smaller PDFs) in order to allow
 %% inclusion via the use of package `attachfile` of about 25 code
 %% samples as file attachment annotations.
 %%
@@ -2013,7 +2039,7 @@
   typeset, this could break the correct restoring of the |tocdepth| counter
   after the TOC. Starting with |1.08h|, the |tocdepth| counter is modified
   only at the time the TOC is typeset, not earlier, thus fixing that
-  issue.\footnote{Thanks to D.B. for signaling the problem.}
+  issue.\footnote{Thanks to Denis \textsc{Bitouzé} for signaling the problem.}
 %
 
 \subsection{The hyperref option \emph{bookmarksdepth}}
@@ -2043,7 +2069,7 @@
 \label{etocsettocdepth.toc}
 
 This command \csb{etocsettocdepth.toc} implements some functionality of
-|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. I thank D.B. for drawing
+|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. I thank Denis \textsc{Bitouzé} 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
@@ -2186,6 +2212,12 @@
 not make the TOC empty. \etoc always executes the \csb{etocaftertochook}
 command; and the test for emptiness itself executes everything else found in
 the |.toc| file. See \autoref{sec:addingtotoc} in this context.
+\begin{enumerate}
+\item the \csb{etocifwasempty} command discussed below can be used from inside
+\csb{etocaftertochook}.
+\item there is no \csa{etocdoesnotcheckemptiness} but if there was one
+it would do |\makeatletter\Etoc at checksemptinessfalse\makeatother|.
+\end{enumerate}
 
 The suppression of the heading (more precisely of the toc display style
 elements) may be effective only for the final \LaTeX{} runs. For example in
@@ -2334,15 +2366,19 @@
 class commands.}   The original was invisibly defined with a label at the
 beginning of \autoref{part:globalcmds}.
 \begin{verbatim}
+\begingroup % to keep in particular toc=left with local effect
 \KOMAoptions{toc=left}
 \etocstandarddisplaystyle % necessary for the display to obey toc=left
 \etocstandardlines
 \tableofcontents \ref{toc:globalcmds}
+\endgroup
 \end{verbatim}
+\begingroup
 \KOMAoptions{toc=left}
 \etocstandarddisplaystyle
 \etocstandardlines
 \tableofcontents \ref{toc:globalcmds}
+\endgroup
 
 \section{Another compatibility mode}\label{sec:anothercompat}
 
@@ -4133,7 +4169,7 @@
 \label{etocpage}
 
 Let us explain how \etoc was used to produce the table of
-contents displayed at the beginning of this second part.
+contents displayed at the beginning of this \autoref{part:linestyles}.
 This
 is a local table of contents, and we used the command \localtoc.
 
@@ -6722,7 +6758,7 @@
   typeset, this could break the correct restoring of the |tocdepth| counter
   after the TOC. Starting with |1.08h|, the |tocdepth| counter is modified
   only at the time the TOC is typeset, not earlier, thus fixing that
-  issue.\footnote{Thanks to D.B. for signaling the problem.}
+  issue.\footnote{Thanks to Denis \textsc{Bitouzé} for signaling the problem.}
 \end{otherlanguage}
 
 \subsection{Die hyperref"=Option \emph{bookmarksdepth}}
@@ -6752,7 +6788,7 @@
 \label{etocsettocdepth.toc}
 
 Dieser Befehl \csb{etocsettocdepth.toc} implementiert einige Funktionalitäten
-von Paket |tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. Ich danke D.B.
+von Paket |tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. Ich danke Denis \textsc{Bitouzé}
   meine Aufmerksamkeit auf die Inkompatibilität dieses Pakets mit \etoc
   gerichtet zu haben.}. Dieses Paket war inkompatibel mit \etoc. Es kann nun
 noch für seine mit |secnumdepth| in Verbindung stehenden Befehle genutzt werden,
@@ -6904,6 +6940,12 @@
 not make the TOC empty. \etoc always executes the \csb{etocaftertochook}
 command; and the test for emptiness itself executes everything else found in
 the |.toc| file. See \autoref{sec:addingtotoc} in this context.
+\begin{enumerate}
+\item the \csb{etocifwasempty} command discussed below can be used from inside
+\csb{etocaftertochook}.
+\item there is no \csa{etocdoesnotcheckemptiness} but if there was one
+it would do |\makeatletter\Etoc at checksemptinessfalse\makeatother|.
+\end{enumerate}
 
 The suppression of the heading (more precisely of the toc display style
 elements) may be effective only for the final \LaTeX{} runs. For example in
@@ -7049,15 +7091,19 @@
 unsichtbar und wurde am Anfang von \autoref{part:globalcmds} definiert,
 wobei es mit einem Label versehen wurde. 
 \begin{verbatim}
+\begingroup % to keep in particular toc=left with local effect
 \KOMAoptions{toc=left}
 \etocstandarddisplaystyle % wird benötigt, damit toc=left gilt
 \etocstandardlines
 \tableofcontents \ref{toc:globalcmds}
+\endgroup
 \end{verbatim}
+\begingroup
 \KOMAoptions{toc=left}
 \etocstandarddisplaystyle
 \etocstandardlines
 \tableofcontents \ref{toc:globalcmds}
+\endgroup
 
 \section{Ein weiterer Kompatibilitätsmodus}\label{sec:anothercompat}
 
@@ -8809,9 +8855,9 @@
 \label{etocpage}
 
 Hier soll erläutert werden, wie \etoc\ dazu verwendet wurde, das
-Inhaltsverzeichnis am Beginn des zweiten Teils zu erstellen. Es handelt sich
-dabei um ein lokales Inhaltsverzeichnis, weshalb der Befehl \localtoc\ verwendet
-wurde.
+Inhaltsverzeichnis am Beginn dieses \autoref{part:linestyles}s zu erstellen.
+Es handelt sich dabei um ein lokales Inhaltsverzeichnis, weshalb der Befehl
+\localtoc\ verwendet wurde.
 
 Wir müssen hierbei unterscheiden zwischen den Linienstilen (\emph{line styles})
 und dem Ausgabestil (\emph{toc display style}). Die \emph{line styles} erhält
@@ -10625,12 +10671,37 @@
 
 \begin{multicols}{2}
 \begin{jfverbatim}
-v1.08h [2016/09/25]^
+v1.08i [2016/09/29]^
 
+   This fixes an issue dating back to 1.08e-2015/04/17: under
+   \etocchecksemptiness regime, some circumstances (such as
+   adding to an already compiled document a \localtableofcontents
+   before the main \tableofcontents) created an "Undefined
+   control sequence \Etoc at localtop" error. Thanks to Denis Bitouzé
+   for reporting the problem.
+
+   On this occasion, \etocdoesnotcheckemptiness
+   has been added to unset the flag.
+
+   A rather more exotic issue was fixed: the emptiness check for
+   local tocs could get confused if the tocdepth counter was varying
+   in some specific ways from inside the toc file.
+
+   After adding to a document a \localtableofcontents, two LaTeX
+   passes are needed for etoc to get a chance to print the
+   correct local contents. Formerly, etoc issued a Warning on
+   the first pass; it now also induces LaTeX into
+   announcing "There were undefined references", as this is nearer
+   to the end of the log file and console output.
+
+
+~v1.08h [2016/09/25]^
+
    New functioning of \etocsetnexttocdepth: the tocdepth counter is
    modified only at the time of the table of contents, not before.
-   This fixes an issue which arose when \etocsetnexttocdepth was used
-   multiple times with no intervening table of contents.
+   This fixes an issue which arose when \etocsetnexttocdepth was
+   used multiple times with no intervening table of contents.
+   Thanks to Denis Bitouzé for reporting the problem.
 
    The PDF documentation includes about 25 LaTeX code snippets also
    as file attachment annotations, additionally to their verbatim
@@ -11104,9 +11175,10 @@
 \newif\ifEtoc at mustclosegroup
 \newif\ifEtoc at emptytoc     % 1.08e
 \newif\ifEtoc at checksemptiness % 1.08e. Default is 'no checks'.
-\newcommand*\etocchecksemptiness {\Etoc at checksemptinesstrue }
+\def\etocchecksemptiness       {\Etoc at checksemptinesstrue }
+\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }% 1.08i
 \newif\ifEtoc at notocifnotoc % 1.08e
-\newcommand*\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
+\def\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
 \def\etoc@{\etoc@}
 %    \end{macrocode}
 % |1.07g| uses a second counter; this could be avoided, but ok, let's not be
@@ -11214,14 +11286,16 @@
 % The first two parameters of |\Etoc at et@hop| are exchanged in |1.08|
 % compared to earlier versions; this is in relation to changes done in
 % |\Etoc at etoccontentsline|.
+% 
+% |1.08i| as a |fourorthree| rather than as formerly a |sixorfive|.
 %    \begin{macrocode}
 \AtBeginDocument{%
 \@ifpackageloaded{parskip}{\Etoc at parskiptrue}{}%
 \@ifpackageloaded{hyperref}{\Etoc at hyperreftrue
                             \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
-                            \long\def\Etoc at gobblesixorfive#1#2#3#4#5#6{}}
+                            \long\def\Etoc at gobblefourorthree#1#2#3#4{}}
                            {\def\Etoc at et@hop#1#2#3#4{#2{#3}{#4}#1}%
-                            \long\def\Etoc at gobblesixorfive#1#2#3#4#5{}}%
+                            \long\def\Etoc at gobblefourorthree#1#2#3{}}%
 }
 %    \end{macrocode}
 % |2015/03/08| One has to be careful about the |Etoc at end@<level>| user
@@ -11369,34 +11443,57 @@
 % sets it for example to be |\Etoc at section@@| which has been let by
 % |\etocsetlevel| to |\@ne|, thus is always self-terminating in
 % |\ifnum..\fi| contexts.
+%
+% |1.08i-2016/09/29| makes some changes in the organization of the
+% conditionals. It could happen in certain special circumstances (created by
+% that part in |\Etoc at localtableofcontents| which is executed after the test
+% of emptiness) that |\Etoc at localtop| was still undefined. Earlier version of
+% the code was a bit lazy and did not avoid some unneeded |\ifnum| with
+% |\Etoc at localtop| in context where the flag |\ifEtoc at stoptoc| was |\iftrue|;
+% this was not an issue when code was first written, |\Etoc at localtop| was
+% always initialized back then. But the code in |\Etoc at localtableofcontents|
+% handling local TOCs with unrecognized ids would call execution of the |.toc|
+% file under some special context with flag |\ifEtoc at stoptoc| artificially set
+% to true. If |\Etoc at localtop| had not been initialized an undefined control
+% sequence error would occur. Furthermore as |\ifEtoc at notactive| was also set
+% to true, the case of no error lead then to unneededly expand|\Etoc at setflags|
+% code slowing down compilation.
+%
+% Also |1.08i| splits the macro into two, with accompanying slight
+% refactoring. I had such problems with the behaviour of TeX booleans in
+% 2011/12 that I got excessively cautious then, and was using an |\Etoc at next|
+% for the |\Etoc at setflags| rather than leaving it like here deep inside
+% conditional branches.
 %    \begin{macrocode}
 \def\Etoc at etoccontentsline #1{%
   \global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
   \Etoc at skipthisonefalse
-  \ifnum\Etoc at level=\Etoc@@six@@
-      \Etoc at skipthisonetrue
+  \ifnum\Etoc at level=\Etoc@@six@@\Etoc at skipthisonetrue
   \else
-    \ifEtoc at localtoc
-      \let\Etoc at next\relax
-      \ifEtoc at stoptoc 
-        \Etoc at skipthisonetrue 
+   \ifEtoc at localtoc
+    \ifEtoc at stoptoc\Etoc at skipthisonetrue
+    \else
+     \ifEtoc at notactive\Etoc at setflags\Etoc at skipthisonetrue
+     \else
+      \ifnum\Etoc at level<\Etoc at localtop\Etoc at skipthisonetrue
+       \global\Etoc at stoptoctrue
       \fi
-      \ifnum\Etoc at level<\Etoc at localtop 
-        \def\Etoc at next{\global\Etoc at stoptoctrue}%
-        \Etoc at skipthisonetrue
-      \fi
-      \ifEtoc at notactive
-        \def\Etoc at next{\Etoc at setflags}%
-        \Etoc at skipthisonetrue
-      \fi
-      \Etoc at next
+     \fi
     \fi
+   \fi
   \fi
-  \let\Etoc at next\Etoc at gobblesixorfive
-  \ifnum\c at tocdepth<\Etoc at level 
-  \else 
-  \ifEtoc at skipthisone
-  \else
+  \let\Etoc at next\Etoc at gobblefourorthree
+  \ifEtoc at skipthisone\else
+   \ifnum\c at tocdepth<\Etoc at level\else
+    \ifEtoc at standard
+      \let\Etoc at next\Etoc at savedcontentsline
+    \else
+      \let\Etoc at next\Etoc at etoccontentsline@
+    \fi
+   \fi
+  \fi
+  \Etoc at next {#1}%
+}
 %    \end{macrocode}
 % |1.08| New way to handle the compatibility mode. One has to worry
 % only for the local tables of contents (in inactive state, which still
@@ -11403,21 +11500,20 @@
 % must be parsed for global level flags) but in this case
 % |\Etoc at setflags| was done above already. Earlier method proceeded with
 % dummy empty line styles.
-%    \begin{macrocode}
-  \ifEtoc at standard\let\Etoc at next\@thirdofthree
-  \else
-%    \end{macrocode}
+%
 % |2015/03/08| Ever since the first release of \etoc, the code has
 % to be careful that the |\Etoc at end@<level>| user defined macros may
 % close groups. This is the reason why some assignments have to be done
 % globally. The |\let\Etoc at next\Etoc at gobblesixorfive| above could be
 % local, because it is used only in case the stuff below is skipped,
-% inclusive of |\Etoc at doends| which may close groups.
+% inclusive of |\Etoc at doends| which may close groups. (code has changed since,
+% slightly).
 %
 % Versions |1.08| extracts to a separate macro |\Etoc at doends|. Earlier code
 % did |\global\let\Etoc at next\relax| but we can now give a default |\relax|
 % value to |\Etoc at next| with no need of a |\global| prefix.
 %    \begin{macrocode}
+\def\Etoc at etoccontentsline@ #1{%
     \Etoc at doends
 %    \end{macrocode}
 % |1.08| the |\Etoc at next| will (possibly) execute the |begin| code,
@@ -11455,7 +11551,6 @@
     \fi
     \Etoc at setflags
     \Etoc at next
-    \let\Etoc at next\@empty
 %    \end{macrocode}
 % |1.08|:
 % \begin{enumerate}
@@ -11474,14 +11569,14 @@
 % 
 % \item adds the |\Etoc at global| prefix.
 % \end{enumerate}
+% |1.08i| uses an |\edef| rather than |\def| with a chain of |\expandafter|.
 %    \begin{macrocode}
-    \Etoc at global\expandafter\def\expandafter\Etoc at prefix\expandafter
-        {\csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
-    \Etoc at global\expandafter\def\expandafter\Etoc at contents\expandafter
-        {\csname Etoc at contents@\csname Etoc@#1@\endcsname\endcsname }%
+    \Etoc at global\edef\Etoc at prefix  {\expandafter\noexpand
+         \csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
+    \Etoc at global\edef\Etoc at contents{\expandafter\noexpand
+         \csname Etoc at contents@\csname Etoc@#1@\endcsname\endcsname }%
     \ifEtoc at skipprefix \Etoc at global\let\Etoc at prefix\@empty\fi
     \global\Etoc at skipprefixfalse
-  \fi\fi\fi
 %    \end{macrocode}
 % |1.08| modifies the ending to not use the |\Etoc at swa| and |\Etoc at swb|
 % things. With this version, the |\Etoc at next| here is only to gobble
@@ -11500,8 +11595,7 @@
 % put into doing only expandable things after expansion of the
 % \meta{prefix} and \meta{contents} parts of a sectioning unit style.
 %    \begin{macrocode}
-  \Etoc at next
-  \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
+    \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
 }
 %    \end{macrocode}
 % |2013/03/07|: up to |1.06| \etoc defined only \csa{etocname}, \csa{etocnumber} and
@@ -11811,7 +11905,9 @@
 % could be faster than an |\ifnum|, it adds to it as long as the local toc id
 % is not yet found.
 %
-% I replace (|1.08e|) the |\Etoc at global|'s for |\Etoc at localtop| by |\global|'s.
+% I replace (|1.08e|) the |\Etoc at global|'s for |\Etoc at localtop| by
+% |\global|'s. The |\relax| is needed because |#2| may sometimes be a count,
+% sometimes tokens.
 %    \begin{macrocode}
 \def\etoc@@startlocaltoc#1#2{%
     \ifEtoc at localtoc 
@@ -11863,20 +11959,41 @@
 % possibility should not be supported anymore. This allowed to remove a few
 % tokens from \csa{Etoc at tableofcontents} as well. And it also allowed
 % improvements to \csa{Etoc at localtableofcontents}.
+%
+% Note: (|1.08i 2016/09/29|) the code has to handle both local and total toc.
+% Hence the flag |\ifEtoc at notactive| has to be set prior to it. For a global
+% toc, the |\Etoc at tocid| was set to |\z@|, and the |\ifnum| in
+% |\etoc at startlocaltoc| did always fail, but I now prefer to simply nullify
+% the |\etoc at startlocaltoc|. As its default fallback is |\@gobble| I simply
+% test here for the |localtoc| flag. The |\Etoc at tocid| will be undefined for a
+% global toc but it is not tested anymore.
+%
+% Note: the mechanism for recognizing the level when a local toc is
+% encountered is different from the one in |\etoc@@startlocaltoc| which uses
+% the level flags. Here we just record in |\Etoc at level| where we last stood.
+% The initialization |\global\let\Etoc at level\Etoc at minf| is thus needed in case
+% the |.toc| file contains an |\etoc at startlocaltoc| before any
+% |\contentsline|.
+%
+% |1.08i| has two |testingcontentsline| macros, one for local, one for global.
 %    \begin{macrocode}
 \def\Etoc at setemptytocbool {%
+    \global\Etoc at emptytoctrue
     \global\Etoc at stoptocfalse
-    \global\Etoc at emptytoctrue
     \global\let\Etoc at level\Etoc at minf
     \begingroup
-      \def\etoc at startlocaltoc##1{%
+      \ifEtoc at localtoc
+        \def\etoc at startlocaltoc##1{%
           \ifnum##1=\Etoc at tocid\relax
               \global\let\Etoc at localtop\Etoc at level
               \global\Etoc at notactivefalse
           \fi }%
-      \let\contentsline\Etoc at testingcontentsline
+        \let\contentsline\Etoc at testingcontentslinelocal
+      \else
+        \let\contentsline\Etoc at testingcontentsline
+      \fi
       \Etoc at storetocdepth
-      \the\Etoc at toctoks
+        \the\Etoc at toctoks
       \Etoc at resettocdepth
     \endgroup
 }
@@ -11884,22 +12001,38 @@
   {\ifEtoc at emptytoc\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi }
 \expandafter
 \let\expandafter\etocxifwasempty\csname etocifwasempty \endcsname
-\def\Etoc at testingcontentsline #1{%
-  \ifEtoc at stoptoc
-  \else
-  \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@
-  \else
+\def\Etoc at testingcontentslinelocal #1{%
+  \ifEtoc at stoptoc\else\ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else
     \global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
-    \ifEtoc at notactive
-    \else
-    \ifnum\Etoc at level>\c at tocdepth
-    \else
+%    \end{macrocode}
+% |\ifEtoc at notactive| set to False by |\etoc at startlocaltoc| with right id. It
+% that happened, check level of hit against unit. Will decide if empty or not.
+% Set |stoptoc| flag afterwards in all cases. |\Etoc at localtop| will have been
+% initialized by |\etoc@@startlocaltoc| as |\ifEtoc at notactive| flag can be
+% false only then.
+%    \begin{macrocode}
+    \ifEtoc at notactive\else
+     \ifnum\Etoc at level>\Etoc at localtop
+      \ifnum\Etoc at level>\c at tocdepth\else
+        \global\Etoc at emptytocfalse
+        \global\Etoc at stoptoctrue
+      \fi
+     \else
       \global\Etoc at stoptoctrue
-      \ifnum\Etoc at level>\Etoc at localtop\global\Etoc at emptytocfalse\fi
-    \fi\fi
+     \fi
+    \fi
   \fi\fi
-  \Etoc at gobblesixorfive\relax\relax\relax
+  \Etoc at gobblefourorthree\relax
 }
+\def\Etoc at testingcontentsline #1{%
+  \ifEtoc at stoptoc\else
+   \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else
+    \ifnum\csname Etoc@#1@@\endcsname>\c at tocdepth\else
+       \global\Etoc at emptytocfalse
+       \global\Etoc at stoptoctrue
+  \fi\fi\fi
+  \Etoc at gobblefourorthree\relax
+}
 %    \end{macrocode}
 % |1.07g| suppresses the printing of |--unknown etoc ref: run latex again--| as
 % sometimes one uses \csa{localtableofcontents} to prepare something else, and one
@@ -11934,7 +12067,8 @@
 % \toc|\ref{foo}|; the latter could so far possibly refer to a local or also to
 % a global table of contents but release |1.08e| has deprecated the latter use
 % as it complicated the code, for something truly silly. Thus |\ref{foo}| must
-% now be with |foo| a label of a local TOC.
+% now be with |foo| a label of a local TOC. As a result |\Etoc at tocwithid| is
+% less used now.
 %
 % In the case of a |\ref|ed-to toc whose label was just added hence is not yet
 % in the |.aux| file, |\Etoc at tocid| is |0|. \etoc used to issue a warning to
@@ -11955,28 +12089,55 @@
 % not found in the |.toc| file we can assume it definitely has to be a local
 % TOC needing more compilations. The emptiness status is undecided, the code
 % declares the TOC non empty.
+%
+% |1.08i-2016/09/29| now does |\Etoc at localtoctrue| right at the start (the
+% earlier code could have to handle table of contents which were actually
+% global, via the |\label/\ref| mechanism.) It does not rely on the |\ifnum|
+% automatically false in |\etoc@@startlocaltoc| due to the special values |0|
+% or |\z@| for |\Etoc at tocid|, but simply leaves |\etoc at startlocaltoc| to its
+% default |\@gobble|. The |\Etoc at emptytocfalse| flag is upfront in case some
+% code using |\etocifwasempty| is in user hooks. The default is to assume the
+% TOC non-empty as its contents are actually still unknown. Under the
+% |stoptoc| flag, the |\Etoc at etoccontentsline| is more efficient now.
+%
+% The |\Etoc at notactive| flag needs to be set before calling
+% |\Etoc at setemptytocbool|.
+%
+% I hesitated with |1.08i| to write something to aux file in order to let
+% \LaTeX\ prompt the user for extra pass, after insertion of some new
+% |\localtableofcontents|, but finally I prefer to only trick \LaTeX\ into
+% telling about undefined references. The first solution has the advantage
+% that at least in Emacs/AUCTeX the |C-cC-c| will propose |LaTeX|, not |View|.
+% But perhaps some automated scripts checking |aux| file will not like the
+% extra line which is then removed in next pass, and could possibly do one
+% extra unneeded compilation to check |aux| file remains identical. Hence the
+% second approach. Earlier I did only a |\PackageWarning| but this does not
+% output a message near the end of the log file or console output.
 %    \begin{macrocode}
 \def\Etoc at localtableofcontents#1{%
+    \Etoc at localtoctrue
+    \global\Etoc at emptytocfalse
     \edef\Etoc at tocid{#1}%
-    \global\Etoc at emptytocfalse
     \ifnum\Etoc at tocid<\@ne
-      \PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% 
-      % versions < 1.08e did not do any printing, 1.08e prints the toc heading.
-      \global\Etoc at notactivetrue
+      %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% 
+      \setbox0\hbox{\ref{etoc-ref \@secondoftwo#1: run LaTeX again!}}%
+      %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
       \global\Etoc at stoptoctrue % do only heading
-      \Etoc at localtoctrue % needed for stoptoc obedience
       \Etoc at tableofcontents
       \expandafter\Etoc at gobbletoetoc@ % skip all the rest
     \fi
     \global\Etoc at notactivetrue
+%    \end{macrocode}
+% |1.08i|'s |\Etoc at setemptytocbool| now checks |localtoc| flag.
+%    \begin{macrocode}
     \ifEtoc at checksemptiness \Etoc at setemptytocbool \fi
     \ifEtoc at emptytoc
        \ifEtoc at notactive
-         \PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}% 
-         % emptiness undecided. Declare it non empty. 
-         \global\Etoc at emptytocfalse
-         \global\Etoc at stoptoctrue % do only heading
-         \Etoc at localtoctrue 
+         %\PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}% 
+         \setbox0\hbox{\ref{etoc-id \number\Etoc at tocid: run LaTeX again!}}%
+         %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
+         \global\Etoc at emptytocfalse % assume real one will be non-empty
+         \global\Etoc at stoptoctrue   % and print only heading for this pass
          \Etoc at tableofcontents
          \expandafter\expandafter\expandafter\Etoc at gobbletoetoc@
        \else
@@ -11983,7 +12144,6 @@
        %%  \PackageWarning{etoc}{This toc is apparently empty}% 
        \fi
     \else
-       \Etoc at localtoctrue
        \global\Etoc at stoptocfalse
        \global\Etoc at notactivetrue
        \global\let\Etoc at localtop\Etoc@@minustwo@@
@@ -12021,34 +12181,33 @@
 %    \begin{macrocode}
 \def\Etoc at dothis #1#2\etoc@ {\fi #1}
 \def\Etoc at t@bleofcontents{%
-    \ifx\Etoc at nexttoken\label
-       \Etoc at dothis{\expandafter\Etoc at label\@gobble}%
-    \fi
-    \ifx\Etoc at nexttoken\@sptoken
-       \Etoc at dothis{\Etoc at again}%
-    \fi
-    \ifx\Etoc at nexttoken\ref
-       \Etoc at dothis{\Etoc at tocwithidfalse\expandafter\Etoc at ref\@gobble}%
-    \fi
-    \ifEtoc at tocwithid
-       \Etoc at dothis{\Etoc at localtableofcontents{\c at etoc@tocid}}%
-    \fi
-    \global\Etoc at notactivefalse
-    \global\Etoc at emptytocfalse
-    \ifEtoc at checksemptiness
-        \let\Etoc at tocid\z@
-        \global\let\Etoc at localtop\Etoc at minf
-        \Etoc at setemptytocbool
-    \fi
-    \ifEtoc at emptytoc
-      \ifEtoc at notocifnotoc\else
-        \Etoc at localtocfalse
-        \Etoc at tableofcontents
-      \fi
-    \else
-        \Etoc at localtocfalse
-        \Etoc at tableofcontents
-    \fi
+    \ifx\Etoc at nexttoken\label\Etoc at dothis{\expandafter\Etoc at label\@gobble}\fi
+    \ifx\Etoc at nexttoken\@sptoken\Etoc at dothis{\Etoc at again}\fi
+%    \end{macrocode}
+% |\Etoc at ref| will hand over directly to |\Etoc at localtableofcontents|.
+% Argument will be (or rather expand to) zero if the reference is non-existent
+% yet. There was an |\Etoc at tocwithidfalse| flag which |1.08i| suppresses as it
+% is not used afterwards (since |1.08e| I think.)
+%    \begin{macrocode}
+    \ifx\Etoc at nexttoken\ref\Etoc at dothis{\expandafter\Etoc at ref\@gobble}\fi
+%    \end{macrocode}
+% Flag to check if we were called from a |\localtableofcontents|.
+%    \begin{macrocode}
+    \ifEtoc at tocwithid\Etoc at dothis{\Etoc at localtableofcontents{\c at etoc@tocid}}\fi
+%    \end{macrocode}
+% From now on we are handling a global TOC. Earlier, I used the trick of
+% setting |\Etoc at tocid| to |\z@| for compatibility with expansion of
+% |\etoc at startlocaltoc|. But since |1.08i| |\etoc at startlocaltoc| is left to be
+% |\@gobble|, and |\Etoc at tocid| is never tested. We don't need to set the
+% |notactive| flag as now |\Etoc at testingcontentsline| tests first the
+% |localtoc| flag (was already the case of |\Etoc at etoccontentsline|). I change
+% a bit the style of conditionals here for clarity of code.
+%    \begin{macrocode}
+    \global\Etoc at emptytocfalse\ifEtoc at checksemptiness\Etoc at setemptytocbool\fi
+    \ifEtoc at emptytoc\ifEtoc at notocifnotoc
+       \expandafter\expandafter\expandafter\@gobble
+    \fi\fi
+    \Etoc at tableofcontents
     \endgroup\ifEtoc at mustclosegroup\endgroup\fi
     \Etoc at tocdepthreset % 1.07h, renamed 1.08h
     \etocaftertochook   % 1.07g 
@@ -12062,6 +12221,10 @@
 % polyglossia or babel), one can not rely on |\arabic| having its default
 % definition. As the number written here will be used later in an \csa{ifnum}, I
 % should not have used it in the first place (done |2015/03/30|).
+%
+% |1.08i| moves elsewhere definition of |\etoc at startlocaltoc|. In
+% |\Etoc at table@fcontents| case it remains to be seen if a |\ref| follows which
+% could turn the TOC into a local one. Handled by |\Etoc at t@bleofcontents|.
 %    \begin{macrocode}
 \def\Etoc at table@fcontents{%
     \refstepcounter{etoc at tocid}% 
@@ -12081,6 +12244,10 @@
 %    \begin{macrocode}
 \let\etocaftertitlehook    \@empty
 \let\etocaftercontentshook \@empty
+%    \end{macrocode}
+% Attention that there could be a |\ref| following, thus we don't yet know
+% whether this is a local or global table of contents.
+%    \begin{macrocode}
 \def\etoctableofcontents{%
    \Etoc at openouttoc
    \Etoc at tocdepthset % new with 1.08h
@@ -12094,7 +12261,10 @@
 %    \begin{macrocode}
       \let\tof at begingroup\@empty
       \let\tof at endgroup  \@empty
-      \def\etoc at startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c at etoc@tocid}}%
+%    \end{macrocode}
+% |1.08i| removes definition of |\etoc at startlocaltoc| from here. It is done
+% in |\Etoc at localtableofcontents| or uses its default of |\@gobble|.
+%    \begin{macrocode}
       \@ifstar
       {\def\Etoc at aftertitlehook{}\Etoc at table@fcontents}
       {\let\Etoc at aftertitlehook\etocaftertitlehook\Etoc at table@fcontents}}
@@ -13018,7 +13188,7 @@
   Grave accent  \`     Left brace    \{     Vertical bar  \|
   Right brace   \}     Tilde         \~}
 
-\CheckSum{3169}
+\CheckSum{3200}% 2^7 times 5^2 not bad.
 
 \csname check at checksum\endcsname
 \Finale

Modified: trunk/Master/texmf-dist/source/latex/etoc/etoc.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/etoc/etoc.ins	2016-09-29 20:34:14 UTC (rev 42181)
+++ trunk/Master/texmf-dist/source/latex/etoc/etoc.ins	2016-09-29 20:34:36 UTC (rev 42182)
@@ -1,6 +1,6 @@
 %%
 %% Package: etoc
-%% Version: 1.08h-2016/09/25
+%% Version: 1.08i-2016/09/29
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2016 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -8,9 +8,9 @@
 %%                         <Christine_Roemer at t-online dot de>
 %% and collaborators for the translation into German of the documentation
 %%
-\def\etocpkgdate        {2016/09/25}
-\def\etocdocdate        {2016/09/25}
-\def\etocpkgversion     {v1.08h}
+\def\etocpkgdate        {2016/09/29}
+\def\etocdocdate        {2016/09/29}
+\def\etocpkgversion     {v1.08i}
 \def\etocpkgdescription {Completely customisable TOCs (JFB)}
 %% Run etex on this file to extract from etoc.dtx:
 %%        etoc.sty, etoc.tex, etoc-DE.tex and README.md
@@ -22,8 +22,8 @@
 %%  - with or without source code,
 %%  - with dvipdfmx or with latex/pdflatex.
 %%
-%% Release 1.08h sets pdflatex as default in etoc.tex (prior it was
-%% latex+dvipdfmx as it produces smaller PDFs) in order to allow
+%% Since release 1.08h pdflatex is the default in etoc.tex (prior it
+%% was latex+dvipdfmx as it produces smaller PDFs) in order to allow
 %% inclusion via the use of package `attachfile` of about 25 code
 %% samples as file attachment annotations.
 %%

Modified: trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty	2016-09-29 20:34:14 UTC (rev 42181)
+++ trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty	2016-09-29 20:34:36 UTC (rev 42182)
@@ -23,10 +23,10 @@
 %%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{etoc}
- [2016/09/25 v1.08h Completely customisable TOCs (JFB)]
+ [2016/09/29 v1.08i Completely customisable TOCs (JFB)]
 %%
 %% Package: etoc
-%% Version: 1.08h-2016/09/25
+%% Version: 1.08i-2016/09/29
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2016 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -67,9 +67,10 @@
 \newif\ifEtoc at mustclosegroup
 \newif\ifEtoc at emptytoc     % 1.08e
 \newif\ifEtoc at checksemptiness % 1.08e. Default is 'no checks'.
-\newcommand*\etocchecksemptiness {\Etoc at checksemptinesstrue }
+\def\etocchecksemptiness       {\Etoc at checksemptinesstrue }
+\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }% 1.08i
 \newif\ifEtoc at notocifnotoc % 1.08e
-\newcommand*\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
+\def\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
 \def\etoc@{\etoc@}
 \newcounter{etoc at tocid}
 \newcounter{etoc at tocdepth}% 1.07g
@@ -155,9 +156,9 @@
 \@ifpackageloaded{parskip}{\Etoc at parskiptrue}{}%
 \@ifpackageloaded{hyperref}{\Etoc at hyperreftrue
                             \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
-                            \long\def\Etoc at gobblesixorfive#1#2#3#4#5#6{}}
+                            \long\def\Etoc at gobblefourorthree#1#2#3#4{}}
                            {\def\Etoc at et@hop#1#2#3#4{#2{#3}{#4}#1}%
-                            \long\def\Etoc at gobblesixorfive#1#2#3#4#5{}}%
+                            \long\def\Etoc at gobblefourorthree#1#2#3{}}%
 }
 \def\Etoc at setflags {%
   \ifcase \Etoc at level
@@ -239,32 +240,33 @@
 \def\Etoc at etoccontentsline #1{%
   \global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
   \Etoc at skipthisonefalse
-  \ifnum\Etoc at level=\Etoc@@six@@
-      \Etoc at skipthisonetrue
+  \ifnum\Etoc at level=\Etoc@@six@@\Etoc at skipthisonetrue
   \else
-    \ifEtoc at localtoc
-      \let\Etoc at next\relax
-      \ifEtoc at stoptoc
-        \Etoc at skipthisonetrue
+   \ifEtoc at localtoc
+    \ifEtoc at stoptoc\Etoc at skipthisonetrue
+    \else
+     \ifEtoc at notactive\Etoc at setflags\Etoc at skipthisonetrue
+     \else
+      \ifnum\Etoc at level<\Etoc at localtop\Etoc at skipthisonetrue
+       \global\Etoc at stoptoctrue
       \fi
-      \ifnum\Etoc at level<\Etoc at localtop
-        \def\Etoc at next{\global\Etoc at stoptoctrue}%
-        \Etoc at skipthisonetrue
-      \fi
-      \ifEtoc at notactive
-        \def\Etoc at next{\Etoc at setflags}%
-        \Etoc at skipthisonetrue
-      \fi
-      \Etoc at next
+     \fi
     \fi
+   \fi
   \fi
-  \let\Etoc at next\Etoc at gobblesixorfive
-  \ifnum\c at tocdepth<\Etoc at level
-  \else
-  \ifEtoc at skipthisone
-  \else
-  \ifEtoc at standard\let\Etoc at next\@thirdofthree
-  \else
+  \let\Etoc at next\Etoc at gobblefourorthree
+  \ifEtoc at skipthisone\else
+   \ifnum\c at tocdepth<\Etoc at level\else
+    \ifEtoc at standard
+      \let\Etoc at next\Etoc at savedcontentsline
+    \else
+      \let\Etoc at next\Etoc at etoccontentsline@
+    \fi
+   \fi
+  \fi
+  \Etoc at next {#1}%
+}
+\def\Etoc at etoccontentsline@ #1{%
     \Etoc at doends
     \let\Etoc at next\@empty
     \Etoc at global\Etoc at isfirstfalse
@@ -289,16 +291,13 @@
     \fi
     \Etoc at setflags
     \Etoc at next
-    \let\Etoc at next\@empty
-    \Etoc at global\expandafter\def\expandafter\Etoc at prefix\expandafter
-        {\csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
-    \Etoc at global\expandafter\def\expandafter\Etoc at contents\expandafter
-        {\csname Etoc at contents@\csname Etoc@#1@\endcsname\endcsname }%
+    \Etoc at global\edef\Etoc at prefix  {\expandafter\noexpand
+         \csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
+    \Etoc at global\edef\Etoc at contents{\expandafter\noexpand
+         \csname Etoc at contents@\csname Etoc@#1@\endcsname\endcsname }%
     \ifEtoc at skipprefix \Etoc at global\let\Etoc at prefix\@empty\fi
     \global\Etoc at skipprefixfalse
-  \fi\fi\fi
-  \Etoc at next
-  \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
+    \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
 }
 \def\Etoc at lxyz #1#2{%
     \Etoc at global\@namedef {etoclink }{\leavevmode}%        fall-back
@@ -522,18 +521,22 @@
 }
 \let\etoc at startlocaltoc\@gobble
 \def\Etoc at setemptytocbool {%
+    \global\Etoc at emptytoctrue
     \global\Etoc at stoptocfalse
-    \global\Etoc at emptytoctrue
     \global\let\Etoc at level\Etoc at minf
     \begingroup
-      \def\etoc at startlocaltoc##1{%
+      \ifEtoc at localtoc
+        \def\etoc at startlocaltoc##1{%
           \ifnum##1=\Etoc at tocid\relax
               \global\let\Etoc at localtop\Etoc at level
               \global\Etoc at notactivefalse
           \fi }%
-      \let\contentsline\Etoc at testingcontentsline
+        \let\contentsline\Etoc at testingcontentslinelocal
+      \else
+        \let\contentsline\Etoc at testingcontentsline
+      \fi
       \Etoc at storetocdepth
-      \the\Etoc at toctoks
+        \the\Etoc at toctoks
       \Etoc at resettocdepth
     \endgroup
 }
@@ -541,31 +544,40 @@
   {\ifEtoc at emptytoc\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi }
 \expandafter
 \let\expandafter\etocxifwasempty\csname etocifwasempty \endcsname
-\def\Etoc at testingcontentsline #1{%
-  \ifEtoc at stoptoc
-  \else
-  \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@
-  \else
+\def\Etoc at testingcontentslinelocal #1{%
+  \ifEtoc at stoptoc\else\ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else
     \global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
-    \ifEtoc at notactive
-    \else
-    \ifnum\Etoc at level>\c at tocdepth
-    \else
+    \ifEtoc at notactive\else
+     \ifnum\Etoc at level>\Etoc at localtop
+      \ifnum\Etoc at level>\c at tocdepth\else
+        \global\Etoc at emptytocfalse
+        \global\Etoc at stoptoctrue
+      \fi
+     \else
       \global\Etoc at stoptoctrue
-      \ifnum\Etoc at level>\Etoc at localtop\global\Etoc at emptytocfalse\fi
-    \fi\fi
+     \fi
+    \fi
   \fi\fi
-  \Etoc at gobblesixorfive\relax\relax\relax
+  \Etoc at gobblefourorthree\relax
 }
+\def\Etoc at testingcontentsline #1{%
+  \ifEtoc at stoptoc\else
+   \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else
+    \ifnum\csname Etoc@#1@@\endcsname>\c at tocdepth\else
+       \global\Etoc at emptytocfalse
+       \global\Etoc at stoptoctrue
+  \fi\fi\fi
+  \Etoc at gobblefourorthree\relax
+}
 \def\Etoc at localtableofcontents#1{%
+    \Etoc at localtoctrue
+    \global\Etoc at emptytocfalse
     \edef\Etoc at tocid{#1}%
-    \global\Etoc at emptytocfalse
     \ifnum\Etoc at tocid<\@ne
-      \PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}%
-      % versions < 1.08e did not do any printing, 1.08e prints the toc heading.
-      \global\Etoc at notactivetrue
+      %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}%
+      \setbox0\hbox{\ref{etoc-ref \@secondoftwo#1: run LaTeX again!}}%
+      %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
       \global\Etoc at stoptoctrue % do only heading
-      \Etoc at localtoctrue % needed for stoptoc obedience
       \Etoc at tableofcontents
       \expandafter\Etoc at gobbletoetoc@ % skip all the rest
     \fi
@@ -573,11 +585,11 @@
     \ifEtoc at checksemptiness \Etoc at setemptytocbool \fi
     \ifEtoc at emptytoc
        \ifEtoc at notactive
-         \PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}%
-         % emptiness undecided. Declare it non empty.
-         \global\Etoc at emptytocfalse
-         \global\Etoc at stoptoctrue % do only heading
-         \Etoc at localtoctrue
+         %\PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}%
+         \setbox0\hbox{\ref{etoc-id \number\Etoc at tocid: run LaTeX again!}}%
+         %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
+         \global\Etoc at emptytocfalse % assume real one will be non-empty
+         \global\Etoc at stoptoctrue   % and print only heading for this pass
          \Etoc at tableofcontents
          \expandafter\expandafter\expandafter\Etoc at gobbletoetoc@
        \else
@@ -584,7 +596,6 @@
        %%  \PackageWarning{etoc}{This toc is apparently empty}%
        \fi
     \else
-       \Etoc at localtoctrue
        \global\Etoc at stoptocfalse
        \global\Etoc at notactivetrue
        \global\let\Etoc at localtop\Etoc@@minustwo@@
@@ -604,34 +615,15 @@
 \@firstofone{\def\Etoc at again} {\futurelet\Etoc at nexttoken\Etoc at t@bleofcontents}
 \def\Etoc at dothis #1#2\etoc@ {\fi #1}
 \def\Etoc at t@bleofcontents{%
-    \ifx\Etoc at nexttoken\label
-       \Etoc at dothis{\expandafter\Etoc at label\@gobble}%
-    \fi
-    \ifx\Etoc at nexttoken\@sptoken
-       \Etoc at dothis{\Etoc at again}%
-    \fi
-    \ifx\Etoc at nexttoken\ref
-       \Etoc at dothis{\Etoc at tocwithidfalse\expandafter\Etoc at ref\@gobble}%
-    \fi
-    \ifEtoc at tocwithid
-       \Etoc at dothis{\Etoc at localtableofcontents{\c at etoc@tocid}}%
-    \fi
-    \global\Etoc at notactivefalse
-    \global\Etoc at emptytocfalse
-    \ifEtoc at checksemptiness
-        \let\Etoc at tocid\z@
-        \global\let\Etoc at localtop\Etoc at minf
-        \Etoc at setemptytocbool
-    \fi
-    \ifEtoc at emptytoc
-      \ifEtoc at notocifnotoc\else
-        \Etoc at localtocfalse
-        \Etoc at tableofcontents
-      \fi
-    \else
-        \Etoc at localtocfalse
-        \Etoc at tableofcontents
-    \fi
+    \ifx\Etoc at nexttoken\label\Etoc at dothis{\expandafter\Etoc at label\@gobble}\fi
+    \ifx\Etoc at nexttoken\@sptoken\Etoc at dothis{\Etoc at again}\fi
+    \ifx\Etoc at nexttoken\ref\Etoc at dothis{\expandafter\Etoc at ref\@gobble}\fi
+    \ifEtoc at tocwithid\Etoc at dothis{\Etoc at localtableofcontents{\c at etoc@tocid}}\fi
+    \global\Etoc at emptytocfalse\ifEtoc at checksemptiness\Etoc at setemptytocbool\fi
+    \ifEtoc at emptytoc\ifEtoc at notocifnotoc
+       \expandafter\expandafter\expandafter\@gobble
+    \fi\fi
+    \Etoc at tableofcontents
     \endgroup\ifEtoc at mustclosegroup\endgroup\fi
     \Etoc at tocdepthreset % 1.07h, renamed 1.08h
     \etocaftertochook   % 1.07g
@@ -654,7 +646,6 @@
    \begingroup % closed in \Etoc at t@bleofcontents or \Etoc at localtableofcontents
       \let\tof at begingroup\@empty
       \let\tof at endgroup  \@empty
-      \def\etoc at startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c at etoc@tocid}}%
       \@ifstar
       {\def\Etoc at aftertitlehook{}\Etoc at table@fcontents}
       {\let\Etoc at aftertitlehook\etocaftertitlehook\Etoc at table@fcontents}}



More information about the tex-live-commits mailing list