[texhax] Two problems with \sidx

D. R. Evans doc.evans at gmail.com
Tue May 10 16:35:41 CEST 2011

I have two issues (using eplain TeX):

1. If I have the following explicit inline text in my file, it gives no error:
{\sc nop}\sidx{{\sc nop} gate
This prints "NOP" in small caps and inserts the text "NOP gate" into the index.

However, if I define \nop as:
\def\nop{{\sc nop}\sidx{{\sc nop} gate}}
Then when the compiler reaches "\nop" in the text, TeX throws an error:
! Incomplete \iffalse; all text was ignored after line 1415.

I don't understand why this happens, nor how to fix it.

2. When I place the text inline:
{\sc nop}\sidx{{\sc nop} gate
then although the text "NOP gate" appears in the index, it does so *at the
start* of the index.

If I look in the *.ind file, it begins:

----

\begin{theindex}

\item {\sc nop} gate, 21

\indexspace

\item BB84, 79

----

So it looks like makeindex is putting the entry in completely the wrong place.

The *.idx file has the following:
\indexentry{{\sc nop} gate}{21}
so my guess is that makeindex is sorting this entry according to either the
second "{" or the "\", which I suppose makes sense, but I haven't been able
think of a way around this: any sneakiness I've been able to think of
begins with "\" and so sorts incorrectly.

So how can I force the index entry to appear in the correct place in the
index?

Doc

--
Web:  http://www.sff.net/people/N7DR

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature