1

This is some sort of follow-up to the question: Compatibility of hypertexnames=false and indexes.

I will post Ulrike Fischer’s answer which shall now serve as MWE for this question:

\documentclass[index=totoc]{scrbook}
\usepackage{lipsum}
\usepackage{makeidx}
\makeindex

\usepackage[hypertexnames=false]{hyperref}

\makeatletter \usepackage{etoolbox} \patchcmd\Hy@EveryPageBoxHook{\Hy@EveryPageAnchor}{\Hy@hypertexnamestrue\Hy@EveryPageAnchor}{}{\fail} \makeatother

\begin{document}

\frontmatter

\title{Title} \maketitle

\mainmatter

\chapter{Chapter 1} \label{chap1} \index{BeginningChapter1}\lipsum\index{EndChapter1}

\chapter{Chapter 2} \index{BeginningChapter2}\lipsum\index{EndChapter2} \pageref{chap1} \printindex \end{document}

Albeit Ulrike Fischer warned that the option is »not much tested«, it also worked in every document I compiled until now (small and large): The page-references lead to correct page-numbers, and they are displayed correctly.

There is a new problem that arises: The absolute page number is still stored somewhere, and used in some PDF-readers and displayed when the cursor hovers over the reference. Two Screenshots from Okular and qpdfviewer (Adobe Acrobat Reader shows nothing, but I am using an old version with wine):

qpdfviewer

okular

Any idea if this can be fixed hyperrefs means? (Another user encountered the same problem here under different circumstances. Loading hyperref first as suggested in the answer actually works for the MWE, but I am dependent to load hyperref after a few other packages in many documents.)

Kubo
  • 368
  • This does not seem to be related to the index or to hypertexnames. A simpler MWE without index, with regular \usepackage{hyperref} and a \tableofcontents shows the same behavior in Okular (i.e., the tooltip refers to the absolute page and not the displayed page number). In other viewers such as Evince the problem does not show, both the simple MWE as your MWE show the correct tooltip. – Marijn Aug 04 '20 at 16:55
  • 3
    hyperref can do nothing if the viewers don't take the pagelabels into account. And I don't see that moving hyperref around in your MWE does change anything in the pdf. – Ulrike Fischer Aug 04 '20 at 16:55
  • OK. Nothing to do with LaTeX, then. @Ulrike Fischer Maybe you can post this as an answer, so I can accept it. The best thing to do would probably write a report to the relevant developers of the pdf-viewers then, I guess? – Kubo Aug 07 '20 at 08:31

0 Answers0