2

I am grouping my nomenclature symbols. I'm using the answer from this post: How to make section in Nomenclature?

The syntax I've used is this:

\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{C}}{\item[\textbf{Variables}]}{%
        \ifthenelse{\equal{#1}{V}}{\item[\textbf{sets}]}{}}
}

If I set prefixes to C and V, the grouping works well. However, it does not work when I try to use numeric prefixes such as 5 and 6, i.e.

\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{6}}{\item[\textbf{Variables}]}{%
        \ifthenelse{\equal{#1}{5}}{\item[\textbf{sets}]}{}}
}

I am not sure why this is the case. I cannot use letters because I have many letters, in both capitals case and lower case. For my document, numbers makes a lot more sense.

The documentation suggest the quote below but I don't know what this means.

Note that for symbols and numbers you have to check for the strings “Symbols”and “Numbers”. http://texdoc.net/texmf-dist/doc/latex/nomencl/nomencl.pdf

How do I overcome this issue?

EDIT: 04/04/2019 1941GMT MWE:

\documentclass[a4paper,openany]{book}

\usepackage{siunitx}
\usepackage{nomencl}
\usepackage{ifthen}
\makenomenclature
\setlength{\nomlabelwidth}{1.45cm}
\renewcommand{\nompreamble}{text here.}

\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{6}}{\item[\textbf{Variables}]}{%
        \ifthenelse{\equal{#1}{V}}{\item[\textbf{sets}]}{}}
}

\begin{document}
test
\printnomenclature
\nomenclature[C1]{$\overline{\text{C}_{\text{F}}}$}{up, [1/s]}

\nomenclature[V2]{$\text{V}_{\text{D}}$}{down, [$\SI{}{\meter\per\second}$]}

\nomenclature[W]{$\overline{\text{We}}$}{left}
\nomenclature[O]{$\overline{\text{Oh}}$}{right}

\nomenclature[6K1]{$k$}{in}

\end{document}
  • Can you please add a small example showing how this fails? – egreg Apr 4 at 7:41
  • @egreg added mwe – slew123 Apr 4 at 18:43
  • In your code you're checking for 6 and V; if neither of them appears, nothing is done. And 6K1 is not the same as 6. – egreg Apr 4 at 20:07
  • 6K1 should be valid. It should not matter what comes after. Please look at the link first where this is clear for letters: tex.stackexchange.com/questions/223376/… As I explained earlier, the behaviour works for letters. My problem is that when I try to use numbers in the same way, it does not work. The package documentation hints that something extra needs to be done but does not explain further. – slew123 Apr 4 at 21:04
1

This is a limitation of makeindex. I experimented with

\index{6@66}
\index{6k@6k}

and the first entry is listed among “numbers”, whereas the second entry appears among “symbols”. Only completely numeric parts before the @ will be sorted among “numbers” in the index. Besides, what's recorded in the .nlo file is

\nomenclatureentry{6K1$k$@[{$k$}]\begingroup in\nomeqref {0}|nompageref}{2}

and before the @ there will always be something that's not a number.

You're out of luck, sorry: only 27 different groups can be used, 26 for the letters and one for symbols. MakeIndex does not distinguish between uppercase and lowercase when dividing in groups.

I can only offer a less painful way to redefine \nomgroup when many letters are involved.

% arara: pdflatex
% arara: nomencl
% arara: pdflatex

\documentclass[a4paper,openany]{book}

\usepackage{siunitx}
\usepackage{nomencl}
\usepackage{xparse}
\makenomenclature
\setlength{\nomlabelwidth}{1.45cm}
\renewcommand{\nompreamble}{text here.}

\ExplSyntaxOn
\NewExpandableDocumentCommand{\checkletter}{mmm}
 {
  \str_case:nnF { #1 } { #2 } { #3 }
 }
\ExplSyntaxOff

\renewcommand{\nomgroup}[1]{%
  \checkletter{#1}{
    {A}{\item[\textbf{aaa}]}
    {B}{\item[\textbf{bbb}]}
    {C}{\item[\textbf{ccc}]}
    % other groups
    {O}{\item[\textbf{ooo}]}
    % other groups
    {V}{\item[\textbf{sets}]}
    {W}{\item[\textbf{www}]}
    {X}{\item[\textbf{xxx}]}
    {Y}{\item[\textbf{yyy}]}
    {Z}{\item[\textbf{zzz}]}
  }{\item[\textbf{Variables}]}
}

\begin{document}
test

\printnomenclature

\nomenclature[C1]{$\overline{\text{C}_{\text{F}}}$}{up, [1/s]}

\nomenclature[V2]{$\text{V}_{\text{D}}$}{down, [$\SI{}{\meter\per\second}$]}

\nomenclature[W]{$\overline{\text{We}}$}{left}
\nomenclature[O]{$\overline{\text{Oh}}$}{right}

\nomenclature[6K1]{$k$}{in}

\end{document}

This produces

enter image description here

  • Thank you for the time and effort you have put into replying. Since it is not possible to do with numbers, I have chosen to do it with letters. This has required changing my sorting patterns, but fortunately, all my nomenclature is in one location in the document. I have used A in front of the prefixes for all entries which are not in groups. I then used D and S in front of entries of two groups. After this, I can then organised each entry with additional letters and numbers. Thanks for your help. Its a shame it isn't possible directly, but maybe in the future it will be :) – slew123 Apr 4 at 22:12

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.