Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know how to sort a nomenclature according to the description, and not the symbol, whilst still making use of subgroups (e.g. separate groups for subscripts, superscripts etc)? The following, suggested defining a new command \Nomenclature for sorting according to the description rather than symbol:

\documentclass[a4paper]{report}

\usepackage{nomencl}
\makenomenclature

\newcommand\Nomenclature[2]{\nomenclature[#2]{#1}{#2}}

\begin{document}
Text% to produce a non-empty page

\Nomenclature{$\omega$}{Absolute Frequency}
\Nomenclature{HOA}{Acetic acid}
\Nomenclature{Al}{Aluminium}
\Nomenclature{ASTM}{American Standard Testing Machine}

\printnomenclature

\end{document}

However, I am not sure how to get this to work with subgroups, which I have created using the \nomgroup command in the following way:

\renewcommand\nomgroup[1]{%
  \item[\large\bfseries
  \ifstrequal{#1}{A}{Acronyms}{%
  \ifstrequal{#1}{R}{Roman Symbols}{%
  \ifstrequal{#1}{G}{Greek Symbols}{%
  \ifstrequal{#1}{S}{Superscripts}{% 
  \ifstrequal{#1}{U}{Subscripts}{%   
  \ifstrequal{#1}{X}{Other Symbols}{}}}}}}]
  \insertnomheaders
  }

Any suggestions? Thanks

share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Feb 3 at 13:08
    
Does the answer solve your problem? –  karlkoeller Feb 4 at 8:53
add comment

1 Answer

It is possible, but you have to declare your \Nomenclature command to have three argument:

\newcommand\Nomenclature[3][X]{\nomenclature[#1#3]{#2}{#3}}

Also the command \insertnomheaders is undefined. I've redefined \nomgroup without it (and changed a little):

\renewcommand\nomgroup[1]{%
  \item[\large\bfseries
  \ifstrequal{#1}{A}{Acronyms}{%
  \ifstrequal{#1}{R}{Roman Symbols}{%
  \ifstrequal{#1}{G}{Greek Symbols}{%
  \ifstrequal{#1}{M}{Molecules}{%
  \ifstrequal{#1}{X}{Other Symbols}{}}}}}]%
  }

When you use \Nomenclature you have to specify the first optional argument to be one of the ones listed in \nomgroup so to be inserted in the right subgroup. If you omit the optional argument the default is X.

A MWE:

\documentclass[a4paper]{report}
\usepackage{etoolbox}
\usepackage{nomencl}

\newcommand\Nomenclature[3][X]{\nomenclature[#1#3]{#2}{#3}}

\renewcommand\nomgroup[1]{%
  \item[\large\bfseries
  \ifstrequal{#1}{A}{Acronyms}{%
  \ifstrequal{#1}{R}{Roman Symbols}{%
  \ifstrequal{#1}{G}{Greek Symbols}{%
  \ifstrequal{#1}{M}{Molecules}{%
  \ifstrequal{#1}{X}{Other Symbols}{}}}}}]%
  }

\makenomenclature

\begin{document}
Text% to produce a non-empty page

\Nomenclature[G]{$\omega$}{Absolute Frequency}
\Nomenclature[G]{$f$}{Frequency}
\Nomenclature[M]{HOA}{Acetic acid}
\Nomenclature[M]{Al}{Aluminium}
\Nomenclature[A]{ASTM}{American Standard Testing Machine}
\Nomenclature[X]{foo2}{foo2}
\Nomenclature{foo1}{foo1}

\printnomenclature

\end{document}  

Output:

enter image description here

As you can see, the elements are placed in the right subgroup and ordered according to their description.

share|improve this answer
    
Well, f is not really a greek symbol... –  karlkoeller Feb 3 at 13:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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