I'm currently creating an index for mathmatical symbols used in my document, including the use of the |-symbol. To make things easier, I added a macro to be changed easily, but this creates a problem for $f|_A$
This is a minimal (not) working example:
\documentclass[a4paper]{article}
\usepackage[makeindex]{imakeidx}
\makeindex
\newcommand{\mathsymbol}[2]{#2\index{#1@#2}}
\begin{document}
\mathsymbol{f}{$f\vert_A$}
$f\vert_A$\index{a@$f\vert_A$}
\printindex
\end{document}
As far as I know, the macro should expand to the the line below. In the text, everything is fine, but the index is different: while the line without the macro works as expected, the other entry looks like $f\GammaA30C_A$.
The accompanying .idx-file contains
\indexentry{f@$f\delimiter "026A30C _A$}{1}
\indexentry{a@$f\vert_A$}{1}
Thus, how can I create an index with a macro including this special case, without the | beeing substituted by this (hex?)-code?
I use these commands:
$ lualatex --version
This is LuaTeX, Version 1.0.4 (TeX Live 2017/Arch Linux)
$ makeindex
This is makeindex, version 2.15 [TeX Live 2017] (kpathsea + Thai support).