Index with an initial letter of the group [duplicate]

Possible Duplicate:
package makeidx: print first letter for each group of keys

I'm trying to adapt the index of my contribution such that each group of words (starting with the same letter) has the starting letter displayed as bold an on top of the group.

Note that I tried to find an answer, but the related questions and answers are rather confusing. I use \documentclass[a4paper,12pt]{book} and \usepackage{makeidx} \makeindex.

-

marked as duplicate by Torbjørn T., Paulo Cereda, Marco Daniel, percusse, lockstepJul 30 '12 at 16:50

–  lockstep Jul 30 '12 at 15:28

We need to create an .iststyle file and tell makeindex to use it. My style file is as follows:

headings_flag 1


The first line tells makeindex to display a heading for each group (1 stands for true). The last two lines will format the heading the way you want (I used textbf to make the heading bold).

Now, with myheader.ist, we simply call

makeindex -s myheader.ist myfile.idx


Consider this example:

% arara: pdflatex
% arara: makeindex: { style: myheader.ist }
% arara: pdflatex
\documentclass[a4paper,12pt]{book}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}

\makeindex

\begin{document}

\index{Bilberry}\index{Blackberry}\index{Blackcurrant}\index{Blueberry}
\index{Currant}\index{Cherry}\index{Cherimoya}\index{Clementine}
\index{Date}\index{Damson}\index{Dragonfruit}\index{Durian}
\index{Eggplant}\index{Elderberry}\index{Feijoa}\index{Gooseberry}
\index{Grape}\index{Grapefruit}\index{Guava}\index{Huckleberry}
\index{Jackfruit}\index{Jambul}\index{Kiwi fruit}\index{Kumquat}
\index{Legume}\index{Lemon}\index{Lime}\index{Lychee}\index{Mandarine}
\index{Mango}\index{Melon}\index{Nectarine}\index{Orange}\index{Peach}
\index{Pear}\index{Pitaya}\index{Physalis}\index{Plum}\index{Pineapple}
\index{Pomegranate}\index{Purple Mangosteen}\index{Raisin}\index{Raspberry}
\index{Rambutan}\index{Redcurrant}\index{Salal berry}\index{Satsuma}
\index{Star fruit}\index{Strawberry}\index{Tangerine}\index{Tomato}
\index{Ugli fruit}\index{Watermelon}\index{Ziziphus mauritiana}

\printindex

\end{document}


Running the following commands:

pdflatex myfile.tex

Hope it helps. :)
I thought that if you use the makeidx package, it runs makeindex internally for you, so you don't need a separate run. Am I mistaken? –  Brent.Longborough Jul 30 '12 at 15:44
@Brent.Longborough: The package imakeidx has this functionality. –  Marco Daniel Jul 30 '12 at 16:07
@Brent: makeidx provides a couple of extra commands to the default indexing mechanism, but that's all. As Marco mentioned, imakeidx has this feature. :) –  Paulo Cereda Jul 30 '12 at 16:18