Inspired by this question I created a glossary entry with an optional parameter as a subscript. However when I try to have a superscript there as well I can't use the trick where I pass the superscript as an optional argument because I already have one. Is there any workaround?
MWE
\documentclass{article}
\usepackage{glossaries-extra}
\glsnoexpandfields
\newglossaryentry{A}{
category={arg},
user1={1},
name={(A_{\glsarg})},
text={A_{\glsarg}},
description={A}}
\preto\glsentryfmt{%
\glsifcategory{\glslabel}{arg}% if category set to "arg"
{%
\ifdefempty\glsinsert
{\glsfieldfetch{\glslabel}{useri}{\glsarg}}%
{%
\let\glsarg\glsinsert
\let\glsinsert\empty
}%
}%
{}%
}
\begin{document}
Tried:
[\gls{A}[ij]^T]
[\gls{A}[ij^T]]
Desired outcome:
[A^T_{ij}]
\end{document}
