latex3 / latex3/hyperref

\pageref link target goes to wrong page

Open
#206 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Bug description in text.

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{First page section}
First page text.

\newpage
Second page text, with label text2.\label{text2}

\newpage
Third page text, with pageref to text2: page \pageref{text2}.
It is correctly printed as 2, but the hyperlink goes to page 1, since
that is where the last section was. This seems like wrong behavior for
*page*ref.

This is with current (10sep21) pdflatex-dev, although I doubt the
particular versions make a difference.

\end{document}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the LaTeX reproducer in the issue and run it with pdflatex-dev to confirm that \pageref{text2} displays page 2 but links to page 1. Trace how hyperref creates the page reference target for the label after the section break. Done means the link for text2 targets the second page while retaining the displayed value 2.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.