# \gls in the subscript has too normal size

Let us compile the following code with latex+dvips or latex+dvipdf (there are various reasons for using the DVI format; in my case, it's recompiling and adapting the old code):

\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{nonnegativeNat}{name={N}, sort=n0, description={The set of nonnegative integers.}}
\begin{document}
$\gls{nonnegativeNat}\ \bigcup_{j\in\gls{nonnegativeNat}}$
\printglossaries
\end{document}


What we see is the the size of N is the subscript is not small (as it should be) but normal:

Now, page 3 in the manual glossaries-user.pdf says:

If you use the DVI format, you will encounter problems where you have long hyperlinks or hyperlinks in subscripts or superscripts. This is an issue with the DVI format not with glossaries. If you really need to use the DVI format and have a problem with hyperlinks in maths mode, I recommend you use glossaries-extra with the hyperouter and textformat attributes set to appropriate values for problematic entries.

Here, Nicola probably does not mean the subscript problem, but refers to https://tex.stackexchange.com/a/399515/108682. Unfortunately, there is no example of how to actually take care of subscripts, and hyperouter is probably a typo (I searched for hyperouter in the manuals for glossaries and glossaries-extra and did not find it). Any hint of how to actually get scriptsize N in the above example? I don't care that the hyperlink is actually present in the subscript/superscript positions, but I do care that \gls{nonnegativeNat} always prints the right letter in the right size, and that \printglossaries actually prints the page of the occurrence of the subscript.

• This looks like an issue with the hyperref package, rather than with glossaries: indeed, after \newcommand*{\N}{\href{http://www.example.com/}{\ensuremath{N}}}, we see that, e.g., \bigcup_{j\in\N}A_j yields the same problem (and can be fixed with @egreg’s trick of using ...\in\text{\N}... as well).
– GuM
Nov 5 '17 at 2:25
• Sorry, it should be hyperoutside not hyperouter. I'll correct it in the glossaries user manual. Nov 5 '17 at 12:56

You can give hyperref some help; anyway, since this is a math symbol, it should be treated as such, hence \ensuremath.

\documentclass{article}
\usepackage{glossaries-extra}

\makeglossaries

\newglossaryentry{nonnegativeNat}{
name={\ensuremath{N}},
sort=n0,
description={The set of nonnegative integers.}
}

\begin{document}

$\gls{nonnegativeNat}\cup\bigcup_{j\in\text{\gls{nonnegativeNat}}}A_j$

\printglossaries

\end{document}


• @LeonMeier As the manual says, this is a limitation of DVI format (more precisely, of specials understood by dvips). If I compile the same with pdflatex after removing \text, the size is right and the link is OK. Nov 4 '17 at 23:47
• Of course, the description shouldn’t include the final period.
– GuM
Nov 5 '17 at 2:27
• @GuM True, I didn’t even look at it Nov 5 '17 at 8:52