beamer
我有一个如下所示的框架:
\begin{tabular}{ccccc}
\includegraphics[width=.15\textwidth]{imgs/a1} & \pause
\includegraphics[width=.15\textwidth]{imgs/a2} & \pause
\includegraphics[width=.15\textwidth]{imgs/a3} & \pause
\includegraphics[width=.15\textwidth]{imgs/a4} & \pause
\includegraphics[width=.15\textwidth]{imgs/a5} \\
\end{tabular}
\begin{tabular}{ccccc}
\includegraphics[width=.15\textwidth]{imgs/b1} & \pause \includegraphics[width=.15\textwidth]{imgs/b2} & \pause \includegraphics[width=.15\textwidth]{imgs/b3} & \pause \includegraphics[width=.15\textwidth]{imgs/b4} & \pause \includegraphics[width=.15\textwidth]{imgs/b5} \pause \\
\end{tabular}
我想要做的是按顺序显示第二个表中的图像从右到左,也就是说,在第一个表格显示后,我希望它b5
首先出现(在最右边的位置),然后b4
,等等。
有没有一种“优雅”的方式来做到这一点(即不滥用\only<>
)?tabular
这样的环境合适吗?
答案1
您可以手动指定暂停次数:
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{tabular}{ccccc}
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause
\includegraphics[width=.15\textwidth]{lion.jpg} \\
\end{tabular}
\pause[10]
\begin{tabular}{ccccc}
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause[9]
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause[8]
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause[7]
\includegraphics[width=.15\textwidth]{lion.jpg} & \pause[6]
\includegraphics[width=.15\textwidth]{lion.jpg} \pause[5]\\
\end{tabular}
% \pause[11] % If you need to add more overlays after the images sequence you need to
% text % specify the number of the first pause and then move on with normal
% % pauses again, as shown in the commented code
% \pause
% text
\end{frame}
\end{document}
答案2
对此来说,环境tabular
并不是必需的。此外,您可以使用循环\foreach
来稍微自动化一些。
代码
\documentclass{beamer}
\usepackage{pgffor}
\usepackage{mwe} % provides images used in this example
\begin{document}
\begin{frame}
Left to right
\begin{center}
\foreach \img[count=\i] in {a,b,c} {
\visible<\i->{\includegraphics[width=.15\textwidth]{image-\img} \hskip15pt}
}
\end{center}
\bigskip
Right to left
\begin{center}
\foreach \img[count=\i] in {a,b,c} {
\pgfmathtruncatemacro{\r}{7-\i} % Here, 7 = 6 + 1 = number of last slide + 1
\visible<\r->{\includegraphics[width=.15\textwidth]{image-\img} \hskip15pt}
}
\end{center}
\end{frame}
\end{document}