2

I have a rather lengthy index to my document. I have a bookmark so I can quickly get to the index, but I'd like child bookmarks for each letter of the alphabet so I can go to that section of the index directly. I am currently using the imakeidx package for generating my index, but I couldn't find any package options allowing me to create the child bookmarks.

Any suggestions?

6

Example file:

\RequirePackage{filecontents}
% File \jobname.mst is overwritten, if package filecontents is loaded!
\begin{filecontents*}{\jobname.mst}
headings_flag 1
heading_prefix "\\IndexHeading{"
heading_suffix "}"
\end{filecontents*}

\documentclass{article}
\usepackage{hyperref}
\usepackage{bookmark}

\newcommand*{\IndexHeading}[1]{%
  \belowpdfbookmark{#1}{#1}%
}

\usepackage{imakeidx}
\makeindex

\begin{document}
Hello\index{hello} world\index{world}!

\cleardoublepage
\pdfbookmark{\indexname}{index}
\printindex
\end{document}

Makeindex automatically looks for a file \jobname.mst for style definitions. There the headings can be configured. The example inserts macro \IndexHeading, which creates a bookmark below the current level.

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.