1

I have a question similar to Beamer enumeration, continue counting but keep item at fixed position. But the solution provided by https://tex.stackexchange.com/a/188046 cannot make other counters on the second page work (e.g. step and be referenced).

I know I should comment directly under the question answer, but I can't because I don't have 50 reputation.

MWE

\documentclass{beamer}
\usepackage{etoolbox}
\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\def\beamerslideinframe{\beamer@slideinframe}
\makeatother
\def\AdvCnt{\setcounter{enumi}{\numexpr\arabic{slideinframe}-1\relax}}
\pretocmd{\item}{\AdvCnt}{}{}
\begin{document}
\begin{frame}
\begin{enumerate}
\only<+>{
  \item Item 1 \label{enu:1}
  \begin{equation}
  a+b=c\label{equ:1}
  \end{equation}
}
\only<+>{
  \item Item 2 \label{enu:2}
  \begin{equation}%\refstepcounter{equation}
  d+e=f\label{equ:2}
  \end{equation}
}
\end{enumerate}
\ref{enu:1}, \eqref{equ:1}, \ref{enu:2}, \eqref{equ:2}.
\end{frame}
\end{document}

enter image description here enter image description here

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 03 '23 at 07:29

1 Answers1

0

By default the \label macro will try to create a label on the first overlay. As some of your items/equations are not present on the first overlay, you get undefined references.

To avoid this, you can use \label<>{...} to link to a specific overlay:

\documentclass{beamer}

\makeatletter \def\c@slideinframe{\beamer@slideinframe} \def\beamerslideinframe{\beamer@slideinframe} \makeatother \def\AdvCnt{\setcounter{enumi}{\numexpr\arabic{slideinframe}-1\relax}\setcounter{equation}{\numexpr\arabic{slideinframe}-1\relax}} \pretocmd{\item}{\AdvCnt}{}{}

\begin{document} \begin{frame}

\begin{enumerate} \only<+>{ \item Item 1 \label{enu:1} \begin{equation} a+b=c\label{equ:1} \end{equation} } \only<+>{ \item Item 2 \label<.>{enu:2} \begin{equation} d+e=f\label<.>{equ:2} \end{equation} } \end{enumerate}

\ref{enu:1}, \eqref{equ:1}, \ref{enu:2}, \eqref{equ:2}. \end{frame} \end{document}

enter image description here

Imho, the approach you choose to display items one at a time is quite invasive and will alter the behaviour of all items in your presentation. I would suggest this less invasive approach:

\documentclass{beamer}

\begin{document} \begin{frame}

\begin{enumerate} \alt<1>{ \item Item 1 \label{enu:1} \begin{equation} a+b=c\label{equ:1} \end{equation} }{ \refstepcounter{enumi} \refstepcounter{equation} \item Item 2 \label<2>{enu:2} \begin{equation} d+e=f\label<2>{equ:2} \end{equation} } \end{enumerate}

\ref{enu:1}, \eqref{equ:1}, \ref{enu:2}, \eqref{equ:2}. \pause \end{frame} \end{document}