2

I have a symbol in my nomenclature that needs a negative thinspace command \! in the subscript. But whenever I try to do that in the nomenclature, it fails to compile. The error I get is:

Missing $ inserted.
<inserted text> 
                $
l.6     \subitem
                 [{$V_{\

This is a MWE where the problem occurs:

\documentclass{memoir}

\usepackage{nomencl}

\makenomenclature

\begin{document}

    \nomenclature[$V_{\infty}$]{$V_{\!\infty}$}{Freestream velocity}
    \printnomenclature[0.75in]

\end{document}

I compile this using pdflatex example.tex, then, makeindex example.nlo -s nomencl.ist -o example.nls, and then pdflatex example.tex again.

Any idea how to get it to compile with negative space?

maero21
  • 588

1 Answers1

2

The ! character is used internally by MakeIndex, so you cannot use it directly. For normal exclamation marks you can quote them with ". This one, as it is a control character, you can rename it to use in the nomenclature:

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

\documentclass{memoir}

\usepackage{nomencl}

\makenomenclature

% Copying \! to \negspace
\let\negspace\!

\begin{document}

\nomenclature[$V_{\infty}$]{$V_{\negspace\infty}$}{Freestream velocity}
\printnomenclature[0.75in]

hello % some text to force output

\end{document}

Also, the optional argument to \nomenclature is a sorting key, you can usually omit it unless you want to override MakeIndex's sorting.

\begin{advertisement}

And you may also be interested in a modification of the nomencl package I did to allow easy classification of the nomenclature :)

\end{advertisement}

  • Thanks! Also for pointing out the sorting thing. I just do it automatically, because I also have to use that for greek symbols, which makeindex does not sort correctly. – maero21 Jul 03 '18 at 01:33