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.

  • There is a missing parenthesis in a macro where its contents is also set as a bookmark. However, I suppose yor thesis will be printed. Why do you then need hyperref?
    – user2478
    Aug 16, 2011 at 9:07

2 Answers 2


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.

  • Answer: There were a couple of problems and one of them or the combination of them solved it. Glossaries should not be referred to in captions even with \glsentryname. For multiple appendices I used \begin{appendices} and \end{appendices}. Both of these combined and the bookmarks work again. Aug 16, 2011 at 10:19
  • You can try to protect fragile commands with \protect\gls.... Or use \texorpdfstring: tex.ac.uk/cgi-bin/texfaq2html?label=texorpdf Aug 16, 2011 at 10:30

For those wanting another solution: I found trashing (clearing) the .aux files and re-running LaTeX helped me with the same error.

I think the issue is that my co-author made some edits, and when I pulled them and ran LaTeX, it did an incremental update with some bad info in the .aux files. Clearing them and re-running helped.

  • 1
    Thanks your solution worked. Mar 3, 2020 at 16:50
  • 1
    But the issue keeps happening again and again. I don't know what's the root cause :( Mar 3, 2020 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .