我有一份演示文稿幻灯片的以下代码:
\begin{frame}
\frametitle{Heuristic Policies}
\begin{columns}
\column{0.5\textwidth}
\begin{itemize}
\item<1-> These are methods aiming to give a good but not necessarily optimal solution to a problem.
\item<2-> There exist a number of such policies for bandit problems.
\only<1-9>{
\item<3-9> Greedy policy:
\begin{itemize}
\normalsize
\item<4-9> choose arm with greatest expected reward
\item<5-9> ignores variability in prior distribution
\item<6-9> quite good for Bernoulli bandits, but less effective for normal bandits
}
\end{itemize}
\end{itemize}
\column{0.3\textwidth}
\vspace{-25pt}
\uncover<7->{\begin{figure}
\begin{center}
\includegraphics[height = 2.7cm, trim=-1cm 0cm 0cm 0cm,clip=true]{bandit.jpg}
\caption*{$(\alpha,\beta) = (1,1)$}
\end{center}
\end{figure}}
\vspace{-25pt}
\uncover<8->{
\begin{figure}
\begin{center}
\includegraphics[height = 2.7cm, trim=-1cm 0cm 0cm 0cm,clip=true]{bandit.jpg}
\caption*{$(\alpha,\beta) = (6,5)$}
\end{center}
\end{figure}}
\column{0.2\textwidth}
\uncover<7->{$\mu = \frac{1}{2}$}\\
\vspace{70pt}
\uncover<8->{$\mu = \frac{6}{11}$}\\
\only<9>{$\Rightarrow$ play this arm}
\end{columns}
\end{frame}
目前,它正在做我想要的事情。但是,下一步是删除“贪婪政策”中的所有项目符号以及“玩这个手臂”,并将项目符号文本替换为以相同方式格式化的类似文本。但是,我看不出使用 \only 来做我想要的事情。我试过:
...
\item<4-9> choose arm with greatest expected reward
\item<5-9> ignores variability in prior distribution
\item<6-9> quite good for Bernoulli bandits, but less effective for normal bandits
}
\end{itemize}
\only<10-16>{
\item<10-16> Next policy:
\begin{itemize}
\normalsize
\item<11-16> comment 1
\item<12-16> comment 2
\item<13-16> comment 3
}
\end{itemize}
\end{itemize}
\column{0.3\textwidth}
...
但这不起作用。有人能告诉我我做错了什么吗?谢谢。
答案1
您的目标似乎是提出几种不同的政策,同时将前两项的一般描述保留为常数。您可以使用\alt
和的组合\only
:
\documentclass{beamer}
\begin{document}
\begin{frame}[t]
\frametitle{Heuristic Policies}
\begin{columns}
\column{0.5\textwidth}
\begin{itemize}
\item<1-> These are methods aiming to give a good but not necessarily optimal solution to a problem.
\item<2-> There exist a number of such policies for bandit problems.
\alt<1-9>{
\item<3-9> Greedy policy:
\begin{itemize}
\normalsize
\item<4-9> choose arm with greatest expected reward
\item<5-9> ignores variability in prior distribution
\item<6-9> quite good for Bernoulli bandits, but less effective for normal bandits
\end{itemize}
}{\only<10-14>{\item<10-> Next policy:
\begin{itemize}
\normalsize
\item<11-14> comment 1
\item<12-14> comment 2
\item<13-14> comment 3\par
\rule{0pt}{2.7cm}
\end{itemize}}
\only<15-18>{\item<15-> Another policy:
\begin{itemize}
\normalsize
\item<16-18> Another comment 1
\item<17-18> Another comment 2
\item<18-18> Another comment 3\par
\rule{0pt}{2.7cm}
\end{itemize}}
}
\end{itemize}
\column{0.3\textwidth}
\vspace{-25pt}
\uncover<7->{\begin{figure}
\begin{center}
\includegraphics[height = 2.7cm, trim=-1cm 0cm 0cm 0cm,clip=true,width=3cm]{example-image-a}
\caption*{$(\alpha,\beta) = (1,1)$}
\end{center}
\end{figure}}
\vspace{-25pt}
\uncover<8->{
\begin{figure}
\begin{center}
\includegraphics[height = 2.7cm, trim=-1cm 0cm 0cm 0cm,clip=true,width=3cm]{example-image-a}
\caption*{$(\alpha,\beta) = (6,5)$}
\end{center}
\end{figure}}
\column{0.2\textwidth}
\only<9>{$\Rightarrow$ play this arm}
\only<13-14>{$\Rightarrow$ play this arm with probability $\varepsilon$\vspace{80pt}}
\only<14>{$\Rightarrow$ play this arm with probability $1-\varepsilon$}
\end{columns}
\onslide<10>{\null}
\end{frame}
\end{document}
为了避免前两个常见项目的跳跃,我使用了一些“隐形”规则。
生成的文档的动画图像: