I have encountered an error while trying to add glossaries to a document where I had used \boldsymbol in a \section command, this error occurs only if the package hyperref is loaded.

I hope the proper example is:

\newacronym{ads}{AdS}{Anti-de Sitter}
\printglossary[type=\acronymtype,title=List of Abbreviations]

Are there any nice solutions?


I have also noticed that when I add a contents line for the list (I do not know if I'm doing it how I should) using \addcontentsline{toc}{chapter}{List of Abbreviations} it looks good, but the hyperlink does not work, it jupms to previously created contents line for bibliography, despite the fact, that the list has right page number in contents. Is it also an issue of glossaries together with hyperref

  • 2
    With hyperref it's a good idea to wrap math in sections with texorpdfstring like so: \section{\texorpdfstring{$\boldsymbol{B}$}{B}} – Mass Jul 13 '14 at 17:24
  • You're right, it solves the first problem, thanks. May be you should promote this comment to an answer :) – fales Jul 13 '14 at 17:36
  • 2
    Your are posting two, basically not connected questions in one. While user Mass answered the main question, the other one with wrong hyperlink can most probably cured by using \phantomsection right before \printglossary and then use \addcontentsline... after it, but as far as I can remember, the glossaries package has some option to do this automatically. – user31729 Jul 13 '14 at 20:13
  • The toc package option will automatically add the glossary to the table of contents. – Nicola Talbot Jul 14 '14 at 11:28

I would like to sum up the two solution provided by Mass and Christian Hupfer.

The mathematics (and also the \boldsymbol macro) can be in headings, like \section, protected by command \texorpdfstring{} which should enclose the math.

Christian contributed with a command \phantomsection which should be before \printglossary command and helps to make the hyperref in table of contents clickable in the right way.

As he suggested, it is possible to make this automatically. It is done through an option toc at loading of the package and you might found useful also a command toctitle as option of \printglossary, which changes the printed contents name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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