Giter Site home page Giter Site logo

etoc's People

Contributors

jfbu avatar

Stargazers

 avatar

Watchers

 avatar

etoc's Issues

\emph raises warnings where \textit would not

In the test file for #5, once one uncomments the two lines

% commenting this out removes Warnings
%\renewcommand\etocaftertitlehook{\AssignSocketPlug{tagsupport/minipage/before}{noop}%
%                                 \AssignSocketPlug{tagsupport/minipage/after}{noop}}%

to fix the warnings (or use an updated etoc.sty, from attow a yet to be pushed commit), warnings go away, but some come back via using \emph in place of textit:

\etocsetlinestyle{subsection}
   {\begin{minipage}[c]{0.6\linewidth}\etocskipfirstprefix}
   {\par}
   {\etocnumber{} (\emph{page \etocpage})}% ok with \textit
   {\end{minipage}}

I have yet to push a minimal example for this. Later.

Simplest etoc with a tabular causes `there is no mc to end` and raises `there is no open structure on the stack` error at end document

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{article}
\usepackage{etoc}
\usepackage{hyperref}
\usepackage{array}

\begin{document}
    

\begingroup
\etocglobaldefs % necessary for \etocname etc... to survive to & closing groups

\etocsetlinestyle{section}
  {}
  {\\\etocnumber&\etocname &\etocpage }
  {}
  {}

\etocsettocstyle{\begin{tabular}{ccc}number&name&page}{\end{tabular}}

\tableofcontents

\endgroup

\section{One}

\section{Two}

\section{Three}

\section{Four}

\end{document}

This looks as being in the same area as #20.

Simplest line style using \parbox creates warnings

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{article}

\usepackage{etoc}
%\etocfallbacklines

\etocsetstyle{section}
  {}
  {\parbox{2.5cm}{\etocname}\par}% \par pour éviter le jfbu/etoc#9
  {}
  {}

\begin{document}

\tableofcontents

\section{foo}

\end{document}

generates warnings (not at 2024-01-02 but since 2024-01-03). With current HEAD:

Package tagpdf Warning: Parent-Child 'TOCI/' --> 'MC (realcontent)'.
(tagpdf)                Relation is not allowed (struct 9, /Div) on line 21

The etoc framed style as global style generates "relation is not allowed" warnings

This test file generates warnings starting with (on first compilation)

Package tagpdf Warning: Parent-Child 'P/' --> 'Sect/pdf2'.
(tagpdf)                Relation is not allowed (struct 22, /text --> struct
(tagpdf)                23) on line 31

This happens on the first local TOC using tagging plus the etoc "framed" style.

EDIT: thus this warning is raised on first \section after \localtableofcontents, the latter not doing much on first compilation as the toc file is still empty.

Snippet 25 generates Parent-Child 'Reference/' --> 'Reference/pdf' warning

25

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-25.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%% EDITED - to remove KOMA dependency
%%        - add chapter style
%%        - use \@gobbletodot with \ifnum due to section number format in report class
\makeatletter
\def\@gobbletodot#1.{}
\newcommand*{\MyQuasiStandardTOC}[2][]{%
  % #1 is an optional "\ref{somelabeltoanothertoc}"
  % #2 is the number of some exceptional section
  \begingroup
  \etocsetlinestyle{section}
    {}
    {\etociffirst{% Suppress display of subsections for the first section!
                  \etocsetlevel{subsection}{\etocthemaxlevel}}
                 {\etocsetlevel{subsection}{2}}
%%%%%%%% UPDATED FOR TEST
     \ifnum\expandafter\@gobbletodot\etocthenumber=#2 % Handle especially section number #2 !
      \etocsetlinestyle{subsection}
        {\def\foo{}\par\nopagebreak\begingroup
         \leftskip2em \rightskip\@tocrmarg
         \parfillskip \@flushglue
         \parindent 0pt
         \normalfont\normalsize\rmfamily\itshape
         \etocskipfirstprefix}
        {\allowbreak\,--\,}
        {\edef\foo{\the\numexpr\foo+1}\etocname\ \textup{(\etocnumber)}}
        {.\par \upshape My AI counted circa \foo\space subsections,
                        was it right?\par\endgroup}%
     \else
%%%%%% UPDATED FOR TEST
      \ifnum\expandafter\@gobbletodot\etocthenumber>#2 % Only count subsections in those sections !
        \etocsetlinestyle{subsection}
        {\def\foo{}}%
        {\edef\foo{\the\numexpr\foo+1}}%
        {}%
        {\leftskip2em \emph{There are \foo\space subsections here,
                      but I will need payment to display them.}\par}%
      \else
        \etocsetlinestyle{subsection}
        {}%
        {}%
        {\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}%
        {}%
      \fi
    \fi
    }%
    {% Display in a special color the number of the special section!
%%%%%%%% UPDATED FOR TEST
     \l@section{\numberline{{\ifnum\expandafter\@gobbletodot\etocthenumber=#2
                             \color{red}\else\color{cyan}\fi\etocthenumber}}%
                \etociffirst{\etocname\space (SUBSECTIONS SKIPPED)}{\etocname}}
               {\etocpage}}%
    {}%
  \etocclasstocstyle % will use the ambient document class
     % special KOMA-script customization as this document uses scrartcl
     % and we need to enlarge numwidth for some subsections
%%%%%%%%     \DeclareTOCStyleEntry[numwidth=2em,indent=0pt]{tocline}{section}
%%%%%%%%     \DeclareTOCStyleEntry[numwidth=2.5em,indent=2em]{tocline}{subsection}
  \etocsetnexttocdepth {subsection}%
  \tableofcontents #1
  \endgroup
}
\makeatother

Snippet 14 generates Parent-Child 'TOC/' --> 'Reference/pdf' warning

14

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-14.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%% EDITED to become test-able
%%%%%%%%   < in the preamble >
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
   {\stepcounter{visibletoc}\etoctoccontentsline{visibletoc}{\thevisibletoc}}
\etocsetlevel{visibletoc}{\etocthemaxlevel}
%%%%%%%%\begin{document}
%%%%%%%%   < document body >
%%%%%%%%\subsection{Surprising uses of etoc}
\begingroup
    \etocinline
    \etocsetlevel{part}{1}
    \etocsetlevel{chapter}{1}
    \etocsetlevel{visibletoc}{0}
    \etocsetlinestyle{visibletoc}
        {\etocskipfirstprefix}{, }{{\color{blue}\etocname}}{}
    \etocsettocstyle{}{}     % don't set any title, rules or frame or multicol!
    \etocsetnexttocdepth{visibletoc} % display only the `visibletoc' entries from .toc

Here is the numbered and linked list of all tables of contents which are
displayed within this document: \tableofcontents.
\endgroup

tagpdf warning "The structure Sect can not be closed." (or Part) on first compilation with a local toc

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{book}

\usepackage{etoc}

\begin{document}

% \tableofcontents

\part{ONE}

\etocsettocstyle{\section*{\contentsname}}{}% the structure Sect can not be closed

% \etocsettocstyle{}{}% the structure Part can not be closed


\localtableofcontents

\chapter{Test chapter one}

\end{document}

gives on first pdflatex build:

Package tagpdf Warning: The structure Sect can not be closed.
(tagpdf)                It is not equal to the current structure Part on the
(tagpdf)                main stack

(twice)

It is probable this is related to #1.

Using `\l@section` from custom etoc line styles causes "Relation is not allowed" and "nested marked content found"

There is already in current CTAN etoc.pdf a warning in the section "Another compatibility mode" that the methods described there-in may prove incompatible with tagging. At that time I had not yet implemented the experimental etoc tagging support, now that a first version is done the predictions are confirmed with this example:

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{book}
\usepackage{etoc}
\usepackage{hyperref}

\etocchecksemptiness

\etocsettocdepth{subsubsection}

% Code slightly extended from etoc.pdf "Another compatibility mode"
% (currently 2024/01/03 code snippet number 7)
\makeatletter
\newcommand{\MyLocalTOC}[1][section]{%
  \begingroup
  \etocsetstyle{chapter}{}{}
    {\l@chapter{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{section}{}{}
    {\l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{subsection}{}{}
    {\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{subsubsection}{}{}
    {\l@subsubsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  % etc... if further sectioning units are needed
  %        (i.e. not excluded by tocdepth and actually there in document)
  % Here #1 defaults to section, meaning this is appropriate
  % for local TOC in a chapter
  \etocsettocstyle{\@nameuse{#1}*{Local contents}}
                  {}%
  %
  \localtableofcontents
  \endgroup}
\makeatother

\begin{document}

\tableofcontents

\part{ONE}

\MyLocalTOC

\chapter{Test chapter one}

\MyLocalTOC

\section{Section one one}

\MyLocalTOC[subsection]

\subsection{Subsection one one one}

celle-ci sera vide
\MyLocalTOC
et rien ne doit apparaître

\subsection{Subsection one  one two}

\end{document}

which produces on second compilation many many warnings such as

Package tagpdf Warning: Parent-Child 'Reference/' --> 'Reference/pdf'.
(tagpdf)                Relation is not allowed (struct 41, /Reference -->
(tagpdf)                struct 42) on line 46


Package tagpdf Warning: nested marked content found - mcid 44

Things like \l@section from the kernel will execute tagging hooks. But for this to work other kernel tagging hooks have to be active, those of \@starttoc, those of \contentsline. So user can not employ \etoctaggingoff. But under \etoctaggingon regime not only are those tagging hooks done, also currently in the \Etoc@etoccontentsline@ there will be some \tag_struct_begin:n{tag=Reference} etc..., besides the \etocnumber will already be equipped with its own \tag_mc_end:\tag_struct_begin:n{tag=Lbl} etc....

The "wontfix" is tempting, but I see a way via adding an \etoclinetaggingoff (name to be chosen later) which would turn off only some of etoc tagging. This could work.

Sect can not be closed if attempting to use second argument of \etocsettocstyle (or \etocaftercontentshook) to insert a numbered section

Both
\etocsettocstyle{}{\section{Numbered section after contents}}
and
\def\etocaftercontentshook{\section{Hello}}
will cause warning
The structure Sect can not be closed.
and later at end document
The number of automatic begin (N+1) and end (N) text para hooks differ!

Of course this use case probably does not exist in real world. But it should be investigated as it could a symptom of something else and may be related to same mechanism as was underlying #9 and #11 in relation to the fact that all of this happens in a group where the \@starttoc kernel hooks have been copied over and executed.

test file a

test file b

Snippet 10 generates Parent-Child 'StructTreeRoot/pdf' --> 'Div/pdf2' warning

10

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-10.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%% EDITED (\ref) (\etoc)
\etocfallbacklines
\begingroup
\renewcommand{\etoccolumnsep}{2em}
\renewcommand{\etocinnerleftsep}{1.5em}
\renewcommand{\etocinnerrightsep}{1.5em}
% specify a background color for the toc contents
\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
% set up the top and bottom rules
\renewcommand{\etoctoprule}{\hrule height 1pt}
\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
\renewcommand{\etocbottomrule}{\hrule height 1pt}
\renewcommand{\etocbottomrulecolorcmd}{\color{red!25}}
% set up the left and right rules
\renewcommand{\etocleftrule}{\vrule width 5pt}
\renewcommand{\etocrightrule}{\vrule width 5pt}
\renewcommand{\etocleftrulecolorcmd}{\color{red!25}}
\renewcommand{\etocrightrulecolorcmd}{\color{red!25}}
% use \fcolorbox to set up a colored frame for the title
\fboxrule1pt
\renewcommand{\etocbelowtocskip}{0pt\relax}
\etocframedstyle {\normalsize\rmfamily\itshape
  \fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
      This is a table of contents \`a la etoc, but for
      the subsections and subsubsections of \autoref{sec:tocstyle}.
      As it is put in a frame, it has to be small enough to fit on
      one page. It has the label |toc:b|.}}}
\begin{figure}[ht!]
  \centering
\tableofcontents %%%%%%%%\label{toc:b} \ref{toc:tocstyle}
\end{figure}
\endgroup

Inline TOC raises warnings

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{article}
\usepackage{etoc}
\begin{document}
\etocsetstyle{section}
  {(start) }
  {\etocname, }%
  {}
  {(end) }%

% The TOC contents with default TOC title starts in vmode.
% With empty TOC title it will depend if \tableofcontents
% is issued when in horizontal mode: by default etoc
% does \par, but \etocinline suppresses that.

\etocinline % avoids an added \par before title

\etocsettocstyle{}{} % no title

This is an inline TOC
\tableofcontents
and the end of the paragraph.

\section{One}

Text

\section{Two}

Text

\end{document}

First warning is

Package tagpdf Warning: Parent-Child 'P/' --> 'TOC/pdf'.
(tagpdf)                Relation is not allowed (struct 5, /text --> struct 6)
(tagpdf)                on line 29

Error raised with simplest custom line style not using \par

Document using

\etocsetstyle{section}
  {}
  {\etocname, }% no error if a \par here
  {}
  {}% no error if a \par here

%\def\etocaftercontentshook{\par}% no error if using this

\tableofcontents
\section{foo}
\end{document}

generates on second compilation warnings then errors with

! Package tagpdf Error: The number of automatic begin (2) and end (3)
(tagpdf)                text-unit para hooks differ!

Snippet 04 generates Parent-Child 'StructTreeRoot/pdf' --> 'Sect/pdf2' warning

04

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-04.tex'
%% generated by the `filecontentsdef' environment
%% from source `etoc' on 2024/01/12.
%% EDITED (\ref)
\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
\etocsetlinestyle {section}
              {}
              {\leavevmode\leftskip 0cm\relax}
              {\bfseries\normalsize\makebox[.5cm][l]{\etocnumber.}%
               \etocname\nobreak\hfill\nobreak
               \rlap{\makebox[1cm][r]{\mdseries\etocpage}}\par}
              {}
\etocsetlinestyle {subsection}
              {}
              {\leavevmode\leftskip .5cm\relax }
              {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
               \etocname\nobreak\hfill\nobreak
               \rlap{\makebox[1cm][r]{\etocpage}}\par}
              {}
\etocsetlinestyle {subsubsection}
              {}
              {\leavevmode\leftskip 1.5cm\relax }
              {\mdseries\normalsize\makebox[1cm][l]{\etocnumber}%
               \etocname\nobreak\hfill\nobreak
               \rlap{\makebox[1cm][r]{\etocpage}}\par}
              {}
\etocruledstyle[1]{\bfseries \Large My first eTOC of}
%  \autoref{part:overview} (\nameref{part:overview})}
\tableofcontents \ref{toc:overview}
\endgroup

\locallistoffigures generates warnings

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}

\documentclass{article}
\usepackage[lof]{etoc}

%\usepackage{hyperref}

\begin{document}

%\tableofcontents

%\listoffigures

\section{foo}

% \localtableofcontents

\locallistoffigures

\subsection{subfoo1}

\begin{figure}[htbp]
  \centering
  figure coucou
% non captioned figures do not make it to the lof file
  \caption{figure1}
\end{figure}

\end{document}

generates

Package tagpdf Warning: Parent-Child 'TOCI/' --> 'text-unit/user'.
(tagpdf)                Relation is not allowed (struct 10, /TOCI --> struct
(tagpdf)                11) on line 24

on second compilation.

Typesetting material injected via "start" or "finish" parts of etoc line style are directly under <TOC> struct, not <TOCI> and then \emph in particular causes problem

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}
\documentclass{article}
\usepackage{etoc}

\begin{document}
    
\etocsetlinestyle{section}
  {This is not in a TOCI}
  {}
  {}
  {this neither thus \emph{CAUSES A PROBLEM}}

\tableofcontents

\section{One}

\section{Two}

\section{Three}

\section{Four}

\end{document}

raises on second compilation

Package tagpdf Warning: Parent-Child 'TOC/' --> 'Em/pdf2'.
(tagpdf)                Relation is not allowed (struct 6, /TOC --> struct 15)
(tagpdf)                on line 19

Very tempting to add a wont-fix. On the other hand it may be occasion to use the existing etoc internal stack of begins and ens to completely change current tagging strategy and invoke the contentsline upstream hooks from these begins and ends (starts and finishes) parts rather than from where they are currently.

Snippet 01 generates Parent-Child 'TOC/' --> 'enumerate/user' warning

01

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-01.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%%
\etocsetlinestyle{section}
{\begin{enumerate}}
{\normalsize\bfseries\rmfamily\item}
{\etocname{} (page \etocpage)}
{\end{enumerate}}

\etocsetlinestyle{subsection}
{\begin{enumerate}}
{\normalfont\item}
{\etocname{} (p.~\etocpage)}
{\end{enumerate}}

\etocsetlinestyle{subsubsection}
{\par\nobreak\begingroup\normalfont
        \footnotesize\itshape\etocskipfirstprefix}
{\allowbreak\,--\,}
{\etocname}
{.\hfil\par\endgroup\pagebreak[3]}

Snippet 20 generates Parent-Child 'Reference/' --> 'text/user' warning

20

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-20.tex'
%% generated by the `filecontentsdef' environment
%% from source `etoc' on 2024/01/12.
%% EDITED - \ref
%%        - add chapter style!
%% NOTA BENE there is an extra white line in section lines
%%           which goes away if using \etocthename
%%           and also is not there if no tagging
\begin{center}
\etocsetlinestyle{chapter}
             {}
             {\\\hline\hline}
             {\multicolumn{3}{|c|}{\etocname}}
             {}


\etocsetlinestyle{section}
             {}
             {\etociffirst{\\\hline\hline}{\\\hline}}
             {\etocname & \etocnumber & \etocpage }
             {}

\etocsettocstyle
   {\hypersetup{hidelinks}\begin{tabular}{|>{\RaggedRight}p{4.5cm}|c|c|}\hline
    \multicolumn{1}{|c|}{\bfseries Section title}&
    \bfseries number&
    \bfseries page}
   {\\\hline\end{tabular}}

\etocglobaldefs % MANDATORY !!
\etocsetnexttocdepth{1}

\tableofcontents%%%%%%%%\ref{toc:overview}
\end{center}

Snippet 02 generates Parent-Child 'StructTreeRoot/pdf' --> 'Div/pdf2' warning

02

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-02.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%% EDITED (\etoc)
\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
  \fbox{\parbox{.6\linewidth}{
      \leftskip 0pt plus .5fil
      \rightskip 0pt plus -.5fil
      \parfillskip 0pt plus 1fil This is the global table of
      contents on two columns, using etoc default line styles, but with
      sections as chapters, and subsections as sections.
      }}}
\etocfallbacklines
\etocsetnexttocdepth{1}
\begingroup
\etocsetlevel{section}{0}
\etocsetlevel{subsection}{1}
\renewcommand*{\etocfontone}{\normalfont \normalsize}
\renewcommand*{\etoctoclineleaders}
        {\hbox{\normalfont\normalsize\hbox to 1ex {\hss.\hss}}}
\sloppy
\tableofcontents
\endgroup

A minipage originating in {<start>} part of a custom line style causes tagging warnings

This test file raises warnings on second compilation from the minipage inside the subsection line style (the minipage originate in this line style via its {<start>} first argument, is executed on the first subsection toc line after a section toc line).

Package tagpdf Warning: Parent-Child 'Sect/' --> 'TOCI/pdf'.
(tagpdf)                Relation is not allowed (struct 174, /Div --> struct
(tagpdf)                192) on line 50

Related: #4

Indicates probably I was wrong after fixing #4 to reactivate the minipage tagging sockets for the contents.

Can not use upstream `TOC` struct creating hooks inside a figure or table environment (not an etoc issue)

11

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-11.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2024/01/12.
%% EDITED (\ref)
\begin{figure}[htbp!]\centering
\colorlet{subsecnum}{black}
\colorlet{secbackground}{green!30}
\colorlet{tocbackground}{red!20!green!20}

\renewcommand{\etocbkgcolorcmd}{\color{tocbackground}}
\renewcommand{\etocleftrulecolorcmd}{\color{tocbackground}}
\renewcommand{\etocrightrulecolorcmd}{\color{tocbackground}}
\renewcommand{\etocbottomrulecolorcmd}{\color{tocbackground}}
\renewcommand{\etoctoprulecolorcmd}{\color{tocbackground}}

\renewcommand{\etocleftrule}{\vrule width 3cm}
\renewcommand{\etocrightrule}{\vrule width 1cm}
\renewcommand{\etocbottomrule}{\hrule height 12pt}
\renewcommand{\etoctoprule}{\hrule height 12pt}

\renewcommand{\etocinnertopsep}{0pt}
\renewcommand{\etocinnerbottomsep}{0pt}
\renewcommand{\etocinnerleftsep}{0pt}
\renewcommand{\etocinnerrightsep}{0pt}

\newcommand\shiftedwhiterule[2]{%
    \hbox to \linewidth{\color{white}%
    \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip
    \vskip#2}

\etocsetlinestyle{subsubsection}
{\etocskipfirstprefix}
{\shiftedwhiterule{\leftskip}{6pt}}
{\sffamily\footnotesize
  \leftskip2.3cm\hangindent1cm\rightskip.5cm\relax
  \makebox[1cm][l]{\color{subsecnum}\etocnumber}%
  \color{black}\etocname
  \nobreak\leaders\hbox to.2cm{\hss.}\hfill
  \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
  \nointerlineskip\vskip3pt}
{}

\etocsetlinestyle{subsection}
{\etocskipfirstprefix}
{\shiftedwhiterule{1.5cm}{6pt}}
{\sffamily\small
  \leftskip1.5cm\hangindent.8cm\rightskip.5cm\relax
  \makebox[.75cm][l]{\color{subsecnum}\etocnumber}%
  \color{black}\etocname
  \nobreak\leaders\hbox to.2cm{\hss.}\hfill
  \rlap{\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}\par
  \nointerlineskip\vskip3pt}
{}

\newcommand{\coloredstuff}[2]{%
            \leftskip0pt\rightskip0pt\parskip0pt
            \fboxsep0pt % \colorbox uses \fboxsep also when no frame!
       \noindent\colorbox{secbackground}
               {\parbox{\linewidth}{%
                    \vskip5pt
                    {\noindent\color{#1}#2\par}\nointerlineskip
                    \vskip3pt}}%
       \par\nointerlineskip}

\etocsetlinestyle{section}
{\coloredstuff{blue}{\hfil \bfseries\large Contents of Part One\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{blue}
    {\leftskip1.5cm\rightskip.5cm\parfillskip-\rightskip
     \makebox[0pt][r]{\makebox[.5cm][l]{\etocnumber}}%
     \etocname\nobreak\hfill\makebox[.5cm][r]{\etocpage\hspace{.1cm}}}%
 \vskip6pt}
{}

\etocframedstyle[1]{}
\tableofcontents %%%%%%%%\label{toc:floating} \ref{toc:part:styling}
%%%%%%%%\vspace{-\baselineskip}
%%%%%%%%\centeredline{|\tableofcontents \ref{toc:part:styling}|
%%%%%%%%(\emph{cf.} \hyperref[toc:clone]{this other toc})}
\end{figure}
\endinput

Snippet 19 generates Parent-Child 'Reference/' --> 'text-unit/user' warning

19

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-19.tex'
%% generated by the `filecontentsdef' environment
%% from source `etoc' on 2024/01/12.
%% EDITED: added chapter style!
\begingroup
\etocglobaldefs % necessary for \etocname etc... to survive &
\makeatletter
%<irrelevant hack into longtable from original post has been removed>

% observe the locations of the \\
\etocsetlinestyle{part}
  {}
  {}
  {\\\hline\multicolumn{3}{c}{\bfseries\vrule height6ex depth3ex width0pt
                              \makebox[0pt]{\etocifnumbered{\etocnumber. }{}\etocname}}}
  {}

\etocsetlinestyle{chapter}
             {}
             {\\\hline\hline}
             {\multicolumn{3}{|c|}{\etocname}}
             {}


\etocsetlinestyle{section}
  {}
  {\etociffirst{\\\hline}{\\}}
  {\etocnumber&\etocname &\etocpage }
  {}

\etocsetlinestyle{subsection}
  {}
  {\\}
  {&\makebox[1cm][c]{\etocnumber}%
    \parbox[t]{\dimexpr6cm-\tabcolsep\relax}{\sloppy\itshape\etocname\strut}%
   &\itshape\etocpage }
  {}

\etocsettocstyle
    {\hypersetup{hidelinks}%
     \begin{longtable}{|>{\bfseries}c|p{7cm}|r|}
     \hline
     \multicolumn{3}{|c|}{\Large\bfseries\strut\strut TABLE OF CONTENTS}%
     }
    {\\\hline\end{longtable}}

\etocsetnexttocdepth {subsection}

\tableofcontents
\endgroup

Snippet 12 generates Parent-Child 'TOC/' --> 'footnotemark/user' warning

12

%% -*- mode: latex -*-
%% LaTeX2e file `etocsnippet-12.tex'
%% generated by the `filecontentsdef' environment
%% from source `etoc' on 2024/01/12.
%% EDITED: added (empty) chapter style!
\begingroup
\newsavebox{\forsubsections}
\etocsetlinestyle{part}{\upshape. \etocskipfirstprefix}
                   {. \upshape}
                   {\bfseries\etocname:~~}
                   {}
\etocsetlinestyle{chapter}
             {}
             {}
             {}
             {}
\etocsetlinestyle{section}{\itshape\etocskipfirstprefix}
                      {, }
                      {\mdseries\etocname}
                      {}
\etocsetlinestyle{subsection}
    {\begin{lrbox}{\forsubsections}\footnotesize\upshape\etocskipfirstprefix}
    {; }
    {\etocname}
    {.\end{lrbox}\footnote{\unhbox\forsubsections}}
\etocsetlinestyle{subsubsection}
    { (\itshape\etocskipfirstprefix}
    {, }
    {\etocname}
    {\/\upshape)}
\etocsettocstyle{Here is the inline table of contents. }{.\par}
\tableofcontents \label{toc:crazyinline}
\endgroup

lof option incompatible with hyperref

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}

\documentclass{article}
\usepackage[lof]{etoc}
\usepackage{hyperref}

\begin{document}

\end{document}

This raises error at begin document:

! Illegal parameter number in definition of hook 'cmd/addcontentsline/before'.
(hooks)             Offending label: 'hyp'.

I labelled this initially as "tagging" but it is purely a hyperref matter and how it modifies \addcontentsline via generic cmd hook mechanism if tagging is active. Depending on what upstream does, sooner or later this new pathway for hyperref to modify \addcontentsline may or may not be in place independently of tagging. I think it is time to have an "hyperref" label rather.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.