\pause をスコープまたはオーバーライドしますか?

\pause をスコープまたはオーバーライドしますか?

複数のパートから成る問題が載っている講義スライドがあります。学生が問題全体をレイアウトして見ることができ、それからステップごとに答えを記入できるようにしたいと考えています。記入する内容を小さなチャンクに分割できる限り、これは可能です。

\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<+->)。残念ながら、align のように環境の途中で一時停止したい場合には機能しません (少なくとも非常に面倒になります)。

\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うまくいったのか、いまだによくわかりません。

関連情報