1

Consistently the \pageref links to Slide~0 no matter what slide you are \pageref back to. It seems a counter problem. Also there is not Slide 0.

I am attaching a MWE with two slides that show the issue.

The same code processed with the slides \documentclass{powersem} generates the correct backreferences. I, however, don't have the option of using any other slides documentclass.

Thank you for your help.

Luis A.

\documentclass{slides}
%\documentclass{powersem}
\usepackage[landscape]{geometry}  
\begin{document}
%--------------------------------------------
\begin{slide}{}\centering{\textbf{Title for Slide One}}

\begin{itemize}
  \item~\label{slide:this.is.slide.one}
  Here I page-referenced Slide-Two using \newline \verb+Slide~\pageref{slide:this.is.slide.two}.+

  But I got the wrong page-reference: Slide~\pageref{slide:this.is.slide.two}.\newline
  It should read: Slide~2.
\end{itemize}
\end{slide}
%--------------------------------------------
%--------------------------------------------
\begin{slide}{}\centering{\textbf{Title for Slide Two}}

  \begin{itemize}
\item~\label{slide:this.is.slide.two}
  Here I page-referenced Slide-One using \newline \verb+Slide~\pageref{slide:this.is.slide.one}.+

  But I got the wrong page-reference: Slide~\pageref{slide:this.is.slide.one}.\newline
  It should read: Slide~1.

\end{itemize}
\end{slide} 
%--------------------------------------------
\end{document}
3
  • unrelated but \centering{\textbf{Title for Slide One}} is wrong syntax \centering does not take an argument so the outer {...} do nothing and that applies \\centering to the whole slide. Oct 22, 2019 at 18:50
  • Jasper: Thank you very your proposed solution works. Oct 22, 2019 at 19:14
  • David: thank you for the comment on the use of \centering. That is useful to know. Oct 22, 2019 at 19:17

1 Answer 1

0

I hope I didn’t overlook something too obvious, but as far as I can see you can’t use the normal page counter with slides, because – according to the package documentation – it is set to zero “except when putting out an extra page for a slide, note or overlay.” Hence, in your case \thepage always returns 0 (while the slide number is returned by \theslide).

The \label and \ref macros need the macro \refstepcounter. But the package obviously does not call this macro when it outputs a new slide. Hence, I inserted this macro into the package code:

\documentclass{slides}
%\documentclass{powersem}

\usepackage{etoolbox}
\newcounter{slidenum}
\patchcmd{\slide}{\stepcounter{slide}}{\stepcounter{slide}\refstepcounter{slidenum}}{}{}

\usepackage[landscape]{geometry}  
\begin{document}
%--------------------------------------------
\begin{slide}\label{slide:this.is.slide.one}
\begin{center}\textbf{Title for Slide One}\end{center}

\begin{itemize}
  \item
  Here I page-referenced Slide-Two using \newline \verb+Slide~\pageref{slide:this.is.slide.two}.+

  But I got the wrong page-reference: Slide~\ref{slide:this.is.slide.two}.\newline
  It should read: Slide~2. 
\end{itemize}

\end{slide}
%--------------------------------------------
%--------------------------------------------
\begin{slide}
\begin{center}\textbf{Title for Slide Two}\end{center}

\begin{itemize}
  \item\label{slide:this.is.slide.two}
  Here I page-referenced Slide-One using \newline \verb+Slide~\pageref{slide:this.is.slide.one}.+

  But I got the wrong page-reference: Slide~\ref{slide:this.is.slide.one}.\newline
  It should read: Slide~1.
\end{itemize}

\end{slide} 
%--------------------------------------------
\end{document}

You must log in to answer this question.

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