# Special characters you should be careful when using in nomenclature [duplicate]

I'm struggling to write |.| in nomenclature in LaTeX. It works for the first item in the nomenclature, but not working for the second item in the following:

\documentclass[10pt,journal]{IEEEtran}
\usepackage{nomencl}
\usepackage{ifthen}
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{C}}{\item[\textbf{Constants}]}{%
\ifthenelse{\equal{#1}{V}}{\item[\textbf{Variables}]}{%
\ifthenelse{\equal{#1}{K}}{\item[\textbf{Symbols}]}{%
\ifthenelse{\equal{#1}{S}}{\item[\textbf{sets}]}{}}}}
}
\makenomenclature

\begin{document}
\nomenclature[Km]{$\leftarrow\cdot\rightarrow$}{Number of element in a set.} %
\nomenclature[Km]{$\left|\cdot \right|$}{Number of element in a set.} %
Say something.
\printnomenclature

\end{document}


Can any one help me with it, why it is not showing up?

## marked as duplicate by Stefan Pinnow, Sebastiano, Phelype Oleinik, Marcel Krüger, AndrewAug 9 '18 at 0:33

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem and not just a code snippet. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Aug 8 '18 at 16:11
• @albert I do not think it is about making index because I am able to see first item in the nomenclature but not the second item. – Fred Aug 8 '18 at 16:59
• Without the makeindex I didn't see anything, with the makeindex I did see the first item. A bit strange that the second one is not present. Must have to do with the | symbol. – albert Aug 8 '18 at 17:08
• – Nicola Talbot Aug 8 '18 at 17:52
• @NicolaTalbot thanks, added findings from your reference to the answer – albert Aug 8 '18 at 18:05

Been searching a bit and found the following solution:

\documentclass[10pt,journal]{IEEEtran}
\usepackage{nomencl}
\usepackage{amsmath} % <=== don't forget
\usepackage{ifthen}
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{C}}{\item[\textbf{Constants}]}{%
\ifthenelse{\equal{#1}{V}}{\item[\textbf{Variables}]}{%
\ifthenelse{\equal{#1}{K}}{\item[\textbf{Symbols}]}{%
\ifthenelse{\equal{#1}{S}}{\item[\textbf{sets}]}{}}}}
}
\makenomenclature

\begin{document}
\nomenclature[Km]{$\leftarrow\cdot\rightarrow$}{Number of element in a set.} %
\nomenclature[Km]{$\left\lvert \cdot \right\rvert$}{Number of element in a set.} %
%% based on the comment from @NicolaTalbot and the answer from @egreg in https://tex.stackexchange.com/questions/324639/adding-exists-to-the-nomenclature
\nomenclature[Km]{$\left"| \cdot \right"|$}{Number of element in a set.} %
Say something.
\printnomenclature

\end{document}