![如何保持不同幻灯片中的词干编号相同?](https://linux22.com/image/397614/%E5%A6%82%E4%BD%95%E4%BF%9D%E6%8C%81%E4%B8%8D%E5%90%8C%E5%B9%BB%E7%81%AF%E7%89%87%E4%B8%AD%E7%9A%84%E8%AF%8D%E5%B9%B2%E7%BC%96%E5%8F%B7%E7%9B%B8%E5%90%8C%EF%BC%9F.png)
我使用的是 beamer 表示法。我想让引理的编号在不同的幻灯片中保持不变。我不想在不同的幻灯片中对同一个引理重新编号
\documentclass{beamer}
%\usetheme{Boadilla}
\usetheme{Madrid}
\usepackage{bibentry}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\setbeamertemplate{theorems}[numbered]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
% Removes icon in bibliography
\setbeamertemplate{bibliography item}{}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\frame{\frametitle{Outline}
\begin{lemma}
If $d$ is a $a$ then it is
\end{lemma}
}
\frame{\frametitle{}
\begin{lemma}
If $d$ is a $a$ then it is
\end{lemma}
\begin{proof}
wfmkrf
\end{proof}
}
\end{document}
看到相同的引理得到不同的数字
问题 :如何保持不同幻灯片中的引理编号相同?
答案1
欢迎使用 TeX-SE!恕我直言,没有必要使用两张幻灯片,\pause
就足够了,如果您真的只想在第一帧上显示标题,请使用\frametitle<1>{Outline}
。
\documentclass{beamer}
\usetheme{Madrid}
\setbeamertemplate{theorems}[numbered]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle<1>{Outline}
\begin{lemma}
If $d$ is a $a$ then it is
\end{lemma}
\pause
\begin{proof}
wfmkrf
\end{proof}
\end{frame}
\end{document}
如果你真的想要记住旧值,给你。
\documentclass{beamer}
%\usetheme{Boadilla}
\usetheme{Madrid}
\usepackage{bibentry}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\setbeamertemplate{theorems}[numbered]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
% Removes icon in bibliography
\setbeamertemplate{bibliography item}{}
\newcounter{oldlemma}
\newcounter{storethm}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Outline}
\begin{lemma}\label{lemma1}
If $d$ is a $a$ then it is
\end{lemma}
\setcounter{oldlemma}{\number\value{theorem}}
\end{frame}
\begin{frame}
\frametitle{Another lemma}
\begin{lemma}
If $c$ is a $b$ then it is
\end{lemma}
\end{frame}
\begin{frame}
\frametitle{}
\setcounter{storethm}{\number\value{theorem}}
\setcounter{theorem}{\numexpr\number\value{oldlemma}-1}
\begin{lemma}{\number\value{oldlemma}}
If $d$ is a $a$ then it is
\end{lemma}
\begin{proof}
wfmkrf
\end{proof}
\setcounter{theorem}{\number\value{storethm}}
\end{frame}
\begin{frame}
\frametitle{Yet another lemma}
\begin{lemma}
If $f$ is a $g$ then it is
\end{lemma}
\end{frame}
\end{document}
答案2
答案3
每次开始新框架时都会重置引理编号。
顺便说一句,找到词干和框架的反名并不容易。
\documentclass{beamer}
%\usetheme{Boadilla}
\usetheme{Madrid}
\usepackage{bibentry}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\setbeamertemplate{theorems}[numbered]
%\usepackage[utf8]{inputenc}% not with my editor
%\usepackage[T1]{fontenc}% I would rather not use XeLaTeX
\usepackage[backend=biber]{biblatex}
% Removes icon in bibliography
\setbeamertemplate{bibliography item}{}
\counterwithin*{theorem}{framenumber}% added command
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\frame{\frametitle{Outline}
\begin{lemma}
If $d$ is a $a$ then it is
\end{lemma}
}
\frame{\frametitle{}
\setcounter{theorem}{0}
\begin{lemma}
If $d$ is a $a$ then it is
\end{lemma}
\begin{proof}
wfmkrf
\end{proof}
}
\end{document}