I wonder how to use \gls or the package glossaries in general in a proper way in case of symbols and subscripts. For instance without glossaries, I'd just write


or in case of in-text usage


Using glossaries, I defined a symbol for force (sym:F) and the subscript for tractive (sub:trac) and write


or in case of in-text usage


I can't even spare the $$ here, which I do for alone standing symbols, which are surrounded by an \ensuremath{} in the definition. If two or more subscripts are required I use


Also, if one defines an


there is no way of adding the \gls{sub:max} anymore, is there?

The quite short form




So my point is:

What is the way the package is intended to be used?

  • oh, my, nothing to do with glossaries, but "trac" in the usual math font is quite dreadful. \mathit{trac} is the proper thing if that should be italic, or \mathrm{trac} if it's better roman, indicating a short form of a term. Mar 12, 2015 at 18:58
  • Is it, @barbarabeeton? What's the difference? Can't see any, at least when it comes to appearance...
    – embert
    Mar 12, 2015 at 19:29
  • the kerning of the letters meant as math variables (which is what you get by default in math mode) is such that they more clearly appear as individual letters than as a word. replace "trac" by "effect" and you'll see what i am referring to. Mar 12, 2015 at 19:31
  • @barbarabeeton Interesting. Never thought about it.
    – embert
    Mar 12, 2015 at 19:51
  • Isn't one of the benefits of the glossaries package that your label inside \gls{} doesn't have to contain a formatted command on it's own? The name, first, and description can accept a wide variety of macro expansions simplifying the process and generating the proper formatting. I generate sub and superscripts all the time with the siunitx package inside the name entity of a glossary entry and I have never observed a problem with spacing or formatting consistency.
    – EngBIRD
    Jun 20, 2015 at 3:39

1 Answer 1


The manual (in section 6.1) states:

Don’t use any of the \gls-like or \glstext-like commands in the ⟨insert⟩ argument.

(where ⟨insert⟩ refers to the final optional argument) so it's not intended to be used in the form \gls{sym:v}[_{\gls{sub:k}}]. The main reason for this is because it causes nested links (if hyperref is used). The problem of nested links is mentioned in the glossaries FAQ entry Why shouldn't I use commands like \gls in \section, \chapter, \caption etc? but it can be demonstrated using the following MWE:




Targets: \hypertarget{k}{$k$}, \hypertarget{v}{$v$}.

Links: $\hyperlink{v}{v}_{\hyperlink{k}{k}}$.

No links: $v_k$


Image of output

The first case $\hyperlink{v}{v}_{\hyperlink{k}{k}}$ is analogous to \gls{v}_{\gls{k}}. Here there are two separate hyperlinks, but the spacing between the v and its subscript is slightly wider than the no links version.

The second case $\hyperlink{v}{v_{\hyperlink{k}{k}}}$ is analogous to \gls{v}[_{\gls{k}}]. This has a better spacing between the v and its subscript, but there is now a nested hyperlink. If you click on the k it may take you to the k target (\hypertarget{k}{$k$}) or it may take you to the v target (\hypertarget{v}{$v$}), depending on your PDF viewer.

(In either case you will need to use pdflatex rather than latex for the hyperlinked subscript to appear the correct size.)

Going back to glossaries, the usage really depends on how important it is to place each symbol in a hyperlink. If they all need to be hyperlinked, then it's best just to do \gls{k}_{\gls{v}}. If you're happy for k_v to just hyperlink to the entry for k then you can do $\gls{k}[_{\glsentrytext{v}}]$, which has better spacing between the k and the v:










Remember that you can define a command if this is too cumbersome to type. For example:


Now you can just do \gsub{v}{k} or \gsubs{v}{k}{j}. This won't add the subscript entries to the glossary, but this can be done by adjusting the definitions:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .