I'm using \printindex for my index and I wonder how to have

  1. bold page numbers
  2. ordering by first character of the indexed word and have dots in between the name and page number like

Apple .... 1
Always ... 5

Bottle ... 2
Beauty ... 7


I'm assuming that your index was generated with the help of the makeindex program. This program is automatically called when you compile a LaTeX document with makefiles like latexmk and may also be called by editors like TeXworks or TeXnicCenter. The output generated by makeindex can be configured by using an .ist style file. Details about creating such a file can be found e.g. in section 11.2 of the LaTeX Companion. The following example file would create bold headings for each index letter group and add dots between index keywords and page numbers.

headings_flag 1
heading_prefix "{\\bfseries "
heading_suffix "}\\nopagebreak\n"
delim_0 " \\dotfill "
delim_1 " \\dotfill "
delim_2 " \\dotfill "

To use the file, save it as mystyle.ist and call makeindex with the parameter

-s mystyle.ist

when compiling your LaTeX document. How to exactly add this parameter depends on your compilation method. As a quick workaround: If your main document is called <name>.tex, save the above file as <name>.mst (note the different file type!), copy it to your working directory and compile <name>.tex as usual.

Note that there is a package called idxlayout (disclosure: I'm the package author). This package acts as a complement to .ist files for configuring index layout parameters, e. g. allowing for three-column indexes or for "parent" items and their affiliated subitems being typeset as a single paragraph.

  • 1
    Awesome! Thanks! As I use TexnicCenter, I could define the option "-s stylefile.ist" for my compilation-profile easily! Works great!! – tim May 3 '11 at 9:51
  • 2
    Could you please explain me how to make the font of the main-items bold? Tried it with item_0 "\n \\bf{\\item}" but this makes also the dots, the page number and the subitems bold... – tim May 3 '11 at 10:05
  • This works also with sections, i.e. heading_prefix "{\\section*{", in order to have consistent formatting with bibliographies grouped by initial letters, like here: tex.stackexchange.com/questions/150068/… – Martin Jan 7 '16 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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