<..article et al tocs..>
\def\tableofcontents{%
\ifx\contentsname\empty \else
\ifx\contentsname\:UnDef \else
<.protect from TocAt.>\section*{\contentsname}%
<.end protect from TocAt.>%
\fi\fi
\:tableofcontents}
-_-_-
<..book et al tocs..>
\def\tableofcontents{%
\ifx\contentsname\empty \else
<.protect from TocAt.>\chapter*{\contentsname}%
<.end protect from TocAt.>%
\fi
\:tableofcontents}
-_-_-
Without the following, the chapter*/section* introduces the cutat configuration for the \tableofcontents
<..protect from TocAt..>
%
-_-_-
<..end protect from TocAt..>
%
-_-_-
<..html latex tocs..>
\edef\:TOC{%
\noexpand\ifx [\noexpand\:temp
\noexpand\expandafter\noexpand\:TableOfContents
\noexpand\else
\noexpand\Auto:ent{<.entries for latex tocs.>}%
\noexpand\fi}
<.latex et al tocs.>
-_-_-
<..latex et al tocs..>
\def\:tableofcontents{\futurelet\:temp\:TOC}
\def\Auto:ent#1{%
\edef\auto:toc{\noexpand\:TableOfContents[\ifx \auto:toc\:UnDef
#1\else \auto:toc \fi]} \auto:toc
\global\let\auto:toc=\:UnDef }
-_-_-
<..html /addcontentsline..>
\def\addcontentsline#1#2#3{\if@filesw \begingroup
\no:lbl:idx \let\protect\@unexpandable@protect
\@temptokena{\thepage}%
<.revised /addcontentsline.>\@tempa
\if@nobreak \ifvmode\nobreak\fi\fi\endgroup\fi}
-_-_-
The redefinition of \addcontentsline should preserve vertical mode. The following is the modification to the original def.
<..revised /addcontentsline..>
\def\:tempb{#1}\def\:tempa{toc}%
\ifx \:tempb\:tempa
<.addcontentsline html addr.>%
\hbox{\Link{}{\:tempb}\EndLink}%
\edef\@tempa{<.add contents line.>}%
\else
\gHAdvance\TitleCount by 1%
<.non-toc addcontentsline html addr.>%
\hbox{\Link{}{<.haddr prefix.>\last:haddr}\EndLink}%
\edef\@tempa{<.add non-toc contents line.>}%
\fi
-_-_-
<..non-toc addcontentsline html addr..>
\html:addr
-_-_-
<..add non-toc contents line..>
\csname if:toc\endcsname{\the\:tokwrite{\string\doTocEntry
\string\toc#1{}{\string\csname\space a:TocLink\string\endcsname
{\FileNumber}{<.haddr prefix.>\last:haddr}{}{#3}}{\the\@temptokena}\relax}}%
-_-_-
<..add contents line..>
\csname if:toc\endcsname{\the\:tokwrite{\string\doTocEntry
\string\toc#2{}{\string\csname\space a:TocLink\string\endcsname
{\FileNumber}{\:tempb}{}{#3}}{\the\@temptokena}\relax}}%
-_-_-
In the above link,
<..addcontentsline html addr..>
\edef\:tempb{<.section html addr.>}%
-_-_-
Instead of
\NewHaddr\:tempb
-_-_-
<..add aux line..>
\write \@auxout{\string\@writefile{#1}{\protect
\contentsline{#2}{#3}{\the\@temptokena}}}%
-_-_-
The command \addvspace may appear at start of list of tables and it must be reached in vertical mode (see list tables – lot).
The following goes also into non-core latex. Do we need ‘ \Configure{cite}{}{}{}{}%’ in the following?
<..html latex.ltx core..>
\def\@starttoc#1{%
\begingroup
\makeatletter
\def\:temp{#1}\def\:tempa{toc}%
\ifx \:temp\:tempa
\@input{\jobname.4ct}%
\else
\@input{\jobname.#1}%
\if@filesw
\expandafter\expandafter\csname
newwrite\endcsname\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
\fi
\global\@nobreakfalse
\endgroup}
-_-_-