I am using the nomencl package; however, it seems that my nomenclature entries which contain a vertical bar | in math mode are not handled properly. Is this a known issue, and is there a suggested workaround?

As an example, the following entry in my document

\nomenclature{$s(A)$}{equivalent to $|A|$}

makes it into the .nlo file, but not the .nls file.

  • I should add that, as expected, it works if I convert the | to \vert. But is this the best solution? I'd prefer not to have to remember to do this in nomenclature entries. Oct 14, 2011 at 11:06

1 Answer 1


The nomencl package uses the standard MakeIndex process and | is a special character for the \index command. So there's no way unless you produce a variant of nomencl.ist that disables that special character:

%% ---- for input file ----
keyword    "\\nomenclatureentry"
%% Germans might want to change this and delete the two %%
%% quote '"'
%% ---- for output file ----
preamble   "\\begin{thenomenclature} \n"%
postamble  "\n\n\\end{thenomenclature}\n" group_skip "\n"
delim_0    ""
delim_1    ""
delim_2    ""
%% The next lines will produce some warnings when
%% running Makeindex as they try to cover two different
%% versions of the program:
lethead_prefix "\n \\nomgroup{"
lethead_suffix "}\n"
lethead_flag   1
heading_prefix "\n \\nomgroup{"
heading_suffix "}\n"
headings_flag  1
encap '?'

The last line is the additional one, I've put a question mark that probably you won't use in a nomenclature entry. Save the file as mynomencl.ist and use

makeindex ⟨filename ⟩.nlo -s mynomencl.ist -o ⟨filename ⟩.nls

to produce the .nls file.

It's probably better to remember \vert instead of |. By the way, the amsmath package provides \lvert and \rvert that should be preferred to simple bars: \lvert A\rvert will have correct spacing also in critical situations when |A| might not.

For the rare usage of |, you can also get around the issue with

\nomenclature{$s(A)$}{equivalent to $"|A"|$}
  • 1
    1+ for \vert instead of |.
    – sky-light
    Nov 18, 2016 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .