考虑这个例子:
\documentclass{beamer}
\usepackage{tikzducks}
\setbeamertemplate{caption}[numbered] % for numbering figures in beamer
\usepackage{subcaption}
\title{The Title}
\author{The Author}
\begin{document}
\begin{frame}{Frame 1}
\begin{figure}
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-a}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-b}
\caption{}
\end{subfigure}
\caption{}
\end{figure}
\end{frame}
\begin{frame}{Frame 2}
\begin{figure}
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-c}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-duck}
\caption{}
\end{subfigure}
\caption{}
\end{figure}
\end{frame}
\end{document}
我有兴趣在下一帧继续绘制由 4 个子图组成的图形,以便在幻灯片 2 中
图号与幻灯片 1 上的相同
子图的数量为c和d。
如何实现这一点?
答案1
方法 1:
您可以使用包\ContinuedFloat
中的命令(该命令在您的示例中caption
已被包加载)subcaption
\documentclass{beamer}
\usepackage{tikzducks}
\setbeamertemplate{caption}[numbered] % for numbering figures in beamer
\usepackage{subcaption}
\title{The Title}
\author{The Author}
\begin{document}
\begin{frame}{Frame 1}
\begin{figure}
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-a}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-b}
\caption{}
\end{subfigure}
\caption{}
\end{figure}
\end{frame}
\begin{frame}{Frame 2}
\begin{figure}
\ContinuedFloat
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-c}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-duck}
\caption{}
\end{subfigure}
\caption{}
\end{figure}
\end{frame}
\end{document}
方法 2:
您可以使用叠加层,而不必制作两个单独的框架:
\documentclass{beamer}
\usepackage{tikzducks}
\setbeamertemplate{caption}[numbered] % for numbering figures in beamer
\usepackage{subcaption}
\title{The Title}
\author{The Author}
\begin{document}
\begin{frame}{Frame 1}
\begin{figure}
\begin{onlyenv}<1>
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-a}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-b}
\caption{}
\end{subfigure}
\end{onlyenv}
\begin{onlyenv}<2>
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-c}
\caption{}
\end{subfigure}%
\begin{subfigure}{0.45\paperwidth}
\includegraphics[width=0.45\paperwidth]{example-image-duck}
\caption{}
\end{subfigure}
\end{onlyenv}
\caption{}
\end{figure}
\end{frame}
\end{document}