我有一些包含多部分問題的講座幻燈片。我希望學生能夠看到整個問題的佈局,然後逐步填寫答案。只要填滿的內容可以分成漂亮的小塊,這是可行的:
\documentclass{beamer}
\begin{document}
\begin{frame}\onslide<+->{}
This problem has three parts.
\begin{enumerate}
\item What is the answer to part 1?\\
\onslide<+->{First interpret the question.}\onslide<+->{ Then do some work.}\onslide<+->{ Now we can answer the question, and the answer is} \onslide<+->{ 42.}
\item What is the answer to part 2?\\
\onslide<+->{This problem is easy, and the answer is }\onslide<+->{0.}
\item What is the answer to part 3?\\
\onslide<+->{You'll have to figure this one out for yourself.}
\end{enumerate}
\end{frame}
\end{document}
這個解決方案相當優雅(除了最初\onslide<+->
增加計數器之外)。不幸的是,如果我想在環境中間暫停(例如對齊),它就會崩潰(或至少變得非常混亂):
\documentclass{beamer}
\usepackage{amsmath}
\begin{document}
%% Standard (?) fix to make \pause work at all in align environment
\mode<presentation>{\setbeamercovered{transparent=0}}
\makeatletter
\def\beamerorig@set@color{%
\pdfliteral{\current@color}%
\aftergroup\reset@color
}
\def\beamerorig@reset@color{\pdfliteral{\current@color}}
\makeatother
%%
\begin{frame}
This problem has three parts.
\begin{enumerate}
\item What is the answer to part 1?\\\pause
First interpret the question. Then calculate
\begin{align*}
\Pr[X\in A] &=\pause \frac{1}{2^n} \sum_{i=0}^n \binom{n}{i} \\
&=\pause 1
\end{align*}
\item What is the answer to part 2?\\\pause
More answers, \pause with more parts.
\item What is the answer to part 3?\\\pause
...
\end{enumerate}
\end{frame}
\end{document}
當然,如果我這樣做,問題的後面部分直到我們完成第一部分之後才會出現。
我可能可以通過將答案分解成更小的塊,然後確保前面的文本和第一部分align
同時顯示來使前一種方法發揮作用,但這似乎需要根據具體情況進行大量手動調整- 案例基礎。我認為正確的解決方案是要么將 的影響限制\pause
在答案本身的某個範圍內,要么通過強制我希望在開始時可見的後續材料不透明來覆蓋它(我相信修復已經align
使其成為可能)這樣文本就始終存在,只是透明的)。
有沒有好的方法可以做到這一點?
答案1
我最終使用了以下解決方法,使用(誠然非常黑客)\always
命令重置其內容的幻燈片計數器:
\documentclass{beamer}
\usepackage{amsmath}
%% Standard (?) fix to make \pause work at all in align environment
\mode<presentation>{\setbeamercovered{transparent=0}}
\makeatletter
\def\beamerorig@set@color{%
\pdfliteral{\current@color}%
\aftergroup\reset@color
}
\def\beamerorig@reset@color{\pdfliteral{\current@color}}
\makeatother
%%
%% \always{} command ensures that its contents are visible on all slides of the frame.
\newcounter{beamerpausessave}
\newcommand{\always}[1]{\setcounter{beamerpausessave}{\value{beamerpauses}}
\setcounter{beamerpauses}{0}\pause #1
\setcounter{beamerpauses}{\value{beamerpausessave}}\addtocounter{beamerpauses}{-1}\pause}
\begin{document}
\begin{frame}
This problem has three parts.
\begin{enumerate}
\always{\item What is the answer to part 1?\\}\pause
First interpret the question. Then calculate
\begin{align*}
\Pr[X\in A] &=\pause \frac{1}{2^n} \sum_{i=0}^n \binom{n}{i} \\
&=\pause 1
\end{align*}
\always{\item What is the answer to part 2?\\}\pause
More answers, \pause with more parts.
\always{\item What is the answer to part 3?\\}\pause
...
\end{enumerate}
\end{frame}
\end{document}
我仍然不太明白為什麼在沒有更簡單的方法的情況下,設定beamerpauses
和使用的特定組合\pause
會起作用。