I've used amsmidx to create a separate notational index.
\usepackage{amsmidx}
\makeindex{idx}
\makeindex{nidx}
\newcommand{\idx}[1]{\index{idx}{#1}}
\newcommand{\nidx}[1]{\index{nidx}{#1}}
I need to index symbols like $\int_{\mathcal{D}}$, $\int^{\underline{\mathcal{D}}}$ (resp an end, an enriched coend). But doing so breaks everything. If I type
\nidx{$\int^{\mathcal{C}}$}
and then run makeindex nidx, it will accept but then on the next pass I'm told there is a missing $. Indeed, when I look in the nidx.ind file I see
\item ^{\mathcal {C}}$, 6
I thought the issue might be that makeindex doesn't know how to alphabetize these entries but
\nidx{int@$\int^{\mathcal{C}}$}
causes makeindex nidx to reject the entry. (But then everything else compiles at least.)
Any idea what's going wrong?