[comp.text.tex] Need help with \newcommand and INDEX using idxtex

fac2@dayton.saic.com (Earle Ake) (11/06/90)

	I am trying to put out a '\index' command from within a '\newcommand'
defined command.  A problem arises when there is a '_' within the text I am
trying to use.  Using a '_' directly with the '\index' command produces the
desired results.  Using it from within the newcommand defined gives me:

\unhbox \voidb@x \kern .06em \vbox {\hrule width.3em}

What do I put into the command I have defined to not make the '\_' expand
and have it output as is in the '\index' command?

Also, when I use a '!' within the \index command, I get a ', \subitem' out
of it.  How do I get the '!' to show up in the INDEX as is?

Example files:


File: TEXT.TEX

\newcommand{\test}[2]{{\index{#1} #2}}
\documentstyle[twocolumn,twoside]{report}
\makeindex
\begin{document}

\index{{This is a test} 2}
Some filler text
\test{{This is a test} 2}
This is a test to see what happens.....
\index{{This is also a test!} 5}
This is also a test.....
\test{{This is also a test!} 5}
And still more text.
\index{{And still\_another test} 6}
More text
\test{{And still\_another test} 6}
The last of the text
\end{document}


File: TEST.IDX

\indexentry{{This is a test} 2}{1}
\indexentry{{This is a test} 2}{1}
\indexentry{{This is also a test!} 5}{1}
\indexentry{{This is also a test!} 5}{1}
\indexentry{{And still\_another test} 6}{1}
\indexentry{{And still\unhbox \voidb@x \kern .06em \vbox {\hrule width.3em}another test} 6}{1}


File: INDEX.TEX

\begin{theindex}
\indexspace
\item {And still\unhbox \voidb@x \kern .06em \vbox {\hrule width.3em}another test} 6, 1
\item {And still\_another test} 6, 1
\item {This is a test} 2, 1
\item {This is also a test,
\subitem } 5, 1
\end{theindex}

-- 
_____________________________________________________________________________
             ____ ____    ___
Earle Ake   /___ /___/ / /     Science Applications International Corporation
           ____//   / / /__                 Dayton, Ohio
-----------------------------------------------------------------------------
Internet: fac2@dayton.saic.com             uucp: dayvb!fac2