# Hyperref breaks glossary with super- and subscript

\documentclass[12pt,a4paper,english,BCOR10mm,titlepage,fleqn]{scrbook}
\usepackage{lmodern}
\usepackage{babel}

\usepackage[pdfborder={0 0 0}]{hyperref}

\usepackage[acronym, toc, nonumberlist,  section=section]{glossaries}
\usepackage{glossary-longbooktabs}

\newglossary[mlg]{mathlist}{myi}{myg}{Mathematical Conventions}
\makeglossaries
% activate glossaries-package
\newglossaryentry{sy:na}{
name=\ensuremath{n_a},
description={column vector and scalar (lower case letter)},
type=mathlist,
sort=ab}

\begin{document}
\renewcommand{\glossarypreamble}{}
\printglossary[title=Mathematical Conventions, type=mathlist,style=long,nonumberlist]

$\gls{sy:na}^2$

\end{document}


My aim is that $\gls{sy:na}^{2}$ has the same effect as $n_a^2$, however it has the effect of ${n_a}^2$. When I comment out the

\usepackage[pdfborder={0 0 0}]{hyperref}


line, the superscript works as desired. How can this be circumvented?

• Welcome to TeX.SE! I can't reproduce your issue. When I write a small example document around your code I get the correct (i.e., first) output for the $\gls{sy:na}^{2}$ snippet. Could you add an example document to your code (full document, with documentclass, usepackage statements, begin document, end document, max 20 lines) that demonstrates the issue? – Marijn May 8 at 15:54
• @Marijn I found that using hyperref leads to the undesired behavior. Any idea how this can be circumvented without refraining from hyperref – Flo Ryan May 9 at 11:41
• I also found that additional brackets provide a remedy (\gls{sy:na}[^2]). I would however prefer a solution that doesn't require throwing additional brackets at my tex files. – Flo Ryan May 9 at 12:27
• Do you want to use the standard notation (^2 or ^{2}) or would it be acceptable to define an additional command, something like \glssquare{sy:na}? In that case you can do some tricks with positioning. – Marijn May 9 at 12:52
• As stated in my answer, I might just settle with \glsdisablehyper . Thank you anyway! – Flo Ryan May 9 at 12:53

\glsdisablehyper