beamer icon indicating copy to clipboard operation
beamer copied to clipboard

wrong page labels when using \pause and \setbeameroption{show notes on second screen}

Open rndblnch opened this issue 3 years ago • 3 comments

the labels of pages are messed-up when using \pause in a frame in conjunction with \setbeameroption{show notes on second screen}. minimal sample below:

\documentclass{beamer}
\setbeameroption{show notes on second screen}
\setbeamertemplate{footline}[frame number]

\begin{document}
	\begin{frame}
		\begin{itemize}
	    \item 1
    	\end{itemize}
    \end{frame}
	\begin{frame}
		\begin{itemize}
	    \item 2
    	\pause
	    \item 3
    	\end{itemize}
    \end{frame}
\end{document}

opening the resulting document show that even if the frame number is right (see bottom right of the pages), the pdf label is wrong (see 1 instead of 2 for the second page in the thumbnails sidebar)

Screenshot 2022-11-29 at 23 28 19

this matters because page labels are used by presenter tools to detect frames.

rndblnch avatar Nov 29 '22 22:11 rndblnch

On 3.63 and 3.68 I see a similar issue when using evince to view. I am not using \pause anywhere that is visible in the source tex file.

\setbeameroption{show notes on second screen=right}

producing 2022-12-08-223010-snip and

\setbeameroption{show notes}

producing 2022-12-08-223302-snip

tgbugs avatar Dec 09 '22 06:12 tgbugs

I tried to resolve this by myself, but my knowledge of beamer internals is weak. commenting this line: https://github.com/josephwright/beamer/blob/main/base/beamerbasenotes.sty#L110 solves this issue for the minimal example I reported, but produce even weirder result for more complex cases (e.g. producing this labels 1, 2, 2, 4, 2, 6, 3 where i should get 1, 2, 2, 3, 3, 3, 4 for a doc with 4 frames having 1, 2, 3 and 1 steps)

knowledge of how pgfpages works looks necessary to dig into that …

rndblnch avatar Dec 09 '22 12:12 rndblnch

Workaround

Redefine the command pgfpagescurrentpagewillbelogicalpage and beamer@outsideframenote in the preamble to make the pdf page label same with the frame label:

\makeatletter
\ltx@ifpackageloaded{pgfpages}{%
  \let\old@pgfpagescurrentpagewillbelogicalpage\pgfpagescurrentpagewillbelogicalpage
  \renewcommand\pgfpagescurrentpagewillbelogicalpage{%
    \renewcommand*{\HyPL@EveryPage}{\relax}%
    \old@pgfpagescurrentpagewillbelogicalpage}
}{}

\let\old@beamer@outsideframenote\beamer@outsideframenote
\renewcommand\beamer@outsideframenote{%
  \renewcommand*{\thepage}{\insertframenumber}%
  \old@beamer@outsideframenote}
\makeatother

Explanation

The pdf page label is added by the hyperref package. In every page, hyperref write out some page info to aux file using \HyPL@EveryPage and the pdf page label is set to \thepage.

  1. In the case with option show notes on second screen, adding the following line

    \renewcommand*{\HyPL@EveryPage}{\relax}%
    

    before the line \pgfpagescurrentpagewillbelogicalpage{2} in file beamerbasenotes.sty#L110 will disable writing page label information into the PDF file when outputting note slides.

  2. For the case with option show notes, set the macro \thepage

    \renewcommand*{\thepage}{\insertframenumber}
    

    in the definition of beamer@outsideframenote to make the note page label same as the frame number. or you can add a prefix for the note page like this

    \renewcommand*{\thepage}{notes-\insertframenumber}
    

lrtfm avatar May 09 '24 07:05 lrtfm