0

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?

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149

0 Answers0