From d8e47184a9a1a04b1aa016bb4a56d066b8940805 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Tue, 22 Nov 2022 03:01:53 +0000
Subject: CTAN sync 202211220301

---
 macros/latex/contrib/etoc/etoc.dtx | 807 +++++++++++++++++++++----------------
 1 file changed, 450 insertions(+), 357 deletions(-)

(limited to 'macros/latex/contrib/etoc/etoc.dtx')

diff --git a/macros/latex/contrib/etoc/etoc.dtx b/macros/latex/contrib/etoc/etoc.dtx
index 4563c21dc9..5e19538d9f 100644
--- a/macros/latex/contrib/etoc/etoc.dtx
+++ b/macros/latex/contrib/etoc/etoc.dtx
@@ -2,20 +2,20 @@
 % 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: <20-11-2022 at 21:44:51 CET>}%
+\def\etocdtxtimestamp {Time-stamp: <21-11-2022 at 19:35:48 CET>}%
 %</none>
 %<*!readme>
 %%
 %% Package: etoc
-%% Version: 1.09h
+%% Version: 1.09i
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2022 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
 %</!readme>
 %<*none>
-\def\etocpkgdate        {2022/11/20}
-\def\etocdocdate        {2022/11/20}
-\def\etocpkgversion     {1.09h}
+\def\etocpkgdate        {2022/11/21}
+\def\etocdocdate        {2022/11/21}
+\def\etocpkgversion     {1.09i}
 \def\etocpkgdescription {Completely customisable TOCs (JFB)}
 %% German translation was last udpated on April 2015 and all new material
 %% was included since in English.  During 2020/2021/2022 emerged a still
@@ -33,7 +33,7 @@
     \catcode32=13\catcode`\\=12^^Brelax^^A
 ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
 {% Package: etoc
-% Version: 1.09h
+% Version: 1.09i
 % License: LPPL 1.3c
 % Copyright (C) 2012-2022 Jean-Francois Burnol <jfbu at free dot fr>
 %
@@ -60,7 +60,7 @@
 %<*readme>
 <!-- -->
 
-    Source:  etoc.dtx (1.09h)
+    Source:  etoc.dtx (1.09i)
     Author:  Jean-Francois Burnol
     Info:    Completely customisable TOCs
     License: LPPL 1.3c
@@ -157,6 +157,15 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi.
 RECENT CHANGES
 ==============
 
+1.09i \[2022/11/21\]
+--------------------
+
+Fix bug showing when a document uses both `\etocchecksemptiness` and
+`\etocsetlocaltop.toc`: the `start` and `finish` parts of some levels
+were executed possibly causing extra printed output.
+
+More hyperlinking in the implementation part of the documentation.
+
 1.09h \[2022/11/20\]
 --------------------
 
@@ -948,14 +957,13 @@ pdfstartview=FitH,%
 %                          }}%
 % \makeatother
 
-\def\csbi#1{\hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ #1}}
-
 % use a slightly different colour for second half?
+% MEMO: we can change \ttfamily as hyperref uses a scope limiting group.
 \DeclareRobustCommand\csb[1]{%
-        \edef\nbmoitie{\the\numexpr\xintLength{#1}/2}%
+    \edef\nbmoitie{\the\numexpr\xintLength{#1}/2}%
+    \ifcsname r@#1\endcsname
         \hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ \xintKeepUnbraced{\nbmoitie}{#1}}%
         \ifcsname r@etocmacro-#1\endcsname
-          %\marginsourcelink{#1}%
           \hyperref[etocmacro-#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}%
         \else
           % for .toc suffixed macros
@@ -966,6 +974,9 @@ pdfstartview=FitH,%
             \hyperref[#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}%
           \fi
         \fi
+    \else
+        \textcolor{red}{\ttfamily\hyphenchar\font45 \char`\\ #1}%
+    \fi
 }
 
 \DeclareRobustCommand\csa [1]
@@ -1159,11 +1170,21 @@ etoc-im-me-di-ate-set-local-top
 \colorlet{etocsnippet}{blue}
 \newcommand\marginattach[1]{% #1 is from some legacy mark-up and is ignored
   \noindent Depending on your PDF viewer\normalmarginpar
+% syntaxe pénible n'y-a-t-il pas un moyen plus commode
+% j'hésite à tester \value{page}
   \marginpar
-  {%
+  [% left
+   {\hfill
    \textattachfile[description={in section \the\value{section}}]%
                   {etocsnippet-\snippetno.tex}%
                   {\textcolor{etocsnippet}{etocsnippet-\snippetno.tex}}%
+   }%
+  ]%
+  {% right
+   \textattachfile[description={in section \the\value{section}}]%
+                  {etocsnippet-\snippetno.tex}%
+                  {\textcolor{etocsnippet}{etocsnippet-\snippetno.tex}}%
+   \hfill
   },
   clicking on the margin filename may allow to extract it.%
   \stepcounter{snippet}%
@@ -1189,8 +1210,14 @@ etoc-im-me-di-ate-set-local-top
 %%%  \ifnum\value{snippet}>0 -\@Alph{\numexpr\value{snippet}+\@ne\relax}\fi
 }
 \makeatother
-
-\begin{document}%\layout
+%\usepackage{layout}
+
+\usepackage{ragged2e}
+\begin{document}%\normalmarginpar\layout %marginparwidth is 96pt
+%\normalmarginpar\marginparwidth72bp% keep 96pt for etocsnippet-XX.tex filenames
+% will set to 72bp for the two margin notes at start of code comments
+% but let's reduce from the 12pt margin parsep
+\marginparsep 6bp
 \rmfamily
 \thispagestyle{empty}
 
@@ -1493,7 +1520,7 @@ filename itself, placed in the page margin.
 \colorlet{macrocodenewmacrocolor}{verbcolor}
 \colorlet{macrocodelinktouserdoccolor}{etocnamecolor}% and bold face
 \colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face
-\colorlet{macrocodelinktocodelinecolor}{DarkBlue}
+\colorlet{macrocodelinktocodelinecolor}{Blue}
 \colorlet{macrocodenoncscolor}{Green}
 
 %\ifnum\NoSourceCode=0
@@ -2067,7 +2094,7 @@ breaks. Also, they do not worry about potential multi-column use.
 % Je sépare les macros les plus essentielles pour les mettre en avant
 
 \begin{framed}\multicolsep0pt\relax
-  \begin{multicols}{3}\parindent0pt\relax\let\csb\csb
+  \begin{multicols}{3}\parindent0pt\relax
 \flushleft
     \csb{tableofcontents}\par
     (optional \csa{ref} or \csa{label})\par
@@ -2094,7 +2121,7 @@ breaks. Also, they do not worry about potential multi-column use.
 
 %\parshape 1 -1.5cm \dimexpr\linewidth+3cm\relax
 %\begin{minipage}{\dimexpr\linewidth+3cm\relax}
-\begin{multicols}{2}\parindent0pt\relax\let\csb\csb
+\begin{multicols}{2}\parindent0pt\relax
   \csb{etocaftercontentshook}\par
   \csb{etocaftertitlehook}\par
   \csb{etocaftertochook}\par
@@ -2176,7 +2203,7 @@ here.
 \label{localtableofcontents}
 \label{localtableofcontentswithrelativedepth}
 
-\begin{description}\let\csb\csb
+\begin{description}
 \item[\toc] can be used arbitrarily many times in the document. Styling either
   globally the TOC or its individual entries is customizable at any time in
   the document.
@@ -2816,7 +2843,6 @@ automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline}
 etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... macros as
 they were at the time the TOC is typeset.
 
-%\showthe\catcode`\-
 \begin{filecontentshere}{etocsnippet-\snippetno.tex}
 \makeatletter
 \newcommand{\MyStandardTOC}{%
@@ -2841,7 +2867,6 @@ they were at the time the TOC is typeset.
 \makeatother
 \end{filecontentshere}
 \marginattach{-A}
-%\showthe\catcode`\-
 
 One can add to the above arbitrary text formatting commands, for example
 replace |\etocpage| by |\textcolor{blue}{\etocpage}|.
@@ -6314,10 +6339,6 @@ given toc entry). For example, the tables of contents of the present document
 are all fully linked. It doesn't matter whether \etoc or \ctanpkg{hyperref} is loaded
 first.
 
-% \typeout{ICI}
-% \showhyphens{Compatibility}
-% [] \T1/txss/m/n/10.95 Com-pat-i-bil-ity
-
 % 2015/11/12
 % Pour une raison que j'ignore dans la TOC principale j'ai un problème avec
 % cette sous-section.
@@ -6437,7 +6458,7 @@ contents will be displayed only on the second compilation.
 
 \clearpage
 \etocdepthtag.toc {code}
-
+\normalmarginpar\marginparwidth72bp
 \part{The code}
 
 \localtableofcontents
@@ -6555,7 +6576,15 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
 \def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x
 \makeatother
 \begin{jfverbatim}
-1.09h [2022/11/20]^
+1.09i [2022/11/21]^
+
+   Fix bug showing when a document uses both \etocchecksemptiness and
+   \etocsetlocaltop.toc: the start and finish parts of some levels were
+   executed possibly causing extra printed output.
+
+   More hyperlinking in the implementation part of the documentation.
+
+~1.09h [2022/11/20]^
 
    Documentation improvements.  In particular, attached code snippets
    are now visible via their filenames in the page margins.  Also,
@@ -7350,64 +7379,102 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
 
 \makeatother
 
-Control sequences are mostly hyperlinks.  When a user level command is
-defined it hyperlinks to the user documentation with
-\textbf{\textcolor{macrocodelinktouserdoccolor}{this colour}} (and bold
-face); for other macro definitions
-\textbf{\textcolor{macrocodenewmacrocolor}{this colour}} is used, and
-bold face.  It is not an hyperlink then.  When a previously defined
-macro is used it uses \textcolor{macrocodelinktocodelinecolor}{this
-  colour} and is then an hyperlink to the macro definition in the source
-code.  Comments have been configured
-\textcolor{macrocodecommentcolor}{to be rendered in their own colour},
-and \textcolor{macrocodenoncscolor}{non commented-out and non-control
-  sequences tokens use this colour}.  Other tokens use the fall-back
-normal colour.
-
-Warning: the code author's brain reboots frequently, and more and more often.
+Control\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight
+  The ``syntax highlighting'' was added at release 1.09f of 2022/08/30.\par}
+sequences are mostly hyperlinks.  When a user level command gets defined it
+hyperlinks to the user documentation with bold face and
+\textbf{\textcolor{macrocodelinktouserdoccolor}{using this colour}}.  Further
+instances if they occur will use \textcolor{macrocodelinktocodelinecolor}{this
+  colour} to link to their place of first definition.  The latter applies also
+to non-user level macros.  And such non-user level macros, at the location of
+their first definitions will have their names displayed using bold face and
+\textbf{\textcolor{macrocodenewmacrocolor}{this colour}} and there is no
+hyperlink then. Comments belonging to the code source have been configured
+\textcolor{macrocodecommentcolor}{to be rendered in their own colour}, and
+\textcolor{macrocodenoncscolor}{non commented-out and non-control sequences
+  tokens use this colour}.  Other tokens use the fall-back normal colour.
+
+Further, when a package macro is mentioned in code comments it also hyperlinks
+to the location of its first definition using
+{\textcolor{macrocodelinktocodelinecolor}{this colour}} (user level commands
+do not link back to the user manual, but they link to their place of first
+macro definition, which is the one hyperlinking to the relevant user manual
+section).  Sometimes however the location of first definition is disappointing
+as it may basically be provisory.  Or the macro is in fact re-defined during
+execution of other macros.  Besides, some macros are defined using
+|\csname...\endcsname| constructs (typically things defined with |part|,
+|chapter|, |section| etc... in their names) and thus can not be detected by
+the syntax highlighting automatization.
+
+% will be used in code comments
+% I could re-define \csb, but perhaps better as the mark-up is not yet there
+% when I define this to opt for a new name
+\DeclareRobustCommand\csbc[1]{{\hypersetup{linkcolor=macrocodelinktocodelinecolor}%
+    \ifcsname r@etocmacro-#1\endcsname
+       \hyperref[etocmacro-#1]{\ttfamily\hyphenchar\font45 \char`\\ #1}%
+    \else
+       % for .toc suffixed macros
+       \ifcsname r@etocmacro-\xintTrimUnbraced{-4}{#1}\endcsname
+          \hyperref[etocmacro-\xintTrimUnbraced{-4}{#1}]
+                   {\ttfamily\hyphenchar\font45 \char`\\ #1}%
+       \else
+          \textcolor{red}{\ttfamily\hyphenchar\font45 \char`\\ #1}%
+       \fi
+    \fi }%
+}
+
+Warning: the author's brain reboots frequently, and more and more often.
 Hence most comments are not for the general reader, they are for the author
 himself and they document more the history of the package than its actual
 functioning, because the historical evolution is the way the author can
 remember and understand the code.  There are a few precious isolated
-paragraphs which may prove vaguely useful to people not the author.
-
-\etoc,\marginpar{\footnotesize\rmfamily\itshape\raggedright This
-  paragraph and the next were added very late in the history of the package, at
-  1.09h.\par}  when not left in compatibility mode, hijacks the \cs{contentsline}
-expansion so as to not execute \cs{l@chapter}, \cs{l@section} etc..., but
-rather (via \cs{Etoc@lxyz}), to parse the data and extract from it the name,
-number and page number.  Indeed, for legacy reasons the \LaTeX{} |.toc| data
-is \emph{not structured}, but incorporates already to some extent typesetting
-macros.  This part of \etoc maneuvers is fragile as 1) it requires the |.toc|
-file to be built from \cs{contentsline} entries, and 2) of course it will be
-easily broken by changes to how data is stored there.  Fortunately this
-happens rarely.  The |7.00u| release of \ctanpkg{hyperref} was such an instance.
-
-The other
-core part of \etoc present from day one of the package is that
-it creates (but only virtually, and dynamically, not statically) a tree-like
+paragraphs which may prove vaguely useful to people who are not the author.
+
+\etoc,\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight
+  This paragraph and the next were added very late in the history of the
+  package, at 1.09h.\par} when not left in compatibility mode, hijacks the
+\csa{contentsline} expansion so as to not execute \csa{l@chapter},
+\csa{l@section} etc..., but use \csbc{Etoc@lxyz}, which will parse the data and
+extract from it the name, number and page number.  Indeed, for legacy reasons
+the \LaTeX{} |.toc| data is \emph{not structured}, but already to some extent
+oriented towards typesetting tasks, in an already pre-decided orderly manner.
+This part of \etoc maneuvers is fragile as 1) it requires the |.toc| file to
+be built from \csa{contentsline} entries, and 2) and relies on
+\csa{contentsline} to hand over the job to \csa{l@chapter}, \csa{l@section},
+etc... macros.  Of course \etoc can be easily broken if changes happen to how
+data is stored there, in particular to how the text (which in \etoc lingua is
+called the \emph{name}) and the number (this one is called by us also
+\emph{number}) are put together. Things would have been much easier for \etoc
+in 2012 if the \csa{contentsline} arguments separated text (name) and number;
+unfortunately some mix is prepared, which may depend on the document class
+also, and typically handles \csa{part} levels very differently (and with more
+hard-coded stuff).  Anyway, fortunately upstream changes happen rarely.  The
+|7.00u| release of \ctanpkg{hyperref} was such an instance.
+
+The other core part of \etoc present from day one of the package is that it
+creates (but only virtually, and dynamically, not statically) a tree-like
 structure of the sectioning levels present in the |.toc| file.  It could be
 fun to actually implement officially such a tree (where the children of a
 sectioning title are the sectioning levels at a greater depth such as
 subsections versus a section).  Let us recall that \LaTeX{} provides zero
-means to know from a subsection for example, what is the title of the section containing
-it, or chapter, or part.  To do this one has to create a really structured
-document which neither core \LaTeX{} nor the main document classes do.  This
-remark was given for document body, but it also applies to |.toc| data.  But
-\etoc adds at least some kind of follow-up to the successive encountered
-sectioning titles, and is thus able, to ``on-the-fly'' add some kind of
-structure and follow the succession of levels.  Ultimately this is why the
-\cs{etocsetstyle} offers \marg{start} and \marg{finish} parts in additions to
-\marg{contents} (which I divided into a \marg{prefix} and a \marg{contents}).
-At some point one could imagine that a really \emph{structured} document (in
-opposition to what core \LaTeX{} from thirty years ago up to nowadays has to
-offer) would store in the |.toc| data directly a tree structure, where each
-node would have attributes name, number, page number, completely separated
-from any typesetting.  Once this exists then basically \etoc disappears.  In
-brief, once \etoc ideas will have permeated the society, it will disappear as
-its was born only to palliate the absence of real structure in the |.toc| file
-(absence inherited from the absence of real structure in a \LaTeX{} document
-body).
+means to know from a subsection for example, what is the title of the section
+containing it, or chapter, or part.  To do this one has to create a really
+structured document which neither core \LaTeX{} nor the main document classes
+do.  This remark was given for document body, but it also applies to |.toc|
+data.  But \etoc adds at least some kind of follow-up to the successive
+encountered sectioning titles, and is thus able, to ``on-the-fly'' add some
+kind of structure and follow the succession of levels.  Ultimately this is why
+the \csbc{etocsetstyle} offers \marg{start} and \marg{finish} parts in
+additions to \marg{contents} (which I divided into a \marg{prefix} and a
+\marg{contents}).  At some point one could imagine that a really
+\emph{structured} document (in opposition to what core \LaTeX{} from thirty
+years ago up to nowadays realizes) would store in the |.toc| data directly a
+tree structure, where each node would have attributes name, number, page
+number, completely separated from any typesetting.  Once this exists then
+basically \etoc disappears.  In brief, once \etoc ideas will have permeated
+the society, it will disappear as its was born only to palliate the absence of
+real structure in the |.toc| file (which is sort of inherited from the absence
+of real structure in a \LaTeX{} document body).
 
 %  9 avril 2015 (1.08d) pour forcer indentation après macrocode
 % par un effet particulier si avant macrocode un enumerate, inefficient,
@@ -7453,13 +7520,13 @@ body).
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{etoc}
-[2022/11/20 v1.09h Completely customisable TOCs (JFB)]
+[2022/11/21 v1.09i Completely customisable TOCs (JFB)]
 \RequirePackage{multicol}
 \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
 \ProcessOptions\relax
 %    \end{macrocode}
 % |1.08| suppresses |\ifEtoc@part| and defines |\ifEtoc@skipprefix|. It
-% also defines |\etocglobaldefs|, |\etoclocaldefs| and |\Etoc@global|.
+% also defines \csbc{etocglobaldefs}, \csbc{etoclocaldefs} and \csbc{Etoc@global}.
 %    \begin{macrocode}
 \newtoks\Etoc@toctoks
 \def\Etoc@par{\par}
@@ -7467,7 +7534,7 @@ body).
 \let\etocnopar\etocinline
 \def\etocdisplay{\def\Etoc@par{\par}}% 1.07m 2015/01/23
 %    \end{macrocode}
-% |\etocglobaldefs| should be used only for special things such as TOC as a
+% \csbc{etocglobaldefs} should be used only for special things such as TOC as a
 % table; it should be put in a group to limit its scope. If used in the
 % preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is loaded too.
 %    \begin{macrocode}
@@ -7550,17 +7617,17 @@ body).
 \let\Etoc@all@@   \Etoc@@five@@
 \let\Etoc@none@@  \Etoc@minf
 %    \end{macrocode}
-% Versions earlier than |1.08| did |\Etoc@newlevel| in a quite
+% Versions earlier than |1.08| did \csbc{Etoc@newlevel} in a quite
 % embarrassing way with an |\edef|.
 %
-% |1.08f|'s \csa{etocsetlevel} avoids multiple insertions of the same level
-% in the \csa{Etoc@levellist} list.
+% |1.08f|'s \csbc{etocsetlevel} avoids multiple insertions of the same level
+% in the \csbc{Etoc@levellist} list.
 %
-% |1.08k| modified \csa{Etoc@newlevel}: formerly a token |\l@#1| was stored in
+% |1.08k| modified \csbc{Etoc@newlevel}: formerly a token |\l@#1| was stored in
 % place of braced name |{#1}|. This changed is to facilitate creation of the
-% |\etocsavedsectiontocline| etc... macros later on, at each TOC. But the
+% \csa{etocsavedsectiontocline} etc... type macros later on, at each TOC. But the
 % stored |#1| is not expanded immediately, although it is in other parts of
-% \csa{etocsetlevel}, which may cause timing problems if |#1| is a macro.
+% \csbc{etocsetlevel}, which may cause timing problems if |#1| is a macro.
 %    \begin{macrocode}
 \let\Etoc@levellist\@empty
 \def\Etoc@newlevel #1{\expandafter\def\expandafter\Etoc@levellist\expandafter
@@ -7613,14 +7680,14 @@ body).
 \etocsetlevel{paragraph}{4}
 \etocsetlevel{subparagraph}{5}
 %    \end{macrocode}
-% The first two parameters of |\Etoc@et@hop| are exchanged in |1.08|
+% The first two parameters of \csbc{Etoc@et@hop} are exchanged in |1.08|
 % compared to earlier versions; this is in relation to changes done in
-% |\Etoc@etoccontentsline|.
+% \csbc{Etoc@etoccontentsline}.
 %
 % |1.08i 2016/09/29| has a |fourorthree| rather than as formerly a |sixorfive|.
 %
 % \LaTeX\ of November 2021 will have its |\contentsline| always grab four
-% arguments. So we must adjust |\Etoc@et@hop| et al., else usage of \etoc
+% arguments. So we must adjust \csbc{Etoc@et@hop} et al., else usage of \etoc
 % without hyperref will be broken. Done at |1.09e 2021/09/23|.
 %
 %^^A Side note to myself: I see there is now a |\@gobblethree| in latex.ltx and
@@ -7687,7 +7754,14 @@ body).
     \def\Etoc@et@hop#1#2#3#4{#2{#3}{#4}#1}%
     \long\def\Etoc@gobblefourorthree#1#2#3{}%
    }%
-\@ifl@t@r\fmtversion{2021/11/15}%
+%    \end{macrocode}
+% Until |1.09i| the date threshold was erroneously set to 2021/11/15.
+% In practice this meant that for some version of \LaTeX{} \etoc was
+% a bit sloppy and left some empty brace pairs |{}|, which however
+% could possibly impact I think only TOCs executed in math mode... not
+% very frequent!
+%    \begin{macrocode}
+\@ifl@t@r\fmtversion{2020/10/01}%
    {%
     \def\Etoc@et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
     \let\Etoc@gobblefourorthree\@gobblefour
@@ -7699,11 +7773,11 @@ body).
 % defined macros which may close groups. This has always been the reason
 % for the |\global|'s here and elsewhere.
 %
-% |1.08| uses |\Etoc@level| rather than a |#1| which used to be anyhow always
-% the |\Etoc@tmp|. Now |\Etoc@level| is what was called formerly |\Etoc@tmp|
-% in |\Etoc@etoccontentsline|.
+% |1.08| uses \csbc{Etoc@level} rather than a |#1| which used to be anyhow always
+% the |\Etoc@tmp|. Now \csbc{Etoc@level} is what was called formerly |\Etoc@tmp|
+% in \csbc{Etoc@etoccontentsline}.
 %
-% Attention that |\Etoc@setflags| must not modify |\Etoc@next|!
+% Attention that \csbc{Etoc@setflags} must not modify |\Etoc@next|!
 %    \begin{macrocode}
 \def\Etoc@setflags {%
     \ifcase \Etoc@level
@@ -7749,10 +7823,10 @@ body).
     \fi
 }
 %    \end{macrocode}
-% |1.08| This was originally in |\Etoc@etoccontentsline|, intermixed
-% with the definitions of |\Etoc@contents| and |\Etoc@prefix|. Separated
+% |1.08| This was originally in \csbc{Etoc@etoccontentsline}, intermixed
+% with the definitions of \csbc{Etoc@contents} and \csbc{Etoc@prefix}. Separated
 % here for clarity of code. One has to be careful that this may close
-% groups. The conditionals are all global. The |\Etoc@level| has been
+% groups. The conditionals are all global. The \csbc{Etoc@level} has been
 % |\global\let| to a |\chardef| variable. The final |\else| of the
 % |\ifcase| assumes none of the |\Etoc@end@..| routines modify it,
 % naturally.
@@ -7793,15 +7867,15 @@ body).
 }
 %    \end{macrocode}
 % |1.08| the |\Etoc@next| will (possibly) execute the |begin| code,
-% \emph{before} |\Etoc@contents| and |\Etoc@prefix| get defined,
+% \emph{before} \csbc{Etoc@contents} and \csbc{Etoc@prefix} get defined,
 % contrarily to what I did in earlier versions. I still reset the flags
 % before execution of the |begin| codes (although the flags are not
 % supposed to be used therein anyhow).
 %
-% Also the \meta{begin} code does |\Etoc@isfirsttrue|.
+% Also the \meta{begin} code does \csa{Etoc@isfirsttrue}.
 %
-% |1.08k| This was originally in |\Etoc@etoccontentsline|. Extracted for
-% re-use by |\etocsetlocaltop.toc|. Calls |\Etoc@setflags| which must not
+% |1.08k| This was originally in \csbc{Etoc@etoccontentsline}. Extracted for
+% re-use by \csbc{etocsetlocaltop.toc}. Calls \csbc{Etoc@setflags} which must not
 % modify |\Etoc@next|.
 %    \begin{macrocode}
 \def\Etoc@dobegins{%
@@ -7863,17 +7937,17 @@ body).
 % |\contentsline {<unit>}...| instructions, with
 % the standard meaning of executing |\l@unit| (the hyperref
 % modifications are taken into account). It is the various |\l@unit|'s
-% which are (locally) |\let| to |\Etoc@lxyz| and it is |\Etoc@lxyz|
+% which are (locally) |\let| to \csbc{Etoc@lxyz} and it is \csbc{Etoc@lxyz}
 % which does the parsing of the arguments in order to extract name,
 % number and page number. Once they are obtained, via the execution of
 % this indirectly hacked |\contentsline|, the code executes the
-% |\Etoc@prefix| and |\Etoc@contents| corresponding to that unit level,
-% according to the user |\etocsetstyle| declarations. Before that the
+% \csbc{Etoc@prefix} and \csbc{Etoc@contents} corresponding to that unit level,
+% according to the user \csbc{etocsetstyle} declarations. Before that the
 % begin part is executed when \etoc first encounters that level
 % coming from a higher one and the end part will be executed when
 % hitting a more important level.
 %
-% |\etocskipfirstprefix| was already part of the very first release of
+% \csbc{etocskipfirstprefix} was already part of the very first release of
 % \etoc. Up to |1.07n| it was just an elegant |\@thirdofthree| possibly
 % executed just before a |\@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}|
 % line. But this made it impossible for me to execute things after the
@@ -7882,53 +7956,53 @@ body).
 % Executing stuff before |begin| is now a potential problem because the user
 % can close some group in the |begin| code (this was in fact impossible in
 % versions |<1.08| because this would have erased the definitions of
-% |\Etoc@contents| and |\Etoc@prefix|). Thus I am not so free now to define
+% \csbc{Etoc@contents} and \csbc{Etoc@prefix}). Thus I am not so free now to define
 % things before execution of begin, if I allow people to close a group
 % therein, except if I make them global.
 %
-% The mechanism of |\etocskipfirstprefix| made it impossible to add
+% The mechanism of \csbc{etocskipfirstprefix} made it impossible to add
 % anything at the end of the |begin| codes. Thus I changed it in |1.08|
 % to simply work with a (global) boolean flag. This gives user the
-% freedom to use |\etocskipfirstprefix| anywhere in the |begin| code and
-% it made room for a delimited macro I called |\etoconlyonfirst|. But
-% then I dropped it in favor of definition of the |\etociffirst|
+% freedom to use \csbc{etocskipfirstprefix} anywhere in the |begin| code and
+% it made room for a delimited macro I called \csa{etoconlyonfirst}. But
+% then I dropped it in favor of definition of the \csbc{etociffirst}
 % conditional.
 %
-% Macros |\Etoc@swa| and |\Etoc@swb| which did the |\Etoc@et@hop| thing have
+% Macros |\Etoc@swa| and |\Etoc@swb| which did the \csbc{Etoc@et@hop} thing have
 % been suppressed, their effect is incorporated to the end of
-% |\Etoc@etoccontentsline|.
+% \csbc{Etoc@etoccontentsline}.
 %    \begin{macrocode}
 \def\etocskipfirstprefix {\global\Etoc@skipprefixtrue }
 %    \end{macrocode}
-% |2015/03/08| let's record that |\Etoc@level| used to be called
+% |2015/03/08| let's record that \csbc{Etoc@level} used to be called
 % |\Etoc@tmp| in versions earlier than |1.08| (and |\Etoc@tmp| is used
-% in the completely different ulterior |\Etoc@lxyz| context). The code
-% sets it for example to be |\Etoc@section@@| which has been let by
-% |\etocsetlevel| to |\@ne|, thus is always self-terminating in
+% in the completely different ulterior \csbc{Etoc@lxyz} context). The code
+% sets it for example to be \csa{Etoc@section@@} which has been let by
+% \csbc{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@localtableofcontents| which is executed after the test
-% of emptiness) that |\Etoc@localtop| was still undefined. Earlier version of
+% that part in \csbc{Etoc@localtableofcontents} which is executed after the test
+% of emptiness) that \csa{Etoc@localtop} was still undefined. Earlier version of
 % the code was a bit lazy and did not avoid some unneeded |\ifnum| with
-% |\Etoc@localtop| in context where the flag |\ifEtoc@stoptoc| was |\iftrue|;
-% this was not an issue when code was first written, |\Etoc@localtop| was
-% always initialized back then. But the code in |\Etoc@localtableofcontents|
+% \csa{Etoc@localtop} in context where the flag \csbc{ifEtoc@stoptoc} was |\iftrue|;
+% this was not an issue when code was first written, \csa{Etoc@localtop} was
+% always initialized back then. But the code in \csbc{Etoc@localtableofcontents}
 % handling local TOCs with unrecognized ids would call execution of the |.toc|
-% file under some special context with flag |\ifEtoc@stoptoc| artificially set
-% to true. If |\Etoc@localtop| had not been initialized an undefined control
+% file under some special context with flag \csbc{ifEtoc@stoptoc} artificially set
+% to true. If \csa{Etoc@localtop} had not been initialized an undefined control
 % sequence error would occur. Furthermore as |\ifEtoc@notactive| was also set
-% to true, the case of no error leads then to unneededly expand |\Etoc@setflags|
+% to true, the case of no error leads then to unneededly expand \csbc{Etoc@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@next|
-% for the |\Etoc@setflags| rather than leaving it like here deep inside
+% for the \csbc{Etoc@setflags} rather than leaving it like here deep inside
 % conditional branches.
 %
-% Attention! |1.09|'s \cs{etoclocaltop} is the former \cs{Etoc@localtop}
+% Attention! |1.09|'s \csbc{etoclocaltop} is the former \csa{Etoc@localtop}
 % \emph{minus one}. Hence some slight change in conditional here.
 %    \begin{macrocode}
 \def\Etoc@etoccontentsline #1{%
@@ -7969,7 +8043,7 @@ body).
 % |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
 % must be parsed for global level flags) but in this case
-% |\Etoc@setflags| was done above already. Earlier method proceeded with
+% \csbc{Etoc@setflags} was done above already. Earlier method proceeded with
 % dummy empty line styles.
 %
 % |2015/03/08| Ever since the first release of \etoc, the code has
@@ -7977,14 +8051,14 @@ body).
 % close groups. This is the reason why some assignments have to be done
 % globally. The |\let\Etoc@next\Etoc@gobblesixorfive| above could be
 % local, because it is used only in case the stuff below is skipped,
-% inclusive of |\Etoc@doends| which may close groups. (code has changed since,
+% inclusive of \csbc{Etoc@doends} which may close groups. (code has changed since,
 % slightly).
 %
-% |1.08| extracts to a separate macro |\Etoc@doends|. Earlier code
+% |1.08| extracts to a separate macro \csbc{Etoc@doends}. Earlier code
 % did |\global\let\Etoc@next\relax| but we can now give a default |\relax|
 % value to |\Etoc@next| with no need of a |\global| prefix.
 %
-% |1.08k| extracts |\Etoc@dobegins|.
+% |1.08k| extracts \csbc{Etoc@dobegins}.
 %    \begin{macrocode}
 \def\Etoc@etoccontentsline@ #1{%
     \Etoc@doends   % separated since 1.08
@@ -7992,20 +8066,20 @@ body).
 %    \end{macrocode}
 % |1.08|:
 % \begin{enumerate}
-% \item  separates the definition of |\Etoc@prefix| and
-% |\Etoc@contents| from the execution of the |end| parts. And it does
+% \item  separates the definition of \csbc{Etoc@prefix} and
+% \csbc{Etoc@contents} from the execution of the |end| parts. And it does
 % the definition with some |\csname|'s.
 %
-% \item implements |\etocskipfirstprefix| with a boolean, this is less slick
+% \item implements \csbc{etocskipfirstprefix} with a boolean, this is less slick
 % but more flexible than the earlier method.
 %
-% \item defines the |\etociffirst| conditional.
+% \item defines the \csbc{etociffirst} conditional.
 %
-% \item has |\Etoc@level| rather than |\Etoc@tmp| and thus we can dispense
+% \item has \csbc{Etoc@level} rather than |\Etoc@tmp| and thus we can dispense
 % with the |\ifEtoc@part| switch as we will be able to test the equality
-% |\Etoc@level=-1| inside of |\Etoc@lxyz|.
+% |\Etoc@level=-1| inside of \csbc{Etoc@lxyz}.
 %
-% \item adds the |\Etoc@global| prefix.
+% \item adds the \csbc{Etoc@global} prefix.
 % \end{enumerate}
 % |1.08i| uses an |\edef| rather than |\def| with a chain of |\expandafter|.
 %    \begin{macrocode}
@@ -8024,11 +8098,11 @@ body).
 % For the record we don't do |\csname l@#1\endcsname| mainly because
 % hyperref patches |\contentsline|.
 %
-% The location where |\Etoc@savedcontentsline| is |\let| to
+% The location where \csbc{Etoc@savedcontentsline} is |\let| to
 % |\contentsline| has been moved with release |1.08| to before the
-% title as set by |\etocsettoctyle|, thus it is now possible to open a
+% title as set by \csbc{etocsettocstyle}, thus it is now possible to open a
 % tabular in this part. And with the |\Etoc@global| prefix the user may
-% opt for global definitions of |\etocname| and the like, thus use
+% opt for global definitions of \csbc{etocname} and the like, thus use
 % freely |&| and other group closing things. Also, some care has been
 % put into doing only expandable things after expansion of the
 % \meta{prefix} and \meta{contents} parts of a sectioning unit
@@ -8036,7 +8110,7 @@ body).
 %
 % |1.09e| prepares for LaTeX November 2021 upcoming release
 % whose |\contentsline| will always grab four arguments whether or
-% not hyperref is loaded. The |\Etoc@et@hop| definition done at
+% not hyperref is loaded. The \csbc{Etoc@et@hop} definition done at
 % begin document must now swap the same number of arguments
 % whether or not hyperref is loaded (else \etoc would be broken in
 % absence of hyperref).
@@ -8046,59 +8120,59 @@ body).
 %    \end{macrocode}
 % START OF MAINLY OBSOLETE COMMENTS
 %
-% |2013/03/07|: up to |1.06| \etoc defined only \csa{etocname}, \csa{etocnumber} and
-% \csa{etocpage}. The \ctanpkg{hyperref} added data is recycled in the simplest
+% |2013/03/07|: up to |1.06| \etoc defined only \csbc{etocname}, \csbc{etocnumber} and
+% \csbc{etocpage}. The \ctanpkg{hyperref} added data is recycled in the simplest
 % manner, prefixing it with \csa{leavevmode}. The included
 % \csa{Hy@tocdestname} is (was, see below |1.07f| and |1.08a|) left
 % unexpanded. We have to spend some time with delimited macros to dis-entangle
 % the |.toc| data, and reconstruct the possible \ctanpkg{hyperref} data. If the page
-% number is not hyperlinked, \csa{etocpage} does \emph{not} add the link found
+% number is not hyperlinked, \csbc{etocpage} does \emph{not} add the link found
 % possibly in the name.
 %
-% |1.07| adds \csa{etocthename}, \csa{etocthenumber}, \csa{etocthepage} which
+% |1.07| adds \csbc{etocthename}, \csbc{etocthenumber}, \csbc{etocthepage} which
 % are left fragile and do not have the links data, and
-% \csa{etoclink}\marg{linkname} which is robust and reconstructs an
+% \csbc{etoclink}\marg{linkname} which is robust and reconstructs an
 % arbitrarily named link.
 %
 % A need (for things like building up a token list to be used in a
 % |tikzpicture|) arose later to have some form of the link which could be
 % saved by a simple command like one can do
 % |\global\let\lastname\etocthename|, and avoid having to manipulate
-% \csa{Hy@tocdestname}. So |1.07f| adds \csa{etocthelinkedname},
-% \csa{etocthelinkednumber}, \csa{etocthelinkedpage}, \csa{etocthelink}: they
+% \csa{Hy@tocdestname}. So |1.07f| adds \csbc{etocthelinkedname},
+% \csbc{etocthelinkednumber}, \csbc{etocthelinkedpage}, \csbc{etocthelink}: they
 % use \csa{hyperlink} with an expanded \csa{Hy@tocdestname}.
 %
-% |1.07f| also adds \csa{leavevmode} to \csa{etoclink} which
-% should have been done earlier, as it was included in \csa{etocname} etc...
+% |1.07f| also adds \csa{leavevmode} to \csbc{etoclink} which
+% should have been done earlier, as it was included in \csbc{etocname} etc...
 %  attention,  \csa{@namedef}|{A}{B}| and not \csa{@namedef}|{A} {B}| !!
 % on the other hand this gives a simple way to insert a space as the first
-% token in the paramaters. For \csa{Etoc@again} (which appears later in the
+% token in the paramaters. For \csbc{Etoc@again} (which appears later in the
 % code), a \csa{@firstofone} construct is however the simplest of all.
 %
 % END OF MAINLY OBSOLETE COMMENTS
 %
-% |1.08| adds |\Etoc@global| prefix (|2015/03/09|).
+% |1.08| adds \csbc{Etoc@global} prefix (|2015/03/09|).
 %
-% |1.08a| drops the original constructions of |\etocname| etc... The obvious
-% decision to convert \csa{etocname}, etc ... to be the robust versions of
-% \csa{etocthelinkedname}, etc ... was delayed two years
+% |1.08a| drops the original constructions of \csbc{etocname} etc... The obvious
+% decision to convert \csbc{etocname}, etc ... to be the robust versions of
+% \csbc{etocthelinkedname}, etc ... was delayed two years
 % (from |1.07f 2013/03/07| to |1.08a 2015/03/13|) for sentimental reason. But
 % the original
 % versions contained the hyperref destination only in unexpanded form, this
-% forced to use \csa{etocthelinkedname}, etc... in cases when the thing had to
+% forced to use \csbc{etocthelinkedname}, etc... in cases when the thing had to
 % be stored for delayed use. Now the user can do this directly with
-% \csa{etocname}, \csa{etocnumber}, \csa{etocpage} (taking into account though
+% \csbc{etocname}, \csbc{etocnumber}, \csbc{etocpage} (taking into account though
 % that these are robust macros, thus perhaps using something like |\LetLtxMacro|.)
 %
-% |1.08j| turns |\etoclink| into the robust version of |\etocthelink|. Indeed
-% so far only \csa{etocthelink} contained |\Hy@tocdestname| expanded. But
-% \csa{etoclink} did not, and thus it could not be used after a group was
+% |1.08j| turns \csbc{etoclink} into the robust version of \csbc{etocthelink}. Indeed
+% so far only \csbc{etocthelink} contained |\Hy@tocdestname| expanded. But
+% \csbc{etoclink} did not, and thus it could not be used after a group was
 % closed for example by a |&| from the sectioning style, even if having used
-% |\etocglobaldefs|.
+% \csbc{etocglobaldefs}.
 %
 % |1.08n| adds |\futurelet|-based methods to avoid unbracing things.
 %
-% |1.08p| uses |\Etoc@@getnb| (and |\Etoc@@getit|) to intercept cases
+% |1.08p| uses \csbc{Etoc@@getnb} (and \csbc{Etoc@@getit}) to intercept cases
 % when |\numberline| is hidden behind braces
 % (\url{https://github.com/ho-tex/hyperref/issues/65}).
 %    \begin{macrocode}
@@ -8123,20 +8197,20 @@ body).
     \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
     }
 %    \end{macrocode}
-% |1.08| adds the |\Etoc@global|'s.
+% |1.08| adds the \csbc{Etoc@global}'s.
 %
 % |1.08j| fixes an old |\ifx #1\hyperlink@start| bug.
 %
 % Potential (but rather exotic) brace removal problems avoided at |1.08n|.
 %
-% |1.09g| delays definition of \cs{Etoc@getthepage} to \cs{AtBeginDocument} to
+% |1.09g| delays definition of \csbc{Etoc@getthepage} to \csa{AtBeginDocument} to
 % check if \ctanpkg{hyperref} is at version |7.00u 2022-11-13| or later, as that
-% version replaced \cs{hyper@linkstart} with \cs{protected} macro
-% \cs{Hy@toclinkstart} which furthermore requires one more expansion step.
-% Formerly, the \cs{ifEtoc@hyperref} test was executed via the expansion of
-% \cs{Etoc@getthepage} but now this test is tacitly done only once at begin
-% document to define appropriately \cs{Etoc@getthepage}.  Falls back to
-% \cs{Etoc@getthepage@nohyp}.
+% version replaced \csa{hyper@linkstart} with \csa{protected} macro
+% \csa{Hy@toclinkstart} which furthermore requires one more expansion step.
+% Formerly, the \csbc{ifEtoc@hyperref} test was executed via the expansion of
+% \csbc{Etoc@getthepage} but now this test is tacitly done only once at begin
+% document to define appropriately \csbc{Etoc@getthepage}.  Falls back to
+% \csbc{Etoc@getthepage@nohyp}.
 %    \begin{macrocode}
 \def\Etoc@getthepage@nohyp #1\etoc@ {%
     \Etoc@global\def\etocthepage       {#1}%
@@ -8152,9 +8226,9 @@ body).
 % store information whose scope extends beyond the execution of each
 % |\contentsline|.
 %
-% |1.08| adds the |\Etoc@global|'s.
+% |1.08| adds the \csbc{Etoc@global}'s.
 %
-% |1.08j| does not define \csa{etoclink<space>} anymore, only \csa{etocthelink}
+% |1.08j| does not define \csa{etoclink<space>} anymore, only \csbc{etocthelink}
 % which contains the |\Hy@tocdestname| already expanded.
 %    \begin{macrocode}
 \def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@ {%
@@ -8178,8 +8252,8 @@ body).
 %
 % |1.09f| examines also if next token in a space token; if it is we know
 % that we are not with a hyperref-customized entry and that we do not have a
-% numbered entry.  We thus jump directly to \csa{Etoc@getnb@nohyp@nonbr}, so
-% \csa{etocthename} is certainly not redefined and there is no risk of space
+% numbered entry.  We thus jump directly to \csbc{Etoc@getnb@nohyp@nonbr}, so
+% \csbc{etocthename} is certainly not redefined and there is no risk of space
 % gobbling and brace removal.  This precaution is a bit academic though as
 % code from previous release could derail (i.e. mis-interpret data) only in
 % especially crafted circumstances.
@@ -8206,10 +8280,10 @@ body).
     \futurelet\Etoc@getnb@token\Etoc@getnb
 }
 %    \end{macrocode}
-% |1.09g| adds an \cs{Etoc@getnb@a} which
+% |1.09g| adds an \csa{Etoc@getnb@a} which
 % gets defined only at begin document to adapt to \ctanpkg{hyperref} depending on
 % whether the latter is at |7.00u| or earlier.  In absence of \ctanpkg{hyperref}
-% it is \cs{let} to \cs{Etoc@getnb@nohyp}.
+% it is \csa{let} to \csbc{Etoc@getnb@nohyp}.
 %    \begin{macrocode}
 \def\Etoc@getnb {%
     \ifx\Etoc@getnb@token\bgroup
@@ -8219,14 +8293,14 @@ body).
     \fi
 }
 %    \end{macrocode}
-% |1.08| adds the |\Etoc@global|'s.
+% |1.08| adds the \csbc{Etoc@global}'s.
 %
 % |1.08j| corrects an old |\ifx#1\numberline| into |\ifx\numberline#1|.
 %
 % |1.08k| uses a delimited macro to identify \csa{numberline},
 % \csa{chapternumberline} etc... in one go, avoiding
 % the |\let\chapternumberline\numberline| etc... which were done formerly
-% in \csa{Etoc@tableofcontents}. Currently \etoc does not yet use \eTeX.
+% in \csbc{Etoc@tableofcontents}. Currently \etoc does not yet use \eTeX.
 %
 % |1.08m| fixes incompatibility of |1.08k|'s delimited macro method with KOMA's
 % \csa{nonumberline}.
@@ -8235,7 +8309,7 @@ body).
 % |1.08m| actually would have needed some |\detokenize| for complete safety
 % and so far \etoc does not use e-\TeX. So here at |1.08n| I refactored the
 % whole thing. And I added a |\futurelet|-based brace detection in
-% |\Etoc@getnb| so here |#1| is guaranteed not braced now.
+% \csbc{Etoc@getnb} so here |#1| is guaranteed not braced now.
 %
 % |1.08n| tries to handle reasonably the |\nonumberline| of \ctanpkg{KOMA-script}.
 % If it expands to |\numberline{}|, \etoc will thus consider the line
@@ -8273,8 +8347,8 @@ body).
     \Etoc@global\let\etocthelinkedname \etocthename
 }
 %    \end{macrocode}
-% \csa{etocthename} and \csa{etocthelinkedname} already defined in
-% \csa{Etoc@lxyz}, no need to update.
+% \csbc{etocthename} and \csbc{etocthelinkedname} already defined in
+% \csbc{Etoc@lxyz}, no need to update.
 %    \begin{macrocode}
 \def\Etoc@getnb@nohyp@nonbr #1\etoc@ {%
     \Etoc@global\Etoc@numberfalse
@@ -8284,7 +8358,7 @@ body).
 %    \end{macrocode}
 % Special KOMA branch: |#1| starts with |\nonumberline| which has here same
 % meaning as |\empty|.  It is in the current provisory definition of
-% \csa{etocthename}.  We get rid of this token, in case usage is delayed,
+% \csbc{etocthename}.  We get rid of this token, in case usage is delayed,
 % to avoid improbable problems.
 %    \begin{macrocode}
 \def\Etoc@getnb@nohyp@nonumberline #1\relax\relax\etoc@ {%
@@ -8301,7 +8375,7 @@ body).
 }
 %    \end{macrocode}
 % |1.07n| replaces use of |\toks@| by macro |\Etoc@tmp|. |1.08| adds
-% the |\Etoc@global|'s.
+% the \csbc{Etoc@global}'s.
 %
 % |1.08j| corrects the old |\ifx#1\numberline| into |\ifx\numberline#1|.
 %
@@ -8324,12 +8398,12 @@ body).
 % At |1.09h| I converted the |#5#6| into |#5|, the |#5#6| had been kept
 % around for ages here, perhaps a legacy of early versions, anyway
 % here the macro really wants the |#4| anyhow only (and |#3|) and there
-% can be only one \cs{etoc@}.
+% can be only one \csa{etoc@}.
 %
-% The |7.00u| \ctanpkg{hyperref} has modified the mark-up, but \cs{Etoc@getnb@a}
-% defined at begin document has caused the expansion of \cs{Hy@toclinkstart}
-% so we are back to the |<7.00u| situation; and \cs{Hy@toclinkend} is anyhow
-% gobbled as part of |#5| as was formerly \cs{hyper@linkend} so we don't have
+% The |7.00u| \ctanpkg{hyperref} has modified the mark-up, but \csa{Etoc@getnb@a}
+% defined at begin document has caused the expansion of \csa{Hy@toclinkstart}
+% so we are back to the |<7.00u| situation; and \csa{Hy@toclinkend} is anyhow
+% gobbled as part of |#5| as was formerly \csa{hyper@linkend} so we don't have
 % to worry about that \ctanpkg{hyperref} change.
 %    \begin{macrocode}
 \def\Etoc@getnb@hyp #1#2#3#4#5\etoc@ {%
@@ -8343,7 +8417,7 @@ body).
 %    \end{macrocode}
 % In case of an upfront brace, the sectioning heading is not numbered, so we
 % can avoid potential brace removal problems by jumping now to the not
-% numbered branch not hyperlinked branch; indeed \csa{etocthelinkedname} has
+% numbered branch not hyperlinked branch; indeed \csbc{etocthelinkedname} has
 % already been defined with the |\hyperlink| so we can bail out.
 %    \begin{macrocode}
 \def\Etoc@getnb@hyp@a {%
@@ -8360,7 +8434,7 @@ body).
     \else
 %    \end{macrocode}
 % If not numbered we can bail out to the "nohyp" branch, as
-% \csa{etocthelinkedname} has already been defined with the |\hyperlink|.
+% \csbc{etocthelinkedname} has already been defined with the |\hyperlink|.
 %    \begin{macrocode}
        \let\Etoc@next\Etoc@getnb@nohyp@nonbr
        \in@{#1}{\nonumberline}%
@@ -8368,8 +8442,8 @@ body).
 %    \end{macrocode}
 % In case of presence of KOMA \csa{nonumberline} we need to expand it
 % once, and then execute the numbered branch which will redefine
-% \csa{etocthename} as well.  But in case it is empty we will have to
-% correct \csa{etocthename}, just to be perfect.
+% \csbc{etocthename} as well.  But in case it is empty we will have to
+% correct \csbc{etocthename}, just to be perfect.
 %    \begin{macrocode}
            \ifx\nonumberline\empty
                \let\Etoc@next\Etoc@getnb@hyp@nonumberline
@@ -8410,7 +8484,7 @@ body).
                 \expandafter\Etoc@tmp\expandafter{\etocthename}}%
 }
 %    \end{macrocode}
-% |1.08| adds the |\Etoc@global|'s.
+% |1.08| adds the \csbc{Etoc@global}'s.
 %
 % |1.08n| refactors this but it is still not extremely robust.
 %
@@ -8429,7 +8503,7 @@ body).
 }
 \def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit }
 %    \end{macrocode}
-% |1.09g| delays defining \cs{Etoc@getit} to at begin document to adapt to
+% |1.09g| delays defining \csbc{Etoc@getit} to at begin document to adapt to
 % \ctanpkg{hyperref} depending on whether the latter is at |7.00u| or earlier.
 %    \begin{macrocode}
 \def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {%
@@ -8451,21 +8525,21 @@ body).
 }
 %    \end{macrocode}
 % |1.07n| replaces use of |\toks@| by macro |\Etoc@tmp|. |1.08| adds
-% the |\Etoc@global|'s.
+% the \csbc{Etoc@global}'s.
 %
-% |1.08j| adds \csa{etocthelink} definition here which was missing. This bug
+% |1.08j| adds \csbc{etocthelink} definition here which was missing. This bug
 % showed in case hyperref was used with option |linktoc=page|, for |part|
-% styles: the |\etocthelink| would not create a link if used therein. But the
+% styles: the \csbc{etocthelink} would not create a link if used therein. But the
 % |linktoc=page| condition could easily however trigger the more serious
-% |\ifx| bug in |\Etoc@getnb| also fixed at |1.08j|, and this would have
+% |\ifx| bug in \csbc{Etoc@getnb} also fixed at |1.08j|, and this would have
 % overshadowed this one by a real compilation error rather than a missing link
 % in the procuced PDF.
 %
 % |1.08n| refactors the whole thing. |1.08o| chooses better names for
 % macros.
 %
-% For |1.08p| fix of hyperref's extra brace (see |\Etoc@@getnb|,
-% |\Etoc@@getit|), this branch should not suffer the issue, hence I
+% For |1.08p| fix of hyperref's extra brace (see \csbc{Etoc@@getnb},
+% \csbc{Etoc@@getit}), this branch should not suffer the issue, hence I
 % don't bother checking |\ifEtoc@bracedname| status.
 %
 % At |1.09h| the |#5#6| becomes |#5|, the |#5#6| was for some legacy reason
@@ -8495,8 +8569,8 @@ body).
                 \expandafter{\expandafter\hyperlink \Etoc@tmp{#1}}%
 }%
 %    \end{macrocode}
-% |1.08a| of |2015/03/12| does the long-postponed thing to let |\etocname|
-% etc.. be simply the robust variant of |\etocthelinkedname| etc...
+% |1.08a| of |2015/03/12| does the long-postponed thing to let \csbc{etocname}
+% etc.. be simply the robust variant of \csbc{etocthelinkedname} etc...
 %    \begin{macrocode}
 \let\etocthename   \@empty
 \let\etocthenumber \@empty
@@ -8513,13 +8587,13 @@ body).
    {\ifEtoc@number\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
 \expandafter\let\expandafter\etocxifnumbered\csname etocifnumbered \endcsname
 %    \end{macrocode}
-% |1.08| defines |\etociffirst|
+% |1.08| defines \csbc{etociffirst}
 %    \begin{macrocode}
 \DeclareRobustCommand*{\etociffirst}
    {\ifEtoc@isfirst\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
 \expandafter\let\expandafter\etocxiffirst\csname etociffirst \endcsname
 %    \end{macrocode}
-% |1.07j| modifies |\Etoc@readtoc|.
+% |1.07j| modifies \csbc{Etoc@readtoc}.
 %    \begin{macrocode}
 \def\Etoc@readtoc {%
   \ifeof \Etoc@tf
@@ -8545,7 +8619,7 @@ body).
       \closein\Etoc@tf}}
     {\typeout{No file \jobname.toc.}}}
 %    \end{macrocode}
-% 1.07d: parskip and |\@nobreakfalse| stuff moved to |\Etoc@tableofcontents|
+% 1.07d: parskip and |\@nobreakfalse| stuff moved to \csbc{Etoc@tableofcontents}
 %    \begin{macrocode}
 \def\Etoc@openouttoc{%
   \ifEtoc@hyperref
@@ -8567,11 +8641,11 @@ body).
 %    \end{macrocode}
 % |1.08| has a new way to handle |\Etoc@standardtrue|.
 %
-% Also the expansion of |\Etoc@levelist| is moved to inside
-% |\Etoc@tableofcontents| as set-up by |\etocsettocstyle|. This opens up
+% Also the expansion of \csbc{Etoc@levellist} is moved to inside
+% \csbc{Etoc@tableofcontents} as set-up by \csbc{etocsettocstyle}. This opens up
 % the possibility for the user to open a group in the title (for example
 % start a tabular) which would be closed (by the first |&|) sometime
-% later. In combination with |\etocglobaldefs| it will be now much
+% later. In combination with \csbc{etocglobaldefs} it will be now much
 % easier to typeset TOC as tables with \etoc!
 %    \begin{macrocode}
 \def\Etoc@toctoc{%
@@ -8600,19 +8674,19 @@ body).
 % Slightly better coded in |1.08b|. Had some bad experiences with TeX
 % conditionals back in 2011/2012 when I started LaTeX programming, and the
 % code was a remnant of extra cautious attitude. Also, now
-% \csa{etoc@@startlocaltoc} is expandable if it does nothing.
+% \csbc{etoc@@startlocaltoc} is expandable if it does nothing.
 %
-% |2015/04/16|: |1.08e| removes a \csa{ifEtoc@notactive} test as |\ifnum| can
-% be positive only once anyhow; although the \csa{ifEtoc@notactive} boolean
+% |2015/04/16|: |1.08e| removes a \csbc{ifEtoc@notactive} test as |\ifnum| can
+% be positive only once anyhow; although the \csbc{ifEtoc@notactive} boolean
 % could be faster than an |\ifnum|, it adds to it as long as the local toc id
 % is not yet found.
 %
-% I replace (|1.08e|) the |\Etoc@global|'s for |\Etoc@localtop| by
+% I replace (|1.08e|) the \csbc{Etoc@global}'s for \csa{Etoc@localtop} by
 % |\global|'s. The |\relax| is needed because |#2| may sometimes be a count,
 % sometimes tokens.
 %
-% Attention! |1.09| defines a public \cs{etoclocaltop} in replacement of old
-% \cs{Etoc@localtop} \emph{minus one}. Memo: \cs{etoclocaltop} has only
+% Attention! |1.09| defines a public \csbc{etoclocaltop} in replacement of old
+% \csa{Etoc@localtop} \emph{minus one}. Memo: \csbc{etoclocaltop} has only
 % meaningful meaning when the local toc has its "active" flag set. Except that
 % I used a "notactive" flag to torture myself, so: has the "notactive" flag
 % off.
@@ -8650,51 +8724,51 @@ body).
 %    \end{macrocode}
 % |2015/03/16|: |1.08e| tests if a local table of contents turns out empty.
 % The \csa{Etoc@localtop} there does not have the same meaning as when set-up
-% by the regular \csa{etoc@@startlocaltoc}. It is off by 1 (in general). THIS
-% IS OBSOLETE since |1.09|: a \cs{etoclocaltop} is used with same meaning in
+% by the regular \csbc{etoc@@startlocaltoc}. It is off by 1 (in general). THIS
+% IS OBSOLETE since |1.09|: a \csbc{etoclocaltop} is used with same meaning in
 % all code branches.
 %
 % After some hesitation I opted for making and obeying the test always (*) for
 % local tables of contents, and do it also for global tables of contents but
-% for the latter the user must issue \csa{etocnotocifnotoc} for the emptiness
+% for the latter the user must issue \csbc{etocnotocifnotoc} for the emptiness
 % test to be obeyed. The emptiness tests are to be trusted only when the
 % compilations have stabilized.
 %
-% (*) finally the user must issue \csa{etocchecksemptiness} once.
+% (*) finally the user must issue \csbc{etocchecksemptiness} once.
 %
-% |\Etoc@tocid| is the number of the toc (possibly gotten via a |\ref|
-% following a \csa{tableofcontents}), or it is |\z@| if the emptiness test is
+% \csbc{Etoc@tocid} is the number of the toc (possibly gotten via a |\ref|
+% following a \csbc{tableofcontents}), or it is |\z@| if the emptiness test is
 % from a global toc. Until the compilations stabilize, some local TOCs can get
 % printed at wrong locations naturally and emptiness tests can not be trusted
 % either. Releases earlier than |1.08e| authorized
-% \csa{tableofcontents}|\ref{foo}| with |foo| the label of a \emph{global}
+% \csbc{tableofcontents}|\ref{foo}| with |foo| the label of a \emph{global}
 % toc. But as it was impossible (without much complications) to discriminate,
 % until auxiliary files have stabilized, between a |\ref| to a local toc whose
 % id is not yet in the |.toc| file and a |\ref| to a global toc whose id will
 % in the end definitely not be in the |.toc| file, I decided that this silly
 % possibility should not be supported anymore. This allowed to remove a few
-% tokens from \csa{Etoc@tableofcontents} as well. And it also allowed
-% improvements to \csa{Etoc@localtableofcontents}.
+% tokens from \csbc{Etoc@tableofcontents} as well. And it also allowed
+% improvements to \csbc{Etoc@localtableofcontents}.
 %
 % Note: (|1.08i 2016/09/29|) the code has to handle both local and total toc.
-% Hence the flag |\ifEtoc@notactive| has to be set prior to it. For a global
-% toc, the |\Etoc@tocid| was set to |\z@|, and the |\ifnum| in
-% |\etoc@startlocaltoc| did always fail, but I now prefer to simply nullify
-% the |\etoc@startlocaltoc|. As its default fallback is |\@gobble| I simply
-% test here for the |localtoc| flag. The |\Etoc@tocid| will be undefined for a
+% Hence the flag \csbc{ifEtoc@notactive} has to be set prior to it. For a global
+% toc, the \csbc{Etoc@tocid} was set to |\z@|, and the |\ifnum| in
+% \csbc{etoc@startlocaltoc} did always fail, but I now prefer to simply nullify
+% the \csbc{etoc@startlocaltoc}. As its default fallback is |\@gobble| I simply
+% test here for the \csbc{ifEtoc@localtoc} flag. The \csbc{Etoc@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@level| where we last stood.
+% encountered is different from the one in \csbc{etoc@@startlocaltoc} which uses
+% the level flags. Here we just record in \csbc{Etoc@level} where we last stood.
 % The initialization |\global\let\Etoc@level\Etoc@minf| is thus needed in case
-% the |.toc| file contains an |\etoc@startlocaltoc| before any
+% the |.toc| file contains an \csbc{etoc@startlocaltoc} before any
 % |\contentsline|.
 %
 % |1.08i| has two |testingcontentsline| macros, one for local, one for global.
 %
-% |1.09| renames the \cs{Etoc@localtop} which was used here to a public
-% \cs{etoclocaltop} to make it usable in \cs{etocsettocstyle}.
+% |1.09| renames the \csa{Etoc@localtop} which was used here to a public
+% \csbc{etoclocaltop} to make it usable in \csbc{etocsettocstyle}.
 %    \begin{macrocode}
 \def\Etoc@setemptytocbool {%
     \global\Etoc@emptytoctrue
@@ -8712,6 +8786,10 @@ body).
         \let\contentsline\Etoc@testingcontentsline
       \fi
       \Etoc@storetocdepth
+%    \end{macrocode}
+% |1.09i| fixes a bug arising when document has used \csbc{etocsetlocaltop.toc}.
+%    \begin{macrocode}
+        \let\Etoc@setlocaltop@doends@dobegins\@empty
         \the\Etoc@toctoks
       \Etoc@restoretocdepth
     \endgroup
@@ -8727,13 +8805,13 @@ body).
    \else
     \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname
 %    \end{macrocode}
-% |\ifEtoc@notactive| set to False by |\etoc@startlocaltoc| with right id. It
+% |\ifEtoc@notactive| set to False by \csbc{etoc@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@localtop| will have been
-% initialized by |\etoc@@startlocaltoc| as |\ifEtoc@notactive| flag can be
+% Set \csbc{ifEtoc@stoptoc} flag afterwards in all cases. \csa{Etoc@localtop} will have been
+% initialized by \csbc{etoc@@startlocaltoc} as \csbc{ifEtoc@notactive} flag can be
 % false only then.
 %
-% |1.09| renamed the \cs{Etoc@localtop} as formerly here to \cs{etoclocaltop}
+% |1.09| renamed the \csa{Etoc@localtop} as formerly here to \csbc{etoclocaltop}
 % and adds support for \localtocwrdp.
 %    \begin{macrocode}
     \ifEtoc@notactive
@@ -8766,50 +8844,50 @@ body).
 }
 %    \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
+% sometimes one uses \csbc{localtableofcontents} to prepare something else, and one
 % does not want any text output even in intermediate runs.
 %
-% Also |1.07g| adds \csa{etocaftertochook} to help with
-% \csa{invisiblelocaltableofcontents} (and then I did \csa{etocsetnexttocdepth}).
-% |1.07h| makes the hook used by \csa{etocsetnexttocdepth} private.
+% Also |1.07g| adds \csbc{etocaftertochook} to help with
+% \csbc{invisiblelocaltableofcontents} (and then I did \csbc{etocsetnexttocdepth}).
+% |1.07h| makes the hook used by \csbc{etocsetnexttocdepth} private.
 %
 % |2015/03/14|: |1.08b| suppresses a space token from an unprotected end of
-% line at the end after the replacement text of \csa{etoc@startlocaltoc} (bug
+% line at the end after the replacement text of \csbc{etoc@startlocaltoc} (bug
 % dating back to |1.03 2012/11/23|). I didn't see it due to the originally
 % badly formatted source of |\Etoc@next|.
 %
-% |2015/03/16|: |1.08e| lets \csa{localtableofcontents} do a first scan of the
-% |.toc| file (as stored in |\Etoc@toctoks|) to determine if the table of
+% |2015/03/16|: |1.08e| lets \csbc{localtableofcontents} do a first scan of the
+% |.toc| file (as stored in \csbc{Etoc@toctoks}) to determine if the table of
 % contents will in fact end up empty. In that case, nothing is typeset. The
-% command \csa{etocaftertochook} is still executed though. Other ways were
+% command \csbc{etocaftertochook} is still executed though. Other ways were
 % envisioned (like delimited macros) to determine this potential emptiness, but
 % in the end I opted for execution of the |.toc| file with suitable definitions
-% for \csa{contentsline} and \csa{etoc@startlocaltoc}. Notice though that if
+% for \csa{contentsline} and \csbc{etoc@startlocaltoc}. Notice though that if
 % emptiness would result from empty line styles, this can not be detected.
 % Emptiness means ``no executed \csa{contentsline}''.
 %
 % For this detection of emptiness, assignments (here and in
-% \csa{Etoc@testingcontentsline}) are made globally, I think this is the best
+% \csbc{Etoc@testingcontentsline}) are made globally, I think this is the best
 % (just in case some portions of the |.toc| file turn out to be inside some
 % groups --- perhaps for some silly color assignments, etc... --- whose
 % boundaries do not necessarily respect unit levels).
 %
-% The flag |\Etoc@tocwithid| discriminates between a \localtoc and a
+% The flag \csbc{ifEtoc@tocwithid} discriminates between a \localtoc and a
 % \toc|\ref{foo}|; the latter could so far possibly refer to a local or also to
 % a global table of contents but release |1.08e| has deprecated the latter use
 % as it complicated the code, for something truly silly. Thus |\ref{foo}| must
-% now be with |foo| a label of a local TOC. As a result |\Etoc@tocwithid| is
+% now be with |foo| a label of a local TOC. As a result \csbc{ifEtoc@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@tocid| is |0|. \etoc used to issue a warning to
+% in the |.aux| file, \csbc{Etoc@tocid} is |0|. \etoc used to issue a warning to
 % run latex again and did no printing at all. Release |1.08e| in such cases
 % prints the heading (this may gain one compilation step). Emptiness test is
 % not executed as it would necessarily turn out positive and can not be
 % trusted anyhow. The TOC is declared non empty, which it probably is...
 %
 % Emptiness detection for local tables of contents (either from a
-% \csa{localtableofcontents} or from a \csa{tableofcontents}|\ref{localtoc}|)
+% \csbc{localtableofcontents} or from a \csbc{tableofcontents}|\ref{localtoc}|)
 % can be trusted only when the |.toc| file has stabilized.The emptiness status
 % of a local TOC whose Id is not yet in the |.toc| is by necessity undecided
 % yet (and not to be trusted really as the numbering may have changed; only
@@ -8824,22 +8902,22 @@ body).
 % |1.08i-2016/09/29| now does |\Etoc@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@tocid|, but simply leaves |\etoc@startlocaltoc| to its
-% default |\@gobble|. The |\Etoc@emptytocfalse| flag is upfront in case some
-% code using |\etocifwasempty| is in user hooks. The default is to assume the
+% automatically false in \csbc{etoc@@startlocaltoc} due to the special values |0|
+% or |\z@| for \csbc{Etoc@tocid}, but simply leaves \csbc{etoc@startlocaltoc} to its
+% default |\@gobble|. The \csa{Etoc@emptytocfalse} is upfront in case some
+% code using \csbc{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@etoccontentsline| is more efficient now.
+% \csa{Etoc@stoptoctrue} flag, the \csbc{Etoc@etoccontentsline} is more efficient now.
 %
-% The |\Etoc@notactive| flag needs to be set before calling
-% |\Etoc@setemptytocbool|.
+% The \csbc{ifEtoc@notactive} flag needs to be set before calling
+% \csbc{Etoc@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 \cs{PackageWarning} approach has the advantage
+% The \csa{PackageWarning} approach 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
@@ -8872,7 +8950,7 @@ body).
     \fi
     \global\Etoc@notactivetrue
 %    \end{macrocode}
-% |1.08i|'s |\Etoc@setemptytocbool| now checks |localtoc| flag.
+% |1.08i|'s \csbc{Etoc@setemptytocbool} now checks |localtoc| flag.
 %    \begin{macrocode}
     \ifEtoc@checksemptiness
        \Etoc@setemptytocbool
@@ -8894,15 +8972,15 @@ body).
        \global\Etoc@stoptocfalse
        \global\Etoc@notactivetrue
 %    \end{macrocode}
-% Prior to |1.09| a \cs{Etoc@localtop} was reset here. This has now been
-% moved to \cs{Etoc@tableofcontents} and \cs{Etoc@localtop} replaced by a
-% public \cs{etoclocaltop} usable in line styles, and in \cs{etocsettocstyle}
+% Prior to |1.09| a \csa{Etoc@localtop} was reset here. This has now been
+% moved to \csbc{Etoc@tableofcontents} and \csa{Etoc@localtop} replaced by a
+% public \csbc{etoclocaltop} usable in line styles, and in \csbc{etocsettocstyle}
 % (under checksemptinesstrue regime).
 %
 % We can end up here either if the emptiness check was done and turned
-% negative (then \cs{etoclocaltop} has the correct level for usage in first
-% argument of \cs{etocsettocstyle}), or if the emptiness check was not done.
-% For the latter case \cs{etoclocaltop} has setting |-\@m|.
+% negative (then \csbc{etoclocaltop} has the correct level for usage in first
+% argument of \csbc{etocsettocstyle}), or if the emptiness check was not done.
+% For the latter case \csbc{etoclocaltop} has setting |-\@m|.
 %    \begin{macrocode}
        \edef\etoc@startlocaltoc##1%
            {\noexpand\etoc@@startlocaltoc{##1}{\Etoc@tocid}}%
@@ -8914,15 +8992,15 @@ body).
     \etocaftertochook   % 1.07g
 %    \end{macrocode}
 % |1.09| hesitates about putting this before of after the
-% \cs{etocaftertochook}. The information of the used tocdepth is lost if
-% puuting it first. The usage of \cs{etocaftertochook} may be broken if
+% \csbc{etocaftertochook}. The information of the used tocdepth is lost if
+% puuting it first. The usage of \csbc{etocaftertochook} may be broken if
 % unexpected tokens follows.
 %    \begin{macrocode}
     \let\Etoc@localtocdepth\c@tocdepth % 1.09
 }% \Etoc@localtableofcontents
 %    \end{macrocode}
 % |2013/03/07|: I discover a \csa{@namedef} trick to construct the
-% \csa{Etoc@again} space delimited macro:\\
+% \csbc{Etoc@again} space delimited macro:\\
 % |    \@namedef {Etoc@again} {...stuff...}|\\
 %  Original version was (copied from analogous stuff in |source2e|):\\
 % |    {\def\1{\Etoc@again}\expandafter\gdef\1 {...stuff...}}|\\
@@ -8940,9 +9018,9 @@ body).
 %
 % Also, |\ref{foo}| expects |foo| to be a label to a \emph{local} TOC. Earlier
 % versions accepted a reference to a global TOC, I have removed the support
-% from \csa{Etoc@tableofcontents}.
+% from \csbc{Etoc@tableofcontents}.
 %
-% The syntax \csa{localtableofcontents}|\ref{foo}| is now accepted.
+% The syntax \csbc{localtableofcontents}|\ref{foo}| is now accepted.
 %    \begin{macrocode}
 \def\Etoc@dothis #1#2\etoc@ {\fi #1}
 \def\Etoc@t@bleofcontents{%
@@ -8950,23 +9028,23 @@ body).
     \ifx\Etoc@nexttoken\label\Etoc@dothis{\expandafter\Etoc@label\@gobble}\fi
     \ifx\Etoc@nexttoken\@sptoken\Etoc@dothis{\Etoc@again}\fi
 %    \end{macrocode}
-% |\Etoc@ref| will hand over directly to |\Etoc@localtableofcontents|.
+% \csbc{Etoc@ref} will hand over directly to \csbc{Etoc@localtableofcontents}.
 % Argument will be (or rather expand to) zero if the reference is non-existent
-% yet. There was an |\Etoc@tocwithidfalse| flag which |1.08i| suppresses as it
+% yet. There was an \csa{Etoc@tocwithidfalse} flag which |1.08i| suppresses as it
 % is not used afterwards (since |1.08e| I think.)
 %    \begin{macrocode}
     \ifx\Etoc@nexttoken\ref\Etoc@dothis{\expandafter\Etoc@ref\@gobble}\fi
 %    \end{macrocode}
-% Flag to check if we were called from a |\localtableofcontents|.
+% Flag to check if we were called from a \csbc{localtableofcontents}.
 %    \begin{macrocode}
     \ifEtoc@tocwithid\Etoc@dothis{\Etoc@localtableofcontents{\c@etoc@tocid}}\fi
 %    \end{macrocode}
 % From now on we are handling a global TOC. Earlier, I used the trick of
-% setting |\Etoc@tocid| to |\z@| for compatibility with expansion of
-% |\etoc@startlocaltoc|. But since |1.08i| |\etoc@startlocaltoc| is left to be
-% |\@gobble|, and |\Etoc@tocid| is never tested. We don't need to set the
-% |notactive| flag as now |\Etoc@testingcontentsline| tests first the
-% |localtoc| flag (was already the case of |\Etoc@etoccontentsline|). I change
+% setting \csbc{Etoc@tocid} to |\z@| for compatibility with expansion of
+% \csbc{etoc@startlocaltoc}. But since |1.08i| \csbc{etoc@startlocaltoc} is left to be
+% |\@gobble|, and \csbc{Etoc@tocid} is never tested. We don't need to set the
+% \csbc{ifEtoc@notactive} flag as now \csbc{Etoc@testingcontentsline} tests first the
+% \csbc{ifEtoc@localtoc} flag (was already the case of \csbc{Etoc@etoccontentsline}). I change
 % a bit the style of conditionals here for clarity of code.
 %    \begin{macrocode}
     \global\Etoc@emptytocfalse\ifEtoc@checksemptiness\Etoc@setemptytocbool\fi
@@ -8990,9 +9068,9 @@ body).
 % 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@startlocaltoc|. In
-% |\Etoc@table@fcontents| case it remains to be seen if a |\ref| follows which
-% could turn the TOC into a local one. Handled by |\Etoc@t@bleofcontents|.
+% |1.08i| moves elsewhere definition of \csbc{etoc@startlocaltoc}. In
+% \csbc{Etoc@table@fcontents} case it remains to be seen if a |\ref| follows which
+% could turn the TOC into a local one. Handled by \csbc{Etoc@t@bleofcontents}.
 %    \begin{macrocode}
 \def\Etoc@table@fcontents{%
     \refstepcounter{etoc@tocid}%
@@ -9004,7 +9082,7 @@ body).
     \Etoc@tocwithidtrue
     \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}
 %    \end{macrocode}
-% |1.07g| defines |\etoctableofcontents| to be able to undo the evil and
+% |1.07g| defines \csbc{etoctableofcontents} to be able to undo the evil and
 % brutal doings of some packages with |\tableofcontents|.
 %
 % |1.08| patches \ctanpkg{tableof}'s influence. Version |1.4a| or later of \ctanpkg{tableof}
@@ -9016,7 +9094,7 @@ body).
 % Attention that there could be a |\ref| following, thus we don't yet know
 % whether this is a local or global table of contents.
 %
-% The \cs{Etoc@tocdepthset} is for \cs{etocsetnexttocdepth} mechanism.
+% The \csbc{Etoc@tocdepthset} is for \csbc{etocsetnexttocdepth} mechanism.
 %    \begin{macrocode}
 \def\etoctableofcontents{%
    \Etoc@openouttoc
@@ -9029,12 +9107,12 @@ body).
 % inserted only in the \ctanpkg{tableof} private copy of the |.toc| file which is
 % used by its own table of contents typesetting command.
 %
-% |1.08i| removes definition of |\etoc@startlocaltoc| from here. It is done
-% in |\Etoc@localtableofcontents| or uses its default of |\@gobble|.
+% |1.08i| removes definition of \csbc{etoc@startlocaltoc} from here. It is done
+% in \csbc{Etoc@localtableofcontents} or uses its default of |\@gobble|.
 %
 % |1.09b| uses a |\def| in non-starred variant for allowing tricks to
 % recognize later on if we are in a starred or non-starred case, whatever the
-% user definition of \cs{etocaftertitlehook} may be.
+% user definition of \csbc{etocaftertitlehook} may be.
 %    \begin{macrocode}
       \@ifstar
       {\let\Etoc@aftertitlehook\@empty\Etoc@table@fcontents}
@@ -9060,11 +9138,11 @@ body).
 %    \end{macrocode}
 % |1.09| adds \localtocwrdp. The motivation is that it is impossible to set
 % in a completely satisfactory way the tocdepth from the first argument of
-% \cs{etocsettocstyle} because the emptiness check does not execute that
+% \csbc{etocsettocstyle} because the emptiness check does not execute that
 % argument. If one does not care about emptiness check, one can of course set
-% the tocdepth from the first argument of \cs{etocsettocstyle}. One can even
-% use \cs{etocsetnexttocdepth} for that since |1.09| but anyway direct usage
-% of \cs{etocsettocdepth} (or |\setcounter{tocdepth}{...}| is easier as its
+% the tocdepth from the first argument of \csbc{etocsettocstyle}. One can even
+% use \csbc{etocsetnexttocdepth} for that since |1.09| but anyway direct usage
+% of \csbc{etocsettocdepth} (or |\setcounter{tocdepth}{...}| is easier as its
 % effet when executed there is automatically limited to duration of the TOC.
 %    \begin{macrocode}
 \newcommand*\localtableofcontentswithrelativedepth[1]{%
@@ -9074,33 +9152,33 @@ body).
 }% \localtableofcontentswithrelativedepth
 \let\Etoc@localtocdepth\c@tocdepth
 %    \end{macrocode}
-% |1.08| moves earlier the definitions of |\Etoc@savedcontentsline| as
-% well as |\Etoc@levellist|. It will thus not be operative to do
-% |\etocsetlevel| from inside the title now. But perhaps it will be
+% |1.08| moves earlier the definitions of \csbc{Etoc@savedcontentsline} as
+% well as \csbc{Etoc@levellist}. It will thus not be operative to do
+% \csbc{etocsetlevel} from inside the title now. But perhaps it will be
 % easier to deal with tables.
 %
 % Also I remove a big |\@firstofone|, and use rather
-% |\Etoc@gobbletoetoc@| for the gobbling case.
+% \csbc{Etoc@gobbletoetoc@} for the gobbling case.
 %
 % Also, |1.08| modifies the code to do only expandable things after
-% |\Etoc@toctoc|, in order to allow opening of an alignment in the first
+% \csbc{Etoc@toctoc}, in order to allow opening of an alignment in the first
 % argument and closing in the second. Earlier versions had an
-% |\Etoc@@next| initially set to relax after the first |\Etoc@toctoc|. I
+% |\Etoc@@next| initially set to relax after the first \csbc{Etoc@toctoc}. I
 % was in 2012/2013 quite uneasy with the TeX conditionals hence wanted
 % for safety to move the things for the second invocation of
-% |\Etoc@toctoc| after the |\fi\fi\fi|. I could define an |\afterfififi|
+% \csbc{Etoc@toctoc} after the |\fi\fi\fi|. I could define an |\afterfififi|
 % macro, but it should be ok as it is done here.
 %
-% |1.08e| moved the |\Etoc@par| to \csa{Etoc@tableofcontents}. This was needed
+% |1.08e| moved the \csbc{Etoc@par} to \csbc{Etoc@tableofcontents}. This was needed
 % for the implementation of the emptiness test. It might have some impact in
 % fringe cases as the \csa{refstepcounter} is now done before the |\par| is
 % issued.
 %
-% |1.08e| suppresses the possibility to do a \csa{tableofcontents}|\ref{foo}|
-% with |foo| the label of a global TOC: issueing \csa{tableofcontents} alone
+% |1.08e| suppresses the possibility to do a \csbc{tableofcontents}|\ref{foo}|
+% with |foo| the label of a global TOC: issueing \csbc{tableofcontents} alone
 % suffices. Allowed to simplify some code.
 %
-% |1.08g| moves |\Etoc@par| to before |\etocbeforetitlehook|, not after.
+% |1.08g| moves \csbc{Etoc@par} to before \csbc{etocbeforetitlehook}, not after.
 %    \begin{macrocode}
 \long\def\Etoc@gobbletoetoc@ #1\etoc@ {}
 \newcommand\etocsettocstyle[2]{%
@@ -9118,7 +9196,7 @@ body).
     \ifEtoc@standard
     \else % moved here from \Etoc@toctoc (1.08)
 %    \end{macrocode}
-% Prior to |1.08|, this was done in |\Etoc@toctoc|
+% Prior to |1.08|, this was done in \csbc{Etoc@toctoc}
 %
 % |1.08k| defines here |\etocsavedchaptertocline|, |\etocsavedsectiontocline|,
 % and so on for all declared level names, again at each TOC and for the
@@ -9134,10 +9212,10 @@ body).
 %    \begin{macrocode}
     \fi
 %    \end{macrocode}
-% |1.09| makes \cs{etocsetnexttocdepth} usable in |#1| (but this is not 100\%
+% |1.09| makes \csbc{etocsetnexttocdepth} usable in |#1| (but this is not 100\%
 % compatible with the emptiness check).
 %
-% |1.09| makes an \cs{etoclocaltop} usable in |#1| if under checksemptiness
+% |1.09| makes an \csbc{etoclocaltop} usable in |#1| if under checksemptiness
 % regime.
 %    \begin{macrocode}
     #1%
@@ -9145,8 +9223,8 @@ body).
     \ifEtoc@parskip\parskip\z@skip\fi %1.07d
     \Etoc@aftertitlehook
 %    \end{macrocode}
-% |1.09| has replaced former \cs{Etoc@localtop} (\emph{minus one}) by
-% \cs{etoclocaltop}. Under checksemptinesstrue regime its value is already
+% |1.09| has replaced former \csa{Etoc@localtop} (\emph{minus one}) by
+% \csbc{etoclocaltop}. Under checksemptinesstrue regime its value is already
 % known, but it will be obtained again from the toc file execution. As it is
 % used only if TOC is active, resetting it here this way is decorative and
 % could be removed.
@@ -9157,7 +9235,7 @@ body).
     #2\@nobreakfalse % 1.07d: \@nobreakfalse moved here
     \Etoc@restoretocdepth  % 1.07g. moved here from before #2 by 1.08
 %    \end{macrocode}
-% |\contentsline| was set to |\Etoc@etoccontentsline| by a non-global |\let|,
+% |\contentsline| was set to \csbc{Etoc@etoccontentsline} by a non-global |\let|,
 % and it will recover its normal value from exiting a scope limiting group.
 % But \ctanpkg{tableof} (since |1.4a|) under |\etocglobaldefstrue| does a global
 % redefinition of |\contentsline|.  Its |\tof@finish| then does a global
@@ -9192,10 +9270,10 @@ body).
 }% end of \Etoc@tableofcontents definition by \etocsettocstyle
 }
 %    \end{macrocode}
-% |1.08| hacks the begin parts to update therein the |\ifEtoc@isfirst| flag
+% |1.08| hacks the begin parts to update therein the \csbc{ifEtoc@isfirst} flag
 % (|2015/03/09|).
 %
-% |1.08c| removes unneeded |\long| from the |\def|'s inside |\etoc@setstyle|
+% |1.08c| removes unneeded |\long| from the |\def|'s inside \csbc{etoc@setstyle}
 % (|2015/03/29|).
 %    \begin{macrocode}
 \def\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
@@ -9246,11 +9324,11 @@ body).
 \def\etocabbrevpagename {p.~}
 %    \end{macrocode}
 % Versions earlier than |1.08b| (and since |1.05 2012/12/01|) defined
-% \csa{etocpartname} (for use by \etoc's own line styles) to expand to
+% \csbc{etocpartname} (for use by \etoc's own line styles) to expand to
 % \csa{partname}. But this didn't make sense in the context for example of
 % \ctanpkg{babel} and \ctanpkg{babel-french}, because \csa{frenchpartname} does things depending on
 % the current value of the counter |part|. The code in recent \ctanpkg{babel-french} (but
-% not yet |v2.5a| when |\etocpartname| was introduced) constructs control
+% not yet |v2.5a| when \csbc{etocpartname} was introduced) constructs control
 % sequences |\ordinali|, etc... If the part counter is zero, this gives
 % |\ordinal|. Usually this is not defined, hence no error happens (as it is
 % constructed via |\csname|), but under class \ctanpkg{memoir} the bug showed up. All
@@ -9262,15 +9340,15 @@ body).
 \def\etocbookname       {Book}
 %    \end{macrocode}
 % placeholder for comments
-% The macro \csa{etocdefaultlines} was initially called \csa{etoctoclines}. Now
-% \csa{etoctoclines} just does \csa{Etoc@standardfalse}.
+% The macro \csbc{etocdefaultlines} was initially called \csbc{etoctoclines}. Now
+% \csbc{etoctoclines} just does \csa{Etoc@standardfalse}.
 % Version |1.07e| has rewritten entirely the stuff related to penalties and
 % \csa{addvspace}, as this was not satisfactory in the earlier versions, which
 % were written at a early stage in the development of the
 % package. Actually I am not fully satisfied with these line styles.
 %
-% Version |1.09f| wraps \csa{etocbookname}, respectively
-% \csa{etocpartname}, in the book, resp. part, line styles inside a
+% Version |1.09f| wraps \csbc{etocbookname}, respectively
+% \csbc{etocpartname}, in the book, resp. part, line styles inside a
 % (potential) hyperlink together with the number.
 %    \begin{macrocode}
 \def\etocdefaultlines{\Etoc@standardfalse %
@@ -9410,8 +9488,8 @@ body).
 \etoc@setstyle{@five}{}{}{}{}%
 } % end of \etocdefaultlines!
 %    \end{macrocode}
-% The |\etocinnertopsep| default value is too big as well as |\etocbelowtocskip|
-% and |\etocabovetocskip|, I guess, but if I am remember correctly I chose them
+% The \csbc{etocinnertopsep} default value is too big as well as \csbc{etocbelowtocskip}
+% and \csbc{etocabovetocskip}, I guess, but if I am remember correctly I chose them
 % to mimick the standard TOC spacings in |article| class.
 %    \begin{macrocode}
 \def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
@@ -9423,7 +9501,7 @@ body).
 \def\etocdefaultnbcol{2}
 \def\etocinnertopsep{2ex}
 %    \end{macrocode}
-% |1.07i| adds a |\nobreak| before the |\etocinnertopsep| and a test of vertical
+% |1.07i| adds a |\nobreak| before the \csbc{etocinnertopsep} and a test of vertical
 % mode to see if truly adding a |\par| is a reasonable idea, in the
 % case of single-column mode.
 %
@@ -9503,11 +9581,11 @@ body).
     {\end{multicols}}%
     \addvspace{\etocbelowtocskip}}}
 %    \end{macrocode}
-% |1.07k| defines |\Etoc@relax| and |\etocbkgcolorcmd| as |\long|: the user
+% |1.07k| defines \csbc{Etoc@relax} and \csbc{etocbkgcolorcmd} as |\long|: the user
 % manual says to use |\renewcommand\etocbkgcolorcmd|, and an |\ifx| test is used
 % in the framed style. It was thus a bug to have non-long definitions before. Or
 % I could have said in the user manual to use |\renewcommand*|, or in
-% |\etocframedstyle| I should test for the two, or I should pause to try to
+% \csbc{etocframedstyle} I should test for the two, or I should pause to try to
 % remember about this code and think about it.
 %    \begin{macrocode}
 \def\etocframedmphook{\relax}
@@ -9709,16 +9787,16 @@ body).
 \let\etocreportstyle\etocbookstyle
 \let\etocreportstylenomarks\etocbookstylenomarks
 %    \end{macrocode}
-% |v3.7i| of memoir has moved the \cs{phantomsection} to a better location,
+% |v3.7i| of memoir has moved the \csa{phantomsection} to a better location,
 % before typesetting the title and we follow suit at |1.09a|, and less rashly
-% at |1.09b|. Formerly \etoc used \cs{etocaftertitlehook} to mimick the
+% at |1.09b|. Formerly \etoc used \csbc{etocaftertitlehook} to mimick the
 % memoir code but as its name indicate, it is supposedly executed after the
-% title... and this also had the defect of making \cs{etocaftertitlehook} not
+% title... and this also had the defect of making \csbc{etocaftertitlehook} not
 % anymore a user command. Thus we here use some refactoring of the
-% \cs{Etoc@aftertitlehook} internal mechanism to help recognize if we are
+% \csbc{Etoc@aftertitlehook} internal mechanism to help recognize if we are
 % in the starred case or not.
 %
-% \cs{phantomsection} is always defined by memoir, empty if hyperref absent.
+% \csa{phantomsection} is always defined by memoir, empty if hyperref absent.
 %    \begin{macrocode}
 \def\etocmemoirtoctotocfmt #1#2{%
     \def\Etoc@addsuitablecontentsline{\addcontentsline {toc}{#1}{#2}}%
@@ -9738,9 +9816,9 @@ body).
          \ifx\Etoc@aftertitlehook\@empty
           \else
 %    \end{macrocode}
-% Execute etoc hook before the \cs{cfttocbeforelisthook} and keep distinction
+% Execute etoc hook before the \csa{cfttocbeforelisthook} and keep distinction
 % between starred and non-starred contexts for other hooks. Notice that the
-% memoir class way of implementing \cs{tableofcontents} leaves no way for code
+% memoir class way of implementing \csbc{tableofcontents} leaves no way for code
 % executed by the TOC code to know if it is executed in starred or non-starred
 % context.
 %    \begin{macrocode}         
@@ -9812,7 +9890,7 @@ body).
          {%
 %    \end{macrocode}
 % At |1.09f| I considered adding this \csa{BeforeClosingMainAux} hunk
-% to the second argument of \csa{etocsettocstyle}-emulation of \ctanpkg{KOMA-script}.
+% to the second argument of \csbc{etocsettocstyle}-emulation of \ctanpkg{KOMA-script}.
 % But:
 % \begin{itemize}
 % \item there seems to be no interface to \csa{tocbasic@end@toc@file},
@@ -9825,7 +9903,7 @@ body).
 %
 % \item
 %   the whole thing appears to me to be ill-conceived in so far as it
-%   sort of implies the \csa{tableofcontents} is used only once, as each
+%   sort of implies the \csbc{tableofcontents} is used only once, as each
 %   instance will again add this \csa{tocbasic@end@toc@file} to end of
 %   toc file, which may thus end up being executed multiple times.
 % \end{itemize}
@@ -9967,7 +10045,7 @@ body).
 \DeclareRobustCommand*{\etoctoccontentsline}
     {\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}}
 %    \end{macrocode}
-% |1.09f| adds \csa{etocimmediatetoccontentsline}.
+% |1.09f| adds \csbc{etocimmediatetoccontentsline}.
 %    \begin{macrocode}
 \def\Etoc@addtocontents@immediately#1#2{%
     \begingroup
@@ -9994,24 +10072,24 @@ body).
 % \ctanpkg{tocvsec2} (see its code line 143).
 %
 % I take this opportunity to add to the start of the toc file
-% |\let\etoc@startlocaltoc\@gobble| in case |etoc| is not detected, I should
+% |\let\etoc@startlocaltoc\@gobble| in case \etoc is not detected, I should
 % possibly have done that long ago (like I did in \ctanpkg{tableof}).
 %
 % In |1.07h| I decide that I should not have used |\Etoc@| but |\etoc@| for
-% |\Etoc@settocdepth|. So I now use lowercase and add a temporary line for
+% \csa{Etoc@settocdepth}. So I now use lowercase and add a temporary line for
 % transition in the very improbable situation that someone actually did already
 % use the just released |1.07g|.
 %
-% In |1.07i| the deactivation of |\etoc@settocdepth| done at the start
+% In |1.07i| the deactivation of \csbc{etoc@settocdepth} done at the start
 % of the |.toc| file (for the case this file is used after having
-% removed |etoc| from the document, or imported in another document) is
+% removed \etoc from the document, or imported in another document) is
 % done via letting it to |\@gobble| rather than |\count@| (which would
 % not be ok, as what follows would be undefined too). The reason for the
-% |\count@| also used originally in |\etocignoretoctocdepth| is that
+% |\count@| also used originally in \csbc{etocignoretoctocdepth} is that
 % when I first worked on |1.07g| I possibly had more than one token
-% after |\etoc@settocdepth|, but I changed that later.
+% after \csbc{etoc@settocdepth}, but I changed that later.
 %
-% |1.09| renames \cs{Etoc@resettocdepth} to \cs{Etoc@restoretocdepth}.
+% |1.09| renames \csa{Etoc@resettocdepth} to \csbc{Etoc@restoretocdepth}.
 %    \begin{macrocode}
 \def\Etoc@storetocdepth   {\global\c@etoc@tocdepth\c@tocdepth }
 \def\Etoc@restoretocdepth {\global\c@tocdepth\c@etoc@tocdepth }
@@ -10039,7 +10117,7 @@ body).
    {\protect\etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}%
 }
 %    \end{macrocode}
-% |1.09f| adds \csa{etocimmediatesettocdepth.toc}.
+% |1.09f| adds \csbc{etocimmediatesettocdepth.toc}.
 %    \begin{macrocode}
 \def\etocimmediatesettocdepth #1#{\Etoc@set@toctocdepth@immediately}
 \def\Etoc@set@toctocdepth@immediately #1{%
@@ -10059,16 +10137,16 @@ body).
 % |1.07h| adds the depth tags, and an even more general mechanism could be added
 % at some point: we could insert `action' tags and have the user map them to
 % arbitrary commands. For the time being we just provide
-% |\etocdepthtag.toc {name}| and |\etocsettagdepth {tag_name}{level}| where
+% \csbc{etocdepthtag.toc}\marg{name} and \csbc{etocsettagdepth}\marg{tag\_name}\marg{level} where
 % level is numeric or
 % alphabetical. The numeric
-% level |-3| is now again not accepted by |\etocsetlevel|, it can be used with
-% |\etocsettagdepth| (which accepts equivalently |none|).
+% level |-3| is now again not accepted by \csbc{etocsetlevel}, it can be used with
+% \csbc{etocsettagdepth} (which accepts equivalently |none|).
 %    \begin{macrocode}
 \def\etocdepthtag   #1#{\Etoc@depthtag } % \etocdepthtag.toc {name}
 \def\Etoc@depthtag  #1{\addtocontents {toc}{\protect\etoc@depthtag {#1}}}
 %    \end{macrocode}
-% |1.09f| adds \csa{etocimmediatedepthtag.toc}.  This can serve in some
+% |1.09f| adds \csbc{etocimmediatedepthtag.toc}.  This can serve in some
 % circumstances, see user documentation.  Apologies for long delay to Norman
 % Ramsey who reported problem and his fix in July... 2016!
 %    \begin{macrocode}
@@ -10130,22 +10208,22 @@ body).
    }%
 }%
 %    \end{macrocode}
-% |1.07g|. Initial version of \csa{etocsetnexttocdepth}.
+% |1.07g|. Initial version of \csbc{etocsetnexttocdepth}.
 %
-% |1.08h|: avoid after-effect of consecutive uses of \csa{etocsetnexttocdepth}
+% |1.08h|: avoid after-effect of consecutive uses of \csbc{etocsetnexttocdepth}
 % with no intervening TOC, due to the fact that the command did an immediate
 % modification of the |tocdepth counter|. This is now delayed until
 % the actual TOC typesetting.
 %
-% |1.09|: slight refactoring of \cs{etocsetnexttocdepth} to let it be usable
-% from first argument of \cs{etocsettocstyle} although it is even simpler to
-% use \cs{etocsettocdepth} there, because the setting is automatically undone
+% |1.09|: slight refactoring of \csbc{etocsetnexttocdepth} to let it be usable
+% from first argument of \csbc{etocsettocstyle} although it is even simpler to
+% use \csbc{etocsettocdepth} there, because the setting is automatically undone
 % at end of TOC.
 %
 % Recall that etoc allows to change all numeric
 % levels assigned to sectioning names, and the one used by
-% \cs{etocsetnexttocdepth} is determined at time of next toc only, when
-% \cs{Etoc@tocdepthset} will expand.
+% \csbc{etocsetnexttocdepth} is determined at time of next toc only, when
+% \csbc{Etoc@tocdepthset} will expand.
 %    \begin{macrocode}
 \def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }%
 \def\invisiblelocaltableofcontents
@@ -10183,7 +10261,7 @@ body).
    {\protect\etoc@setlocaltop\expandafter\protect\csname Etoc@#1@@\endcsname}}%
 }%
 %    \end{macrocode}
-% |1.09f| adds \csa{etocimmediatesetlocaltop.toc}.
+% |1.09f| adds \csbc{etocimmediatesetlocaltop.toc}.
 %    \begin{macrocode}
 \def\etocimmediatesetlocaltop #1#{\Etoc@set@localtop@immediately}%
 \def\Etoc@set@localtop@immediately #1{%
@@ -10199,6 +10277,10 @@ body).
     \endgroup
    }%
 }%
+%    \end{macrocode}
+% |1.09i| would like to rename this to \csa{Etoc@setlocaltop}, for
+% consistency with internal macros, but too late it is already in user |.toc| files.
+%    \begin{macrocode}
 \def\etoc@setlocaltop #1{%
   \global\let\Etoc@level #1%
   \Etoc@skipthisonefalse
@@ -10213,7 +10295,7 @@ body).
       \Etoc@skipthisonetrue
      \else
 %    \end{macrocode}
-% Attention, |1.09| has \cs{etoclocaltop} which is former \cs{Etoc@localtop}
+% Attention, |1.09| has \csbc{etoclocaltop} which is former \csa{Etoc@localtop}
 % \emph{minus one}. Hence the shape of the conditional. Memo: it makes sense
 % only for code executed under "active" status of the TOC.
 %    \begin{macrocode}
@@ -10225,24 +10307,24 @@ body).
     \fi
    \fi
   \fi
-  \let\Etoc@next\@gobble
+  \let\Etoc@next\@empty
   \ifEtoc@skipthisone
   \else
    \ifnum\c@tocdepth<\Etoc@level
    \else
     \ifEtoc@standard
     \else
-     \let\Etoc@next\@firstofone
+     \let\Etoc@next\Etoc@setlocaltop@doends@dobegins
     \fi
    \fi
   \fi
 %    \end{macrocode}
 % At |1.09f| the |\global\Etoc@skipprefixfalse| is added.  This fixes a
-% weird problem that an |\etocskipfirstprefix| from this level (which a priori
+% weird problem that an \csbc{etocskipfirstprefix} from this level (which a priori
 % only serves to delimit the local contents) impacted (in the global TOC for
 % example) the rendering of the first finer subsequent heading.  Not resetting
 % the boolean was an oversight, and it shows in context of the package
-% built-in level styles as they do use |\etocskipfirstprefix|.  But this also
+% built-in level styles as they do use \csbc{etocskipfirstprefix}.  But this also
 % stresses that the name of the macro is a bit of a misnomer, yes it serves to
 % delimit local table of contents, but really it is implemented as a ghost of
 % a sectioning unit which does have an impact (on the global TOC or local TOCs
@@ -10251,12 +10333,23 @@ body).
 % level will be executed sooner or later), and the \marg{start} code of
 % subsequent finer levels (as well as its own \marg{start} code at least once,
 % depending on how levels are nested).
+%
+% |1.09i| fixes a bad behaviour of \etoc in \csbc{etocchecksemptiness} regime
+% when \csbc{etocsetlocaltop.toc} has been made use of in the document.  Indeed
+% the execution of \csbc{Etoc@toctoks} for the emptiness check thus triggered
+% execution of \marg{start} and \marg{finish} parts of the line styles.  So
+% we abstract an \csbc{Etoc@setlocaltop@doends@dobegins} which will be made a no-op
+% in emptiness-checking contexts.  Also, the code lines above have been edited
+% now that \csa{Etoc@next} here is not followed by tokens within a brace pair.
 %    \begin{macrocode}
-  \Etoc@next{\Etoc@doends\Etoc@dobegins\global\Etoc@skipprefixfalse}%
+  \Etoc@next
 }%
+\def\Etoc@setlocaltop@doends@dobegins
+   {\Etoc@doends\Etoc@dobegins\global\Etoc@skipprefixfalse}%
 %    \end{macrocode}
+%    \begin{macrocode}
 % |1.07h|. In order for the |.toc| file to be usable without error even
-% without etoc. In |1.07i| use of |\@gobble| for |\etoc@settocdepth|.
+% without etoc. In |1.07i| use of |\@gobble| for \csbc{etoc@settocdepth}.
 %    \begin{macrocode}
 \addtocontents {toc}{\protect\@ifundefined{etoctocstyle}%
            {\let\protect\etoc@startlocaltoc\protect\@gobble
-- 
cgit v1.2.3

