我正在根据另一个 tex 文件(报告)的内容创建一个 Beamer 演示文稿。为了避免复制粘贴并允许自动更新内容,我想简单地从原始文件中调用我想要的特定定理,并在 Beamer 演示文稿中我需要的地方重新声明它。由于我想在每个定理之间添加一些额外的解释和示例,因此我需要能够将它们一一导入。此外,我需要两个文档中的定理编号相同,因为演示文稿仅涵盖报告的一部分,例如仅一章。
以下是我发现但不满足我所有要求的类似问题的一些解决方案(我将它们包括在内,以防它们有助于找到解决方案或更好地理解我的问题):
- 该解决方案的问题在于,我认为它仅适用于同一 pdf/文档中包含的定理:https ://tex.stackexchange.com/questions/51286/recalling-a-theorem
- 下一个的问题是它不允许我一个一个地导入定理。我也不想使用盒子或隐形盒子。此外,在我的情况下,不可能在每个定理的末尾添加附加内容,并且只有在我重述它们时才使其可见(因为由于目标文件是演示文稿,这可能会出现问题): https ://tex.stackexchange.com/questions/333596/restate-theorem-in-separate-file
以下文件是原始报告的文件:
- 带有定理 ( theorems.tex ) 的文件:
\chapter{Chapter title}
\section{Section 1}
\begin{thm}\label{thm-1}
Theorem 1 of section 1
\end{thm}
\begin{thm}\label{thm-2}
Theorem 2 of section 1
\end{thm}
\section{Section 2}
\begin{thm}\label{thm-3}
Theorem 1 of section 2
\end{thm}
\begin{thm}\label{thm-4}
Theorem 2 of section 2
\end{thm}
- 报告主要文件:
\documentclass{report}
\newtheorem{thm}{Theorem}[section]
\begin{document}
\input{theorems}
\end{document}
我现在正在做的创建我的演示文稿如下:
\documentclass{beamer}
\newtheorem{thm}{Theorem}[section]
\setbeamertemplate{theorems}[numbered]
\begin{document}
\section{Section 1}
\begin{frame}
\begin{thm}
Theorem 1 of section 1
\end{thm}
Additional content
\begin{thm}
Theorem 2 of section 1
\end{thm}
Additional content
\end{frame}
\section{Section 2}
\begin{frame}
\begin{thm}
Theorem 1 of section 2
\end{thm}
\begin{thm}
Theorem 2 of section 2
\end{thm}
Additional content
\end{frame}
\end{document}
如您所见,使用我当前的解决方案,我缺少章节编号参考。我想要的是找到或定义一个类似的命令,\fullref{tex-file}{thm-label}
这样我就可以获得相同的结果,但代码类似于:
\documentclass{beamer}
%\newtheorem{thm}{Theorem}[section]
%\setbeamertemplate{theorems}[numbered]
\begin{document}
\section{Section 1}
\begin{frame}
\fullref{theorems.tex}{thm-1}
Additional content
\fullref{theorems.tex}{thm-2}
Additional content
\end{frame}
\section{Section 2}
\begin{frame}
\fullref{theorems.tex}{thm-3}
\fullref{theorems.tex}{thm-4}
Additional content
\end{frame}
\end{document}