# 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)

I didn't really tried to understand the way your style works, I only
tested it :) But if I have some more time, I'll have to learn TeX, it
seems unavoidable :)

> , 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.

Ok, I see. But my example did as well not escape the backslash in

\indexindy[open-range,attr=definition]{Euler,\textsc{Euler}}

which results in

(indexentry :tkey ( ( "Euler" "\textsc {Euler}" ) )
:attr "definition" :open-range :locref "1")

This was my original question and it is in contrast to the examples you
gave and I'm not sure if I did something wrong.

I just had another close look and it seems that your version does
*only* work in conjunction with \usepackage{german}.

I tested it once more and *without* german.sty the quotes aren't
doubled. This is maybe the reason for my problems.

without german.sty:
(indexentry :tkey ( ( "Euler" "\textsc {Euler}" ) )
:attr "definition" :open-range :locref "1")
with german.sty:
(indexentry :tkey ( ( "Euler" "\\textsc{Euler}" ) )
:attr "definition" :open-range :locref "1")

[5 min later.]

I just saw that you have already fixed this bug :) Ok. then forget

> > 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}

Aargh! It seems that this is a very confusing week. I have have
overlooked so many things, this week. Stupid stuff this... :)