1

in my thesis I use the nomencl package with different groups. Since a few entries in one group are fairly long, I'd like to specifically increase the \nomlabelwidth in this \nomgroup. Globally increasing the \nomlabelwidth would result in a lot of unnecessary white space in all other groups which I'd like to avoid.

Is is possible to \setlength{\nomlabelwidth}{<value>} within a group and not just globally?

Here is a MWE

\documentclass{article}
\usepackage{amsmath}
\usepackage{nomencl}
\makenomenclature

\setlength{\nomlabelwidth}{3em}

\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{D}}{\item[\textbf{General notation}]}{%
        \ifthenelse{\equal{#1}{A}}{\item[\textbf{Acronyms}]}{}}
    \vspace{1.5em}% add space between groups
}

\begin{document}
Test nomenclature.
\nomenclature[D]{$\{\boldmath{e}_z,\boldmath{e}_y,\boldmath{e}_z\}$ or $\{\boldmath{e}_1,\boldmath{e}_2,\boldmath{e}_3\}$}{a long entry}
\nomenclature[D]{$\{\boldmath{E}\}$}{a short entry}
\nomenclature[A]{ADA}{a dummy acronym }

\printnomenclature

\end{document}

Output of MWE

1

To get the required output you can start a new list within your \nomgroup command and set the relevant dimensions there, among which \labelwidth that controls the label width. Other relevant dimensions are \leftmargin and \itemsep. The left margin is the new label width minus the old label width. This code is largely taken from the source of the nomencl package, specifically the part where the nomenclature environment is defined (around line 250 in nomencl.sty).

Furthermore you should reverse the extra space that the new list generates using a negative \vspace. All in all it is a bit messy but it seems to work :)

MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{nomencl}
\makenomenclature

\setlength{\nomlabelwidth}{3em}
\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{D}}{%
    \endlist%
    \list{}{%
      \labelwidth15em
      \leftmargin12em
      \itemsep\nomitemsep
      \let\makelabel\nomlabel}%
    \vspace{-1.5em}%
    \item[\textbf{General notation}]}{%
        \ifthenelse{\equal{#1}{A}}{\item[\textbf{Acronyms}]}{}}
    \vspace{1.5em}% add space between groups
}

\begin{document}
Test nomenclature.
\nomenclature[D]{$\{\mathbf{e}_z,\mathbf{e}_y,\mathbf{e}_z\}$ or $\{\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3\}$}{a long entry}
\nomenclature[D]{$\{\mathbf{E}\}$}{a short entry}
\nomenclature[A]{ADA}{a dummy acronym }

\printnomenclature

\end{document}

Result:

enter image description here

1
  • That's great! Thank you very much!
    – J. Hund
    Apr 23 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.