TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Ryan O'Donnell Oct 14 '11 at 11:06
up vote 6 down vote accepted

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.

share|improve this answer

Your Answer


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.