[Tex/LaTex] package makeidx: print first letter for each group of keys

indexing

I've created index with makeidx package. It works. What really need is to print the first letter above every group of keys (i.e. referring to the image I want to print the red letter, that I have manually inserted).

enter image description here

Best Answer

According to How to create capital letter for index you would require the following in a file test.ist (or test.mst*):

headings_flag 1
heading_prefix "\\textsf\{\\color\{red\}"
heading_suffix "\}\\nopagebreak\n"

Then when you run makeindex, you need to use the -s option to specify this style file (assuming your document is called test.tex):

makeindex -s test.ist test.idx

The first flag set allows for the creation of the header (a letter). The second prefix and third suffix flag wraps the header contents to obtain the appropriate formatting ({\textsf{\color{red}...} in this case).

* According to makeindex man page, "If exactly one input file was given and no explicit style file was specified using -s, makeindex uses a file with the extension .mst as default style file (when present)."

Related Question