
在我的投影機簡報中,我有三個圖像和一個合併的 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的方法,右圖是要移動的):