[Tex/LaTex] Customizing nomenclature ‘=’ separator as in aiaa

nomenclature

This is a problem google was unable to aid me with. I am writing an aiaa journal paper and need to generate a nomenclature. All templates and examples I have come accross do this manually, using a tabular.
My question is, is there any way to make the \printnomenclature use a separator as in this example here?

With the standard setting of nomencl you have to decide yourself for the label width; here's a simple change for getting an equals sign.

\documentclass{article}
\usepackage{nomencl}

\makenomenclature
\renewcommand{\nomlabel}[1]{#1\hfil\hspace{\labelsep}$=$}

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\printnomenclature

\end{document}


With the optional argument to \printnomenclature you can set the width to the widest label.

\documentclass{article}
\usepackage{nomencl}

\makenomenclature
\renewcommand{\nomlabel}[1]{#1\hfil\hspace{\labelsep}$=$}
\newlength{\nomwidest}

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\settowidth{\nomwidest}{\nomlabel{Loooooong}}
\printnomenclature[\nomwidest]

\end{document}


With a bit more of effort, we can also make the setting of the widest label automatic:

\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\makeatletter
\newdimen\nomwidest
\renewcommand{\nomlabel}[1]{%
\sbox\z@{#1\hspace{\labelsep}$=$}%
\ifdim\nomwidest<\wd\z@\global\nomwidest\wd\z@\fi
#1\hfil\hspace{\labelsep}$=$%
}
\renewcommand{\nompostamble}{%
\protected@write\@auxout{}{\global\nomwidest=\the\nomwidest}%
}
\makeatother

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\printnomenclature[\nomwidest]

\end{document}


The output is as in the second picture. Since we use the aux file, two runs of LaTeX may be necessary for synchronization.