Consider this basic .tex file:
\documentclass[12pt, a4paper, draft]{book}
\usepackage{makeidx}
\makeindex
\newcommand{\withIndex}[1]{#1\index{$#1$}}
\newcommand{\myIndex}[1]{\index{$#1$}}
\begin {document}
\section{Test section}
Some test text \index{text}.
A $\Downarrow$ \index{$\Downarrow$} represents....\\
Another \withIndex{$\Downarrow$} represents...\\
Perhaps $\Downarrow$ \myIndex{$\Uparrow$} represents...\
\printindex
\end {document}
I have the \withIndex command defined on line 4 in my document, and it works well for the majority of symbols. However, when certain symbols are used with this command odd results are produced. Calling \withIndex($\Downarrow$} in the document body puts the key ${\Gamma}B37F$ into the index (to give another example, indexing $\langle$ in this way gives the key 'hA').
Naturally, I want to see the \Downarrow symbol appear in the index (or the left angled bracket in my other example). The \myIndex command produces the same result, but \index{$\Downarrow$} gives the correct output. Why do I get such strange index output for these particular symbols with the \withIndex command?
$in the definition of\myIndexand\withIndex, though, if you plan to call\withIndex{$\Downarrow$}, because this would result in$$in the index file. – egreg May 13 '13 at 23:47