Beamer 暂停和编号

Beamer 暂停和编号

我第一次尝试使用 beamer(但对 LaTeX 有一些经验)。我想使用 \pause 并给一些问题编号,但数字却在我不想的时候递增。一定有一个简单的方法可以解决这个问题,但我还没有找到。以下是代码示例

\documentclass{beamer}
\usetheme{Madrid}

\newcounter{bar}
\newcommand{\pbctr}{%
   \stepcounter{bar}%
    \thebar}

\begin{document}

\begin{frame}{Some examples and problems}
\begin{block}{Problem \pbctr}
\begin{enumerate}
\item How many divisors does the number 2 have?
\pause
\item How many divisors does the number 4 have?
\pause
\item What is the smallest number with six divisors?
\end{enumerate}
\end{block}
\pause
\begin{block}{Problem \pbctr}
\begin{itemize}
\item Can I distribute evenly 30 apples amongst 5 children
\pause
\item Can I distribute evenly 33 apples amongst 6 children?
\end{itemize}
\end{block}
\end{frame}
\end{document}

任何帮助,将不胜感激。

code

答案1

简而言之:什么也不要做,让 beamer 来解决你的问题 :)

\documentclass{beamer}
\usetheme{Madrid}

\setbeamertemplate{theorems}[numbered]

\begin{document}
    \begin{frame}{Some examples and problems}
        \begin{problem}
            \begin{enumerate}
                \item How many divisors does the number 2 have?
                \pause
                \item How many divisors does the number 4 have?
                \pause
                \item What is the smallest number with six divisors?
            \end{enumerate}
        \end{problem}
        \pause
        \begin{problem}
            \begin{itemize}
                \item Can I distribute evenly 30 apples amongst 5 children
                \pause
                \item Can I distribute evenly 33 apples amongst 6 children?
            \end{itemize}
        \end{problem}
    \end{frame}
\end{document}

在此处输入图片描述

相关内容