Reusing TOC vs bookmarks

When the toc file is executed by the first \tableofcontents the BREAK is configured to do \setcounter{tocdepth}{-10}. But hyperref obeys the then current value of tocdepth to decide what goes to the bookmarks. So the main matter sectioning does not make it to the bookmarks.

The second table of contents contains a BREAK which sets the tocdepth to 3. So the appendices sectioning coming next end up in the bookmarks.

See also 11.1. The hyperref option bookmarksdepth in etoc manual.

When modifying the counter tocdepth for the purposes of multiple uses of \tableofcontents or \localtableofcontents, one should be aware that package hyperref by default takes into account the current value of the tocdepth counter to decide whether the pdf file will contain a bookmark corresponding to sectioning commands encountered in the source file. Thus, one typically needs to reset tocdepth to its previous value after having temporarily modified it for a given table of contents.

Or, there is the bookmarksdepth=n option of package hyperref, with n the desired document bookmarks maximal depth, which can be numeric or the name of a level known to hyperref. This documentation previously passed bookmarksdepth=3 as option to hyperref, so even if tocdepth was left to 1 by inadvertance after printing a certain table of contents this did not modify the bookmark tree of the pdf file. Now that \etocsetnexttocdepth has been added to the package, we have used it systematically and there was no need for bookmarksdepth=3 anymore.

You can set bookmarksdepth individually, then it will work:

bookmarksdepth=10 %<-------



% disable TOC part after BREAK



\chapter{Mainmatter chapter}

\section{Mainmatter section}

\subsection{Mainmatter subsection}




% disable before BREAK
% enable after break

\renewcommand\contentsname{Appendices overview}


\chapter{Appendix chapter}

\section{Appendix section}

\subsection{Appendix subsection}


enter image description here