[Tex/LaTex] Makeindex – Styling the \printindex

formattingindexingnaming

I have two questions:

  1. Is it possible to change the titel of the printindex command? It is "Index" by default.
  2. How can I format the index as a multi column, alphabetic sorted list?

printindex title
Alphabetically sorted printindex

Best Answer

the answers depend on what document class you're using. however,

  1. both the basic latex classes (book et al.) and and ams-latex classes (amsbook et al.) provide the command \indexname with a default value "Index". so

    \renewcommand{\indexname}{New name}
    

    will change the title. (the babel package does this already for a number of languages.)

  2. both book.cls and amsbook.cls provide a two-column index style. if you're creating your own class, you might consider "borrowing" the code from one of those classes. documented code is given in the .dtx files classes for basic latex and amsclass for the ams-latex classes. "human readable" versions of the documented code are given in .pdf files of the same names as the .dtx files. all are on ctan, and they are probably also on your tex installation; try typing texdoc classes or texdoc amsclass at the command line.

to get the content sorted, you need to use makeindex; that is well documented in several places, including lamport's latex manual and the "companionn", as well as with texdoc makeindex. be sure to pay attention to the use of the "sort field" for math entries, entries with accented letters, and other special cases that may cause entries to diverge from the expected alphabetical order.

addendum: the imakeidx package is a good choice if more than one index is being produced. it isn't necessary to identify an entry for the main index by anything other than the basic \index command; for an odditional index, the designation of that index is entered as an option: \index[<name>]{<entry>}. a further advantage of imakeidx is that in most cases, a second compilation pass isn't needed. there are some caveats; for details, see the package documentation.

Related Question