I am trying to create a glossary entry for math symbols with extra parameter that have long and short forms. I tried following Glossary entry with extra parameter for creating the extra parameter.
I used the first key to hold the long format and text to hold the short format.
this is not fully working, since if i try to use the long format with \glsfirst{}[] the index is not properly caught.
Any help on how to fix / implement better would be greatly appreciated.
my code so far:
\documentclass{article}
\usepackage[unicode, colorlinks=true]{hyperref}
\usepackage[automake, nonumberlist,acronym,nopostdot, style=super, shortcuts]{glossaries}
\setlength{\glsdescwidth}{0.9\textwidth}
\makeglossaries
\glsnoexpandfields
\newcommand*{\providedIndex}{} % default index
\newglossaryentry{Vertex}{
name = \ensuremath{V_{i}},
text = \ensuremath{V_{\providedIndex}},
description = Vertex $i$
}
\newglossaryentry{volt}{
name = \ensuremath{ v(V_i), v_{i}},
text = \ensuremath {v_{\providedIndex}},
first = \ensuremath {v(\gls{Vertex})},
description = Voltage of vertex $i$
}
% modify the entry's format
\defglsentryfmt{%
\let\orgprovidedIndex\providedIndex
\ifdefempty\glsinsert
{}%
{%
\let\providedIndex\glsinsert
\let\glsinsert\relax
}%
\glsgenentryfmt
\let\providedIndex\orgprovidedIndex
}
\begin{document}
\printglossary
\section{Main}
my use cases:
$\gls{Vertex} = V$
$\gls{Vertex}[k] = V_k$
$\gls{volt}[k] = v(V_k)$ - working long form (actual first use)
$\gls{volt}[k] = v_k$ - working short form
$\glsfirst{volt}[k] \neq v(V_k)$ - not working long form, index is messed up
\end{document}


glsentryfmtand therefore [k] is not intercepted and embedded in the result but appended to it. if what you had said to be the problem was correct than the first use of \gls{volt}[k] wouldn't have worked as well. – Bar Jakubovitz Nov 15 '17 at 17:43