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.

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

A
Apple .... 1
Always ... 5

B
Bottle ... 2
Beauty ... 7

share|improve this question

1 Answer 1

up vote 15 down vote accepted

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.

share|improve this answer
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

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.