Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How do I format the first letter of the first entry of a letter group in an index generated with xindy? The result should look something like this:

...
\indexspace

\item \textbf{b}athroom\quad{}1
\item beginner\quad{}9
\item boldface\quad{}2
...
share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

There probably is a better solution than the present hack; however, the standard setting of xindy writes in front of each group something like

\lettergroup{A}

it's sufficient to say

\long\def\lettergroup#1\item{\item\textbf}
\let\lettergroupDefault\lettergroup

in the preamble. A letter group will be something like

\lettergroup{A}
\item abc

and the macro ignores everything up to the first item changing it into \item\textbf, so LaTeX will see

\item\textbf abc

and all will be right, as \textbf is a macro with one argument. For more complicated cases such as accented letters, this might be insufficient, though.

share|improve this answer
    
Thanks a lot! Unfortunately (and as you suspected yourself) the solution does not work for more complicated cases like \index{ASCC@\textsc{ascc}} and also does not allow more complex formatting. Maybe I should ask the program authors. –  Till A. Heilmann Jan 3 '12 at 7:53
    
If index entries have "semantic formatting", then setting their first letter in boldface seems not to be correct. At any rate, designing a general macro for this is quite difficult; it would be easier if one knew what sort of different entries can be expected. –  egreg Jan 3 '12 at 9:23
1  
It is strictly a matter of visual guidance for the reader signalling the beginning of a new letter group. I do not want to waste space with separate lines saying "A", "B", "C" and so on. It is probably easiest to do the formatting in the automatically generated *.ind file by hand. –  Till A. Heilmann Jan 3 '12 at 10:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.