0

In a document that looks like this:

\AtBeginDocument[seminar]{%
  \pdfhorigin=1sp
  \pdfvorigin=1sp
  \paperwidth=297truemm
  \paperheight=210truemm
}

\documentclass[article]{seminar}

\usepackage[bookmarks,breaklinks=true,% pdftex,% pagebackref=true,% ]{hyperref}

\usepackage{url}

\renewcommand{\slidelabel}{} \setlength{\textwidth}{0.9\textwidth}

\newcommand{\sltitle}[1]{{\centering\textbf{\Large #1} \vskip 2em plus 0pt minus 2em\par}} % Slide title

\centerslidesfalse

\begin{document}

\pdfbookmark[0]{intro}{intro}

%%%%%

\begin{slide} \sltitle{Intro} \end{slide}

\begin{itemize} \item ... \item ... \end{itemize}

%%%%%

\begin{slide} \sltitle{Foo} \begin{itemize} \item foo \item foo \item foo \item foo \end{itemize} \end{slide}

\begin{itemize} \item ... \item ... \pageref{BAR}. \end{itemize}

%%%%%

\pdfbookmark[1]{Bar}{bar}

\begin{slide} \sltitle{Bar} \begin{itemize} \item bar \item bar \item bar \item bar \end{itemize} \end{slide}

\label{BAR}

\begin{itemize} \item Volutpat... \end{itemize}

\end{document}

The ... parts are in reality longer text paragraphs. The resulting document has 3 A4 pages. The pageref link on page 2 is rendered as '3', however the link in the PDF document points to page 1 instead of 3. I am at loss as to what could be causing this.

This is how it looks like when page 2 is displayed in Evince - the link says page 3, however the preview of the link destination shows contents from page 1: demonstration of the problem

This is minimal version of much larger document. What happens there is that the page links seem to be reduced to a set of (invalid) page targets. E.g. links to pages 61, 87 (and others) point to page 9, links to pages 161, 194 (and others) point to page 145, etc.

I am using Version 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian).

The document is run twice through pdflatex.

For the full minimal document source and generated file, see https://github.com/vladak/pageref-pdf-links

Vlad
  • 1
  • well you can try \newcommand\theHslide{\thepage.\arabic{slide}} or something like that to get unique page numbers. But be warned that seminar changes various latex core command, is not meant to pdflatex (it loads pstricks), is old and basically unmaintained. If something breaks with a current LaTeX you are on your own. – Ulrike Fischer Nov 05 '23 at 17:57
  • I assume that command would have to be used on every slide ? – Vlad Nov 05 '23 at 18:07
  • A \newcommand should always be used only once, so no put it into the preamble. – Ulrike Fischer Nov 05 '23 at 18:14
  • I tried inserting the newcommand before the begin of the document, had to use renewcommand and then used that command before each slide. It merely put the numbers to the document, did not change the link. – Vlad Nov 05 '23 at 18:37
  • put also an anchor on the target page, eg. \phantomsection\label{BAR}. If in your document \theHslide is already suitably defined then you probably don't need the command at all. – Ulrike Fischer Nov 05 '23 at 18:47
  • 1
    Oh, I realize this is a dup of https://tex.stackexchange.com/questions/193380/hyperref-pageref-links-point-to-first-page – Vlad Nov 05 '23 at 20:18

0 Answers0