I have created a glossaries nomenclature style that, in my main document, works perfectly and within my space constraints. However, I am facing an issue when a \newglossaryentry{...} doesn't have a symbol field i.e. the nomenclature is unitless.
See this MWE image:
I tried to remove it using etoolbox's \ifstrempty using this answer by GLemyre like so:
\newglossarystyle{nomenS}{%
\setglossarystyle{long}%
\renewenvironment{theglossary}%
{\begin{supertabular}[l]{@{}%
p{\dimexpr.1\columnwidth-2\tabcolsep}p{\dimexpr.8\columnwidth-2\tabcolsep}@{}}}%
{\end{supertabular}}%
\renewcommand{\glossentry}[2]{%
\glstarget{##1}{\glossentryname{##1}}%
& \glossentrydesc{##1}\ifstrempty{\glossentrysymbol{##1}}{}{, \glossentrysymbol{##1}}%
\tabularnewline%
}%
}
but I am unsure if the symbol field is even a string nor am I comfortable yet with \ifx etc with LaTeX. How can I change my nomenS glossary style to only include the comma if the symbol field exists please?
MWE:
\documentclass{article}
\usepackage{glossaries}
\newglossary{nomen}{nom}{ntn}{Nomenclature}
\newglossarystyle{nomenS}{%
\setglossarystyle{long}%
\renewenvironment{theglossary}%
{\begin{supertabular}[l]{@{}%
p{\dimexpr.1\columnwidth-2\tabcolsep}p{\dimexpr.8\columnwidth-2\tabcolsep}@{}}}%
{\end{supertabular}}%
\renewcommand{\glossentry}[2]{%
\glstarget{##1}{\glossentryname{##1}}%
& \glossentrydesc{##1}, \glossentrysymbol{##1}%
\tabularnewline%
}%
}
\makeglossaries
\newglossaryentry{units}
{%
name={$\Delta\Phi_0$},
description={Superhelical phase offset},
symbol={°},
sort={abp},
type=nomen,
}
\newglossaryentry{nounits}
{%
name={$C_\alpha$},
description={No units},
sort={ca},
symbol={},
type=nomen,
}
\begin{document}
\glsaddall
\printglossary[type=nomen,style=nomenS]
\end{document}

