2

I have just begun using the glossaries package. I have created a glossary entry for the coproduct symbol as disjoint union:

\newglossaryentry{coprod}
{
    name = {\ensuremath{\coprod}},
    description = {The coproduct in the category of sets, i.e., the disjoint union},
    sort = coprod,
    symbol = {\ensuremath{\coprod}}
}

Where I put either \gls{coprod} or \glssymbol{coprod} in the body of my document, it prints the coproduct symbol correctly, but it doesn't format subscripts and superscripts (e.g. \gls{coprod}_1^r) as it would for the \coprod symbol in math mode (i.e. above and below). Instead, they're to the right, and too close together. How can I fix this?

Addendum: An example of the call to \gls{coprod} in my code looks like:

\[
[n] = \gls{coprod}_1^r \lambda_i
\]
  • Are you in math mode issuing your \gls? If not that's your problem, but since it is not clear what your context is please provide a MWE. – TeXnician Feb 15 '17 at 5:27
  • Yes the \gls is in math mode. I will try Elad Den's displaystyle idea. – benblumsmith Feb 15 '17 at 17:53
  • @TeXnician - I would have tried what Elad Den put in his answer as a MWE, but actually it comes out fine for me too. My issue is happening in a large project (a PhD thesis), using a lot of different packages. I assume at this point that the issue has to do with interaction among the parts. If it is not already a known bug, then I doubt I will be able to isolate the issue without more work than it is worth to me. – benblumsmith Feb 16 '17 at 0:18
4

I had the exact same problem and when researching found this answer immediately, yet it did not solve my problem.

What did, was this answer, also found on tex exchange.

It seems to be necessary to pass the superscripts or subscript as optional argument to the \gls{} call in the form of \gls{<name>}[_{xx}^{yy}]. Below is an example of this in action:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{glossaries}

\newglossaryentry{sym}{
    name = {\ensuremath{\mathbb{R}}},
    description = {Real numbers}
}

\makeglossaries

\begin{document}

$\gls{sym}[^3_x]$ in a text.
\begin{align}
    \gls{sym}[_t^{2\times3}]
\end{align}

\printglossaries
\end{document}

And this is the result:

This is what the above code looks like compiled.

1

It's hard to tell what the problem is. Trying to simulate it I was unable to recreate it.

\documentclass {article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{glossaries}

\newglossaryentry{coprod}
{
    name = {\ensuremath{\coprod}},
    description = {The coproduct in the category of sets, i.e., the disjoint union},
    sort = coprod,
    symbol = {\ensuremath{\coprod}}
    }

\begin{document}
    coprod in a paragraph $\coprod_{1}^{2}$
    \[
        \coprod_{1}^{2}
    \]

    gls in paragraph $\gls{coprod}_{1}^{2}$
    \[
        \gls{coprod}_{1}^{2}
    \]

\end{document}

It sounds like you are not in display style, so either you using \gls in a $$ environment, in which case the super and subscript SHOULD be on the side, or there's some other problem. In any case, try defining name = {\ensuremath{\displaystyle\coprod}},

  • Thanks (+1). I tried adding the \displaystyle but it didn't help. If I replace the \gls{coprod} in the body of my document with \coprod, it prints as I want it to. Could glossaries be interacting badly with some other package? – benblumsmith Feb 16 '17 at 0:18
  • maybe... hard to tell, that's why a MWE is needed... If I had to guess I'd bet on the documentclass rather than a package, are you using some sort of thesis documentclass ? – Elad Den Feb 16 '17 at 7:37
  • I'm using \documentclass{report} – benblumsmith Feb 16 '17 at 13:06
  • When I try your code with \documentclass{report} instead of {article} it still looks fine. I think that figuring out a MWE is going to take far more work than it's worth to me. I will either just have to live with the bad formatting, figure out a manual workaround, or else take \coprod out of the glossary. I posted the question hoping it was a known bug. – benblumsmith Feb 16 '17 at 13:10
  • In the \[ \] environment, I can get around the need to fix this using \underset and \overset. In the $$ environment, it's still a problem because although the subscript/superscript are to the right like they should be, they're further from the \coprod symbol than they should be, and too close together. – benblumsmith Feb 16 '17 at 13:29

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.