10

I have a problem when adding index entries. When I use just the vanilla \index{...}, the generated PDF contains links on the page numbers in the index. But when using \index{...|textit} to mark index entries as primary entries, these links disappear. The same happens when I use textbf instead of textit.

I looked through the documentation of makeidx and hyperref, but didn't find any reference to that problem there.

Here is a minimal example. I used latexmk -pdf:

\documentclass{article} 
\usepackage{hyperref} 
\usepackage{makeidx}
\makeindex
\begin{document}
Text. \index{normal} \index{bold|textbf} \index{italic|textit}
\printindex
\end{document}

This is my TeX version:

This is pdfTeX, Version 3.1415926-1.40.10 
(TeX Live 2009/Debian) (format=pdflatex 2011.5.25)
5
  • 1
    Doesn't happen to me. You should load makeidx before hyperref, but actually doesn't make any difference in the output
    – egreg
    Jul 22, 2011 at 10:51
  • Hmm, I just compiled it on scribtex.com, and the linking works! Maybe it's a version problem? Jul 22, 2011 at 11:00
  • That might be. Add a \listfiles command to the sample and compare the results you get in the log file.
    – egreg
    Jul 22, 2011 at 11:08
  • I installed the latest texlive (20110724), and now my example works, but my original document still has the same problem. Still investigating.. Jul 25, 2011 at 11:38
  • OK, it looks like it's the memoir document class that's causing the problem. I changed my docuemtn to use the book class, and now the links work. Jul 25, 2011 at 11:57

1 Answer 1

10

OK, I found the solution. When looking at the .ind file produced by makeindex, the entries looked like this:

\begin{theindex}
  \item Principal entry, \textit{14}
  \indexspace
  \item Normal entry, \hyperpage{30}
\end{theindex}

This was because I used \index{Principal entry|textit} in my file. I solved it by defining a command that uses textit and hyperpage:

\newcommand{\boldindex}[1]{\textit{\hyperpage{#1}}}

And then using \index{Principal entry|boldindex} to index terms.

This is even explained in the README file of the hyperref package, http://www.ctan.org/tex-archive/macros/latex/contrib/hyperref/.

1
  • 1
    Now don't start convincing me to read those README files.
    – BMS
    Sep 16, 2014 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .