0

\hyperlink{page.#} seems a little buggy. I tried it with roman page numbers. It worked with ix but not with vii. Is there a way to refer to the physical page number , i.e. the one that shows in the counter at the top of the typeset PDF document?

I tried truepage but it did not work.

I tried negative numbers (e.g. {page.-4}). It did not work either...

1

1 Answer 1

1

You can switch to absolute page numbers, but it's all or nothing. Also, while [plainpages] will link to page ii as 2, it will not link to page 2 as 6.

\documentclass{book}
\usepackage[hypertexnames=false]{hyperref}
\usepackage{lipsum}

\makeatletter
\newcommand\abspagenumber{\the\Hy@pagecounter}
\makeatother

\begin{document}
\frontmatter

\hyperlink{page.2}{Go to page 2}

\hyperlink{page.6}{Go to page 6}

\lipsum[1-20]

\mainmatter

\abspagenumber

\lipsum[1-20]

\end{document}

This gives you the option of linking to \thepage or \theHpage (absolute).

\documentclass{book}
\usepackage{hyperref}
\usepackage{lipsum}

\newcounter{Hpage}
\AddToHook{shipout/after}{\raisebox{\dimexpr \headheight+\headsep}[0pt][0pt]{\refstepcounter{Hpage}}}
\setcounter{Hpage}{1}

\begin{document}
\frontmatter

\hyperlink{page.2}{Go to page 2}

\hyperlink{page.ii}{Go to page ii}

\hyperlink{Hpage.2}{Go to Hpage 2}

\hyperlink{Hpage.6}{Go to Hpage 6}

\lipsum[1-20]

\mainmatter

\lipsum[1-20]

\end{document}
2
  • the answer is a bit confusing, as you at first mention plainpages (which as you probably realized doesn't work here) and then set hypertexnames. Mar 31 at 8:21
  • @UlrikeFischer - I only mentioned plainpages to explain why I wasn't using it. Mar 31 at 15:14

You must log in to answer this question.

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