我希望beamer
演示文稿中的幻灯片有自己的framesubtile
幻灯片。为此,@samcarter_is_at_topanswers.xyz 帮助我这个答案。它满足了我的基本要求,但现在我发现,在我的演示文稿中的图表(根据观众的要求进行编号)在“幻灯片中\only<+>{\framesubtitle{...} <slide content>}
不会增加标题编号,并且在演示文稿的任何地方引用这些图表都不起作用。
证明我的问题的MWE是:
\documentclass{beamer}
\setbeamertemplate{caption}[numbered]
\makeatletter
\newcommand*{\slideinframe}{\number\beamer@slideinframe}
\newcounter{bar}
\newcommand{\foo}{%
\setcounter{bar}{\insertframeendpage}%
\addtocounter{bar}{-\insertframestartpage}%
\addtocounter{bar}{1}%
(\slideinframe/\thebar)%
}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{frame}
\frametitle{Foo \foo}
\only<+>{
\framesubtitle{Bar}
\lipsum[1][1-3], see figure \ref{fig:ena}
\begin{figure}%\centering
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{Figure ena}
\label{fig:ena}
\end{figure}
}
\only<+>{
\framesubtitle{Baz}
\lipsum[1][4-7], see figure \ref{fig:dva}
\begin{figure}%\centering
\includegraphics[width=0.5\linewidth]{example-image-b}
\caption{Figure dva}
\label{fig:dva}
\end{figure}
}
\end{frame}
\end{document}
经过三次编译后的结果是:
答案1
您可以figure
像这样排除计数器的重置:
\documentclass{beamer}
\setbeamertemplate{caption}[numbered]
% Remove the figure counter from the list of counters that are reset after each overlay.
% modified from https://tex.stackexchange.com/a/15089/36296
\makeatletter
\def\donotresetfigures{{%
\let\@@elt\relax
\def\@elt##1{%
\expandafter\ifx\csname ##1\endcsname\c@figure%
\else%
\@@elt {##1}%
\fi%
}%
\edef\beamer@overlaycounterresets{\beamer@overlaycounterresets}%
\let\@elt\relax%
\def\@@elt{\@elt}%
\xdef\beamer@overlaycounterresets{\beamer@overlaycounterresets}%
}}
\donotresetfigures
\makeatother
\begin{document}
\begin{frame}
\only<+>{
see figure \ref{fig:ena}
\begin{figure}
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{Figure ena}
\label<.>{fig:ena}
\end{figure}
}
\only<+>{
see figure \ref{fig:dva}
\begin{figure}
\includegraphics[width=0.5\linewidth]{example-image-b}
\caption{Figure dva}
\label<.>{fig:dva}
\end{figure}
}
\end{frame}
\end{document}