I would like to combine 2 or more math mode glossary entries to form a complete expression in math-mode. Background is a separation of nomenclature and symbols.
I use expressions as in the second variant of this answer: https://tex.stackexchange.com/a/137506/101663
What I would like to get is shown in formula 1 of my MWE. What I get is shown in formula 2. What I suppose might happen is given in formula 3.
Ase one is not allowed (and it in fact doesn't work) to use gls-commands in the optional parameter of a gls the approach given in the manual does NOT help:
$\gls{Falpha}[^2]$
Is there any way to achieve my goal?
MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[acronym]{glossaries}
\newglossary[fog]{formula}{foi}{foo}{Formula}
\makeglossaries
\newglossaryentry{mathpart1}{
name=test, text=x_{ref},
description=irrelevant, type=formula
}
\newglossaryentry{mathpart2}{
name=test2, text=^{abc},
description=irrelevant2, type=formula
}
\begin{document}
Desired output:
\[
x_{ref}^{abc} = 0
\]
Achieved output with gls:
\[
\gls{mathpart1}\gls{mathpart2} = 0
\]
Similar behaviour:
\[
{x_{ref}}^{abc} = 0
\]
\end{document}


\[ \gls{mathpart1}^{\gls{mathpart2}} = 0 \]works, of course, and just remove the^from theabcstuff. I think it is better not to use^in the gls - entry – Mar 27 '16 at 14:50