[Tex/LaTex] How to make a clean and grouped nomenclature list

nomenclaturesubdividing

The nomenclature groups are:

Acronyms: two columns (abbrev. – description)

Roman symbols: three columns (symbol – description – unit)

Greek symbols: three columns (symbol – description – unit)

The symbols should be sorted alphabetically.

An example

My current nomenclature settings:

%----------------------------------------------------------
%                        Nomenclature
%----------------------------------------------------------
%\renewcommand{\nomname}{List of Symbols and Abbrev.}
\renewcommand\nomgroup[1]{%
  \ifthenelse{\equal{#1}{A}}{%
   \item[\textbf{Acronyms}] }{%                  A - Acronyms
    \ifthenelse{\equal{#1}{R}}{%
     \item[\textbf{Roman Symbols}]}{%            R - Roman
      \ifthenelse{\equal{#1}{G}}{%
        \item[\textbf{Symbols}]}{%          G - Greek
          \ifthenelse{\equal{#1}{S}}{%
           \item[\textbf{Superscripts  }]}{{%          S - Superscripts
        \ifthenelse{\equal{#1}{U}}{%
         \item[\textbf{Subscripts }]}{{%                 U - Subscripts
        \ifthenelse{\equal{#1}{X}}{%
         \item[\textbf{Other Symbols }]}%            X - Other Symbols
                    {{}}}}}}}}}}
%\ifpdf
\renewcommand{\nomlabel}[1]{\hspace{1 em}#1}%{\hspace{1.5 em}#1}
\renewcommand*{\nompreamble}{\markboth{\nomname}{\nomname}}

Edit1:
After using the modified settings, the nomenclature looks like:

enter image description here

Well, the description should be aligned in the mid-column, while Units aligns like symbols at the same line. How to figure this out?

Best Answer

You can define the command

\newcommand{\nomunit}[1]{%
  \renewcommand{\nomentryend}{\hspace*{\fill}#1}%
  }

and use it inside \nomenclature commands to insert the unit, as in the following example (I've also loaded siunitx to properly print units):

\nomenclature[r]{$v$}{Fluid velocity\nomunit{\si{\metre\per\second}}}

This is a full MWE (I've also adjusted a little your settings)

\documentclass{article}

\usepackage{siunitx}
\sisetup{%
  inter-unit-product=\ensuremath{{}\cdot{}},
  per-mode=symbol
  }

\usepackage{nomencl}
\usepackage{ifthen}
\renewcommand\nomgroup[1]{%
  \ifthenelse{\equal{#1}{A}}{%
    \item[\textbf{Acronyms}]}{%                A - Acronyms
  \ifthenelse{\equal{#1}{R}}{%
    \item[\textbf{Roman Symbols}]}{%           R - Roman
  \ifthenelse{\equal{#1}{G}}{%
    \item[\textbf{Greek Symbols}]}{%           G - Greek
  \ifthenelse{\equal{#1}{S}}{%
    \item[\textbf{Superscripts}]}{%            S - Superscripts
  \ifthenelse{\equal{#1}{U}}{%
    \item[\textbf{Subscripts}]}{%              U - Subscripts
  \ifthenelse{\equal{#1}{X}}{%
    \item[\textbf{Other Symbols}]}{%           X - Other Symbols
  {}}}}}}}}
\renewcommand*{\nompreamble}{\markboth{\nomname}{\nomname}}

\newcommand{\nomunit}[1]{%
  \renewcommand{\nomentryend}{\hspace*{\fill}#1}%
  }

\makenomenclature

\begin{document}

\section{Test}
$\textrm{CFD}$ and $v$ and $\phi$

\nomenclature[a]{CFD}{Computational Fluid Dynamics}
\nomenclature[r]{$v$}{Fluid velocity\nomunit{\si{\metre\per\second}}}
\nomenclature[g]{$\phi$}{Coefficient of viscosity\nomunit{\si{\pascal\second}}}

\printnomenclature

\end{document} 

The result is:

enter image description here

If you want the units to be left aligned, you can change the definition of \nomunit to

\newcommand{\nomunit}[1]{%
  \renewcommand{\nomentryend}{\hspace*{\fill}\makebox[1cm][l]{#1}}%
  }

and the result will be:

enter image description here

If you have to print longer units increase 1cm to a suitable value.


EDIT

To achieve what you say in the edit of your question, when you have an item with a long description, the best thing to do is to insert the description in a \parbox, like this one

\nomenclature[x]{$x$}{\parbox[t]{.75\textwidth}{Unknown variable with a very very very 
very very very very very very very very very very long description}\nomunit{\si{\second}}}

The result is

enter image description here

Adjust .75\textwidth to your needs. Note that it is quite difficult to modify the thenomenclature environment to achieve something that does this automatically...