在我的 Beamer 演示文稿中,我有三张图片和一个合并的 PDF,我想使用该animate
包将它们制作成动画。设置如下:三张图片并排排列,我想用动画替换第三张图片。也就是说,在第一张幻灯片上,我希望三张图片并排排列,而在第二张幻灯片上,我希望左边的两张图片紧挨着动画(因此动画将替换第三张图片)。
这是一张图片:
下面是一个 MWE,展示了我尝试做的事情:
\documentclass[8pt]{beamer}
\usetheme{Luebeck}
\usefonttheme{serif}
\setbeamertemplate{itemize item}{\color{black} $\vcenter{\hbox{\tiny$\bullet$}}$} %style of item
\setbeamertemplate{footline}[frame number]{}
\setbeamertemplate{navigation symbols}{}
\usepackage{xcolor}
\usepackage{graphicx}
\setlength{\parskip}{0.75em}
\usepackage{animate}
\usepackage{tikzsymbols}
\begin{document}
\begin{frame}
\begin{figure}
\centering
\includegraphics<1->[width = 0.33\textwidth]{cont_lasso.pdf}
\includegraphics<1->[width = 0.33\textwidth]{cont_ridge.pdf}
\includegraphics<1>[width = 0.33\textwidth]{cont_enet.pdf}
\animategraphics<2>[autoplay, loop, width = 0.33\textwidth]{30}{enet_ani_merged}{}{}
\end{figure}
The \textit{shape} of the penalty can give some idea of the type of shrinkage imposed on the model.
\begin{itemize}
\item Sharp corners $\to$ sparsity! \Laughey[1.5][yellow][pink]
\item Round corners $\to$ only shrinkage!
\end{itemize}
\end{frame}
\end{document}
三张图片的文件名分别为cont_lasso.pdf
、、cont_ridge.pdf
和cont_enet.pdf
,合并后的动画pdf名称为enet_ani_merged.pdf
。
编辑
为了澄清起见,我想让动画在我开始播放第二张幻灯片时自动开始播放。
经过一些实验,我的问题似乎是因为不允许将animategraphics
命令放在环境中,而不是因为覆盖。所以我现在想知道,如何才能将两个图形和动画放在同一个环境中?figure
答案1
抛开leandriis
评论,这里是代码,供任何想看看最终输出是什么样子的人使用。我不得不添加,noframenumbering
这样帧数就不会改变。
\documentclass[8pt]{beamer}
\usetheme{Luebeck}
\usefonttheme{serif}
\setbeamertemplate{itemize item}{\color{black} $\vcenter{\hbox{\tiny$\bullet$}}$} %style of item
\setbeamertemplate{footline}[frame number]{}
\setbeamertemplate{navigation symbols}{}
\usepackage{xcolor}
\usepackage{graphicx}
\setlength{\parskip}{0.75em}
\usepackage{animate}
\usepackage{tikzsymbols}
\begin{document}
\begin{frame}{Contour plots}
\begin{figure}
\centering
\includegraphics[width = 0.33\textwidth]{cont_lasso.pdf}
\includegraphics[width = 0.33\textwidth]{cont_ridge.pdf}
\includegraphics[width = 0.33\textwidth]{cont_enet.pdf}
%\animategraphics[autoplay, loop, width = 0.33\textwidth]{30}{enet_ani_merged}{}{}
\end{figure}
The \textit{shape} of the penalty can give some idea of the type of shrinkage imposed on the model.
\begin{itemize}
\item Sharp corners $\to$ sparsity! \Laughey[1.5][yellow][pink]
\item Round corners $\to$ only shrinkage!
\end{itemize}
\end{frame}
\begin{frame}[noframenumbering]{Contour plots}
\begin{figure}
\centering
\includegraphics[width = 0.33\textwidth]{cont_lasso.pdf}
\includegraphics[width = 0.33\textwidth]{cont_ridge.pdf}
%\includegraphics[width = 0.33\textwidth]{cont_enet.pdf}
\animategraphics[autoplay, loop, width = 0.33\textwidth]{30}{enet_ani_merged}{}{}
\end{figure}
The \textit{shape} of the penalty can give some idea of the type of shrinkage imposed on the model.
\begin{itemize}
\item Sharp corners $\to$ sparsity! \Laughey[1.5][yellow][pink]
\item Round corners $\to$ only shrinkage!
\end{itemize}
\end{frame}
\end{document}
下面是输出的屏幕截图(我找不到录制 pdf 屏幕的方法,右边的图是移动的):