Closed davidwlindholm closed 2 years ago
I found the later twisted issue is that it breaks margintoc, so beware of that anyone using this solution.
In a project that uses kaobook I fixed a compilation warning that seems related^1. Can you try adding the following lines to your document? If that fixes it I'll try to make a pull request.
% Tell hyperref at which level should it define the PDF bookmarks associated with margin tocs (kaobook doesn't
% define that level, I set it one level deeper than sections).
\makeatletter
\providecommand*{\toclevel@mtocsection}{0}
\edef\toclevel@authorch{\the\numexpr\toclevel@section+1}
\makeatother
Wait, now I see that it doesn't fix your issue, it just sets a (incorrect even?) level for the margin toc sections, but doesn't prevent them from appearing twice.
Ok so after a more careful inspection of this issue, it seems that my fix is completely misguided and we're simply both using an old version of kaobook. This issue seems to be a duplicate of https://github.com/fmarotta/kaobook/issues/155, which was fixed in https://github.com/fmarotta/kaobook/commit/80621c55a725cad60a4b67344c88499cbd6351f9.
Does using the latest kao.sty
from master fix your issue? It did for me.
Description
Sections are added twice to the PDF table of contents, and subsections appear superior to sections (That is, sections are folded into subsections).
Minimal Working Example
Compile the Machine Learning Project example, and look at the table of contents in any PDF viewer (the embedded ToC).
Expected behavior: PDF ToC is similar to the ToC section of the document.
Actual behavior: See description. Tested with TeX 3.141592653 (TeX Live 2021/Arch Linux). Possibly caused by changes in the etoc package?
Additional Information
Commenting out lines 901 and 921 of kao.sty fixes the problem. No idea why or what those lines are supposed to do as I can barely read the code, and the comments aren't much clearer. So it's entirely possible this creates some twisted issue somewhere else, but for now I'm just happy it works.