![如何从投影仪演示文稿中引用文档中的标签?](https://linux22.com/image/311888/%E5%A6%82%E4%BD%95%E4%BB%8E%E6%8A%95%E5%BD%B1%E4%BB%AA%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF%E4%B8%AD%E5%BC%95%E7%94%A8%E6%96%87%E6%A1%A3%E4%B8%AD%E7%9A%84%E6%A0%87%E7%AD%BE%EF%BC%9F.png)
我有一份论文类文档,其中包含大约 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}