我正在做一个演示来解释一个生成图片的算法。我想使用两列,一边是图片,另一边是算法。我想点击算法,用粗体或不同的颜色突出显示连续的步骤,并让图像随着我的操作而变化以显示相关步骤。到目前为止,我已经尝试过这个:
\begin{frame}
\begin{columns}
\begin{column}{.5\linewidth}
\includegraphics<1>[width=\linewidth]{step1.pdf}
\includegraphics<2>[width=\linewidth]{step2+3.pdf}
\includegraphics<3>[width=\linewidth]{step4.pdf}
\includegraphics<4>[width=\linewidth]{step5.pdf}
\includegraphics<5>[width=\linewidth]{step6.pdf}
\includegraphics<6>[width=\linewidth]{step7.pdf}
\includegraphics<7>[width=\linewidth]{result.pdf}
\end{column}
\begin{column}{.5\linewidth}
\begin{itemize}
\item \only<1>{\color{blue}} Start with cube (generation 0)
\item \only<2>{\color{blue}} Split into 8 sub-cubes (generation 1)
\item \only<2>{\color{blue}} Select fertile sub-cubes
\item \only<3>{\color{blue}} Split fertile sub-cubes (generation 2)
\item \only<4-6>{\color{blue}} Repeat until maximum generation reached
\item \only<7>{\color{blue}} Place stars
\end{itemize}
\end{column}
\end{columns}
\end{frame}
但这似乎会使所有 \items 都变成蓝色,直到我到达该步骤,然后将它们变成黑色。我希望除了我突出显示的那个之外,它们全部都是黑色。
答案1
一种选择是使用alert@
叠加规范来突出显示所需幻灯片上的文本;例如,
\item<3-|alert@3>
显示从第三张幻灯片开始的项目文本,并仅在第三张幻灯片上突出显示。可以使用以下方法更改用于突出显示文本的颜色:
\setbeamercolor{alerted text}{fg=<color>}
代码:
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{.5\linewidth}
\includegraphics<1>[width=\linewidth]{example-image}
\includegraphics<2>[width=\linewidth]{example-image-a}
\includegraphics<3>[width=\linewidth]{example-image-b}
\includegraphics<4>[width=\linewidth]{example-image-c}
\includegraphics<5>[width=\linewidth]{example-image-16x9}
\includegraphics<6>[width=\linewidth]{example-image-16x10}
\includegraphics<7>[width=\linewidth]{example-image-golden}
\end{column}
\begin{column}{.5\linewidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{itemize}
\item<1-|alert@1> Start with cube (generation 0)
\item<2-|alert@2> Split into 8 sub-cubes (generation 1)
\item<2-|alert@2> Select fertile sub-cubes
\item<3-|alert@3> Split fertile sub-cubes (generation 2)
\item<4-|alert@4-6> Repeat until maximum generation reached
\item<7-|alert@7> Place stars
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
结果动画: