Here is a minimum working example:
% !TEX TS-program = pdflatexmk
\documentclass{book}
\usepackage{xcolor}
\usepackage{makeidx}
\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor={red!50!black}}
\makeindex
\begin{document}
%\frontmatter
\Large \textsc{Reasonable Book}
\tableofcontents
%\mainmatter
\chapter{One}
Some text \textbf{indexed}\index{indexed}
%\backmatter
\chapter{FDL}
The purpose of this License
\addcontentsline{toc}{chapter}{Index}
\printindex
\end{document}
When I click on Index
in the table of contents
I get Chapter 2 FDL
instead of Index
. (Originally, FDL was in backmatter but that did not seem to be where the problem is so here I commented all three "matters" out.)
\addcontentsline
for the index has to be on the same page as the start of the index. insert a line\newpage
before it, just to make sure. (and keep the blank line above it.)\newpage
alone did not do it for me. But with\phantomsection
it did, texhack notwithstanding, More below, though.\newpage
was intended to correct. and yes,\phnatomsection
is certainly needed to get a correct hyperlink.