我有一份论文类文档,其中包含大约 200 个定义、定理和引理以及一份 Beamer 演示文稿。在我进行演示时,我的听众将参考该文档。我如何才能让 Beamer 在我的演示文稿中使用与文档相同的编号?
如果我什么都不做,beamer 会为所有定义、定理和引理分配新编号,这会让人感到困惑。而且由于项目太多,手动编号不是一种选择。
答案1
您可以使用该包直接引用论文中该定理的编号xr
。
假设你的论文如下所示:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newtheorem{theorem}{Theorem}
\begin{document}
\section{Introduction}
Theorems can easily be defined
\begin{theorem}
Let $f$ be a function whose derivative exists in every point, then $f$
is a continuous function.
\end{theorem}
\begin{theorem}
\label{mytheo}
Let $f$ be a function whose derivative exists in every point, then $f$
is a continuous function.
\end{theorem}
Refering: \ref{mytheo}
\end{document}
然后您可以在演示文稿中使用这些标签:
\documentclass{beamer}
\usepackage{xr}
\externaldocument{document2}
\setbeamertemplate{theorems}[numbered]
\usepackage{refcount}
\begin{document}
\begin{frame}
test \ref{mytheo}
\setcounterref{theorem}{mytheo}
\addtocounter{theorem}{-1}
\begin{theorem}
Let $f$ be a function whose derivative exists in every point, then $f$
is a continuous function.
\end{theorem}
\end{frame}
\end{document}