# Why do makeidx and imakeidx ignore absolute values and norms?

See the following minimal working example

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{imakeidx}
\makeindex
\begin{document}
Hello world
\index{A@$A$ without norm of $A$}
\index{lAl@$|A|$ norm of $A$}
\printindex
\end{document}

My problem is that imakeidx and makeidx both ignore absolute values and norms in indexes. If you run this example, you will see that the index where the absolute value apears is just ignored by makeidx and does not appear in the index at the end. But I am making a symbol index, so this would be most necessary to include. How can I make it work?

It is not ignored, it is a syntax error reported in the makeindex log (ilg) file

!! Input index error (file = file.idx, line = 2):
-- Extra `|' at position 8 of first argument.

By default | is a special character used to apply formatting to the output, you either need to quote the | or use a makeindex style that assigns some other character as the escape character.

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{imakeidx}
\makeindex
\begin{document}
Hello world
\index{A@$A$ without norm of $A$}
\index{lAl@$"|A"|$ norm of $A$}
\printindex
\end{document}

as an alternative to david carlisle's answer, using \lvert ... \rvert will avoid the syntax error.

(sorry i can't produce code or an image; the platform i'm on doesn't have tex available.)