我使用的是 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}