[Tex/LaTex] Setting the name of an index with makeidx and adding to table of contents

indexingnamingtable of contents

I would like to change the name of my index, so that instead of "Index", it reads "Index of whatever I want". I've tried quite a few things:

  • redefining \indexname, after or before calling \makeindex
  • using the index package and calling \newindex instead of \makeindex

None of these worked.

Also, I'm trying to add the index to the ToC, but it doesn't get linked properly. From what I understand the contentsline should be called inside the .ind but this file is generated by makeindex. How can I do that?

Best Answer

\documentclass[a4paper]{book}
\usepackage{imakeidx}
\makeindex[title=What?,intoc]

\usepackage{hyperref}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{A}
a\index{a}
\backmatter
\printindex
\end{document}

You can give imakeidx the original option, if you don't like using multicol for balancing the columns in the final index page. The package supports multiple indices, with possibly different number of columns.

(Disclaimer: I'm one of the authors.)