I am defining symbols in my document with glossaries-extra package such as:
\glsxtrnewsymbol[description={Lagrangian}]{lag}{\ensuremath{\mathit{L}}}
However I will be referring to this in my document very often -mostly inside equations-. Normally if I wouldnt have to have a list of symbols I would define
\newcommand{\lag}{\mathit{L}}
and simply write \lag everywhere inside the equation. Now I either need to use \gls{lag} everytime, or for each glossary-symbol entry I should use the \newcommand as above. My question is isnt there a way to tell latex to print \gls{label} whenever I type \label ?
....editing after @schtandard's comments.....
So a MWE is this
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[symbols,nonumberlist]{glossaries-extra}
\makeglossaries
\glsxtrnewsymbol[description={Field on Minima spce}]{minfield}{\ensuremath{\varphi}}
\glsxtrnewsymbol[description={General Field}]{field}{\ensuremath{\phi}}
\newcommand{\field}{\gls{field}}
\newcommand{\minfield}{\gls{minfield}}
\begin{document}
I have a configuration space with fields $\field$ that has a minima. Fields on the minima space are called $\minfield$.
\begin{equation}
\delta V (\field=\minfield)=0
\end{equation}
\clearpage
\printglossaries
\end{document}
What I want is not to have to define \newcommand
s at all, but still be able get the result I get with the exact same code in between \begin{document}
and end{document}
. Probably what I want is something like,
\newsymbol{#1,#2,#3}
{
\glsxtrnewsymbol[description={#1}]{#2}{#3},
\newcommand{\#2}{#3}
}
I dont know if something like that already exists or possible, I am new to this level of latex.
\newcommand\lag{\gls{lag}}
? Please add an MWE that shows the current behavior and that we can use to provide a solution for you. – schtandard Sep 3 at 19:06