Take the 2-minute tour ×
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.

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:

\documentclass[a4paper,12pt,oneside]{report}
%
\linespread{1.1}
%
\usepackage[IL2]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[czech,british]{babel}
%
\usepackage{hyperref}
%
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{IEEEtrantools}
%
\usepackage{longtable}
\usepackage[acronym,nomain]{glossaries}
%
\makeglossaries
\begin{document}
%
\newacronym{ads}{AdS}{Anti-de Sitter}
%
\gls{ads}
\section{$\boldsymbol{B}$}
%
\printglossary[type=\acronymtype,title=List of Abbreviations]
%
\end{document}

Are there any nice solutions?


Edit

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

share|improve this question
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 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 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. –  Christian Hupfer Jul 13 at 20:13
    
The toc package option will automatically add the glossary to the table of contents. –  Nicola Talbot Jul 14 at 11:28

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

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.