# Combine nomenclature entries without destroying layout

I am trying to generate a nomenclature for all symbols used in my thesis. Some variables having the same indices should be grouped as they belong together. However, when I try to group them, the lay-out of the nomenclature gets all messed up. See below MWE:

\documentclass{report}
\usepackage{nomencl}

% create the lsymb command
\newcommand{\lsymb}[2]{#1\nomenclature[b ]{#1}{\MakeUppercase#2}}

% make the nomenclature
\makenomenclature
\makeindex

\begin{document}
I would like to have the variables \lsymb{$a_f$, $b_f$, $c_f$ and $d_f$}{The variables I am trying to group} group on two lines in the nomenclature.

However, when I add more variables such as \lsymb{$a_b$}{another variable} and \lsymb{$c_f$}{yet another variable}, the lay-out gets quite messy.

I could try grouping the variables, like I did with \lsymb{$d_a$, $e_a$,}{a group of variables}\lsymb{$g_a$, and $h_a$}{{}}. But that grouping order will be broken if a variable \lsymb{$f$}{some annoying variable} were to come along.

\printnomenclature
\end{document}


The output is as follows:

So what basically happens, is:

• Grouping the variables in a single group distorts the lay-out
• Splitting the variables across multiple lines gets messed up by the automatic alphabetic ordering (which I wish to keep).

Solutions I am looking for:

• widen the column containing the variables, so that all descriptions are aligned
• somehow make the grouped variables into a multiline object, so other variables can't mess up the sorting.
• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – LaRiFaRi Mar 20 '15 at 15:23
• You could leave away the "and". Is the sorting done automatically? If not, just add \lsymb{$c_f$, and $d_f$}{} as a second line. – LaRiFaRi Mar 20 '15 at 15:25
• @LaRiFaRi: yes, the sorting is done automatically. Perhaps I could add a phantom letter in front of the second part though, will try it out and report back. – Wouter Kuijsters Mar 20 '15 at 15:28
• @LaRiFaRi: I have tried splitting the entries and it works thus far, however the automatic sorting is likely to break this solution later on as I add more variables. I'll work on adding a MWE, but since the custom class I use is quite complex it is taking some time. – Wouter Kuijsters Mar 20 '15 at 16:34
• @LaRiFaRi: I've added the MWE! – Wouter Kuijsters Mar 20 '15 at 16:55

Add the optional argument, which is a length, when calling \printnomenclature, e.g.

\printnomenclature[3cm]


MWE:

\documentclass{report}
\usepackage{nomencl}

% create the lsymb command
\newcommand{\lsymb}[2]{#1\nomenclature[b ]{#1}{\MakeUppercase#2}}

% make the nomenclature
\makenomenclature
\makeindex

\begin{document}
I would like to have the variables \lsymb{$a_f$, $b_f$, $c_f$ and $d_f$}{The variables I am trying to group} group on two lines in the nomenclature.

However, when I add more variables such as \lsymb{$a_b$}{another variable} and \lsymb{$c_f$}{yet another variable}, the lay-out gets quite messy.

I could try grouping the variables, like I did with \lsymb{$d_a$, $e_a$,}{a group of variables}\lsymb{$g_a$, and $h_a$}{{}}. But that grouping order will be broken if a variable \lsymb{$f$}{some annoying variable} were to come along.

\printnomenclature[3cm]
\end{document}


Output:

• @WouterKuijsters You're welcome :) – karlkoeller Mar 21 '15 at 10:18