1

In the MWE below, the hyperlink from the index page does not take you to the correct page to where the index is:

\documentclass{book}
\usepackage{lipsum, fancyhdr}

\usepackage{makeidx} 
\makeindex 

\usepackage{hyperref}
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,hypertexnames=false,colorlinks=false,breaklinks=true,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}

\begin{document}

\pagestyle{empty}
% pagestyle{plain}
\frontmatter

\lipsum[1]

\mainmatter
\pagestyle{fancy}

\chapter{1}
\section{1}
\lipsum
This is index ONE\index{One}
\newpage
This is index TWO\index{Two}


\backmatter
\pagestyle{empty}
%\pagestyle{plain}

\lipsum[1]

\cleardoublepage
\setlength{\columnsep}{0.75cm}
\addcontentsline{toc}{chapter}{Index}
\printindex

\end{document} 

If you click on the "2" in the index, you get taken to page ii instead of page 2 to where the index is.

Can you offer a solution so that if you click on the hyperlink in the index, you will be taken to the correct page?

1
  • This is maybe related.
    – Albert
    Jul 6, 2020 at 22:36

2 Answers 2

1

I had the same problem, in Index, correct pagenumbers are displayed, but hyperref was pointing 3 pages before....

In my case, I solved it by putting a \pagenumbering{roman} directly after \begin{document}.

\begin{document}
\pagenumbering{roman}

This seems to get the internal pagenumbering for \makeindex and hyperref straight.

3

With hypertexnames=false also correct index links are disabled, use the default value true instead.

Option breaklinks does not magically add support for breaking links across lines, if the driver does not support this. Then the text is broken across lines, but the link areas are quite wrong.

The data for the PDF information keys should be set after package hyperref is loaded via \hypersetup. Otherwise LaTeX will hard expand the values and garbage can be the result.

Option setting backref=true and pagebackref=true is contradictory. Either use the former with section back references or the latter with page number back references.

Also I recommend package bookmark for faster updated bookmarks.

1
  • This is a more general answer than the accepted solution. Thanks!!
    – tgkolda
    Nov 29, 2023 at 18:31

You must log in to answer this question.

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