[Tex/LaTex] hyperref pdf table of contents messed up (probably bookmarks problem)

bookmarkshyperref

I have trouble with my thesis document. The sidebar table of contents (when opening in a pdf viewer) has a wrong ordering. Even though chapter 1 and chapter 2 are on the same hierarchical plane in the sidebar pdf toc chapter 2 is under chapter 1 (and chapter 3 and all other chapters are under chapter 2).

The normal table of contents in the document is fine. I think it has something with bookmarks (which I'm not 100% sure what they are).

After I fix a mistake in my latex document and latex doesn't compile fully. The next compile ends with the error:


Runaway argument?

{\376\377\0002\000.\0005\000.\0001\000\040\000R\000o\000t\000a\000t\0\ETC.
./thesis.tex:293 (which is \begin{document}: File ended while scanning use of \@@BOOKMARK.

trashing the aux file clears that and the next compile is fine again (the ordering of the pdf toc is still messed up).

How do I debug that? I can't really disable packages as they are tightly integrated. Any suggestions are welcome.

Best Answer

The bookmarks are the things in the sidebar. The runaway error probably means that one of your \chapter etc command contains something which breaks when hyperref tries to put it in the bookmark. Inspect the aux and the out file. Perhaps you can find the culprit. Or put \end{document} in the middle of your document and then move it around until you find the point where the error appears.

Related Question