# Make nomenclature sort math correctly

I am sorting my nomenclature as suggested by the nomencl package documentation, but \dot{q} is being sorted before a and v, where as the desired sort is:

• a
• \dot{q}
• v

The existence of a default prefix does not help, so noprefix is used. Prefixes are used to separate Roman [1] from Greek [2] variables.

\documentclass[oneside,paper=a4,fontsize=12pt,english]{scrreprt}
\usepackage[noprefix]{nomencl}
\makenomenclature
\begin{document}
\printnomenclature
\nomenclature[1]{$$a$$}{Semimajor axis}
\nomenclature[1]{$$v$$}{Velocity}
\nomenclature[1]{$$\dot{q}$$}{Heat flux}
\nomenclature[2]{$$\rho$$}{Density}
% makeindex.exe Test.nlo -s nomencl.ist -o Test.nls
Lorem ipsum.
\end{document}


Using [1q] as a prefix causes \dot{q} to be sorted at the end of the Roman variables. How can I get nomenclature to ignore \dot{}?

Just add to all the entries that have math an ASCII version for sorting:

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

\documentclass[oneside,paper=a4,fontsize=12pt,english]{scrreprt}
\usepackage[noprefix]{nomencl}
\makenomenclature

\begin{document}

\printnomenclature
\nomenclature[1a]{$$a$$}{Semimajor axis}
\nomenclature[1v]{$$v$$}{Velocity}
\nomenclature[1q]{$$\dot{q}$$}{Heat flux}
\nomenclature[2rho]{$$\rho$$}{Density}

Lorem ipsum.
\end{document}


With arara you don't need to remember the command for producing the .nls file. :)

• That works thanks, but it made me try \nomenclature[1$$q$$]{$$\dot{q}$$}{Heat flux} which works without changing all the others. I'm writing a dissertation so only changing this one entry is ideal. I'm not sure if you should edit your answer with this solution? – RazerM Apr 2 '13 at 17:55
• Take care if you have more then 9 entries, you should use leading zeros to get the sorting right, e.g., 01,02,…,09,10,11,… – usr1234567 Dec 17 '16 at 14:24

To prevent symbols from being sorted by surrounding commands, such as \dot{q}, append the prefix with the math mode of the symbol without any additional commands like so:

\nomenclature[1$$q$$]{$$\dot{q}$$}{Heat flux}


In the full example we see that this additional syntax is only required for the single problem variable:

\documentclass[oneside,paper=a4,fontsize=12pt,english]{scrreprt}
\usepackage[noprefix]{nomencl}
\makenomenclature
\begin{document}
\printnomenclature
\nomenclature[1]{$$a$$}{Semimajor axis}
\nomenclature[1]{$$v$$}{Velocity}
\nomenclature[1$$q$$]{$$\dot{q}$$}{Heat flux}
\nomenclature[2]{$$\rho$$}{Density}
% makeindex.exe Test.nlo -s nomencl.ist -o Test.nls
Lorem ipsum.
\end{document}