TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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? – Herbert Aug 16 '11 at 9:07
up vote 2 down vote accepted

The bookmarks are the things in the sidebar. The runaway error probably maens that one of your \chapter etc command does 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.

share|improve this answer
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. – Wolfgang Kerzendorf Aug 16 '11 at 10:19
Thank you Ulrike! – Wolfgang Kerzendorf Aug 16 '11 at 10:20
You can try to protect fragile commands with \protect\gls.... Or use \texorpdfstring: tex.ac.uk/cgi-bin/texfaq2html?label=texorpdf – Ulrike Fischer Aug 16 '11 at 10:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.