# Re: Package for writing raw-indices

Hi,

> > \newindexstyle{chapter}{\thechapter-\thepage}

> LaTeX crashes on this line, if \documentstyle is `article'. It seems
> that \thechapter is not known then (with `book' it works fine) and the
> above definition fails. Maybe this definition must be included
> depending on the current document style.

Yes, indeed. I only tested with book.cls, so I didn't see this one :)

> Another problem I found is that the quoting of the backslash does not
> work as expected in the following case:

> \newcommand{\foo}[1]{\indexindy[attr=see]{\texttt{#1}}}

> \foo{fasel}

> which yields

> (indexentry :tkey ( ( "\texttt  {fasel}" ) ) :attr "see"  :locref "0-1")
> ---

> Here, the backslashes are *not* quoted. Missed I something?

Well, this is a bit of pure TeX-knowledge :).
It depends on the catcodes of TeX. In the normal way (\indexentry inside the
document), a backslash is treated as a character of categorie code other.
This is done, by redefining the catcode BEFORE reading the arguments. When
you use \foo, the catcode of backslashs is 0 (introduce command).
Since catcodes can never be changed, once they are applied (remeber
Joachim tutorial at DANTE'97), the redefinition of the catcodes inside
\indexindy doesn't cover the arguments of foo. Thus, there is only one backslash.
AND, you also must write \foo{\\textsc{A}}

If you wish \foo to work right, you should define it like this:

\newcommand{\foo}[1]{\indexindy[attr=see]{\\texttt{#1}}}

I don't know another way to do it work.

> Next question: Why are the location references in the form <x>-<y>. In
> the style file there is explicitly set
> \indexstyle{page}
> ^^^^^^^^^^^^^^^^^
> though it doesn't produce page numbers as expected.

Yes, indeed. I initialize <page>, since the style should produce standard-references.
But have a sharp look at your input:

\indexindy{Layer 0;Layer 1,\textsc{Layer 1};Layer 2}
=> \indexstyle{chapter}
\indexindy{Index the comma{,} too}

Thus, you select \thechapter-\thepage for :locref. And, if you look closely
at the output, you will detect that there a both types of :locrefs.

Regards,
Andi