11

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

1 Answer 1

9

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.

3
  • 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. Commented Jan 3, 2012 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
    Commented Jan 3, 2012 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. Commented Jan 3, 2012 at 10:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .