# nomencl package and vertical bar |

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. –  Ryan O'Donnell Oct 14 '11 at 11:06

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:

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.