我为不同的讲座幻灯片准备了单独的 tex 文件。我试图按讲座编号对我的定理进行编号。我使用以下内容:
\setbeamertemplate{theorems}[numbered]
但每个讲座文件都是从 1、2 开始。我想要
1.1,1.2,… 为讲座 1
2.1,2.2,…第 2 讲
等等
有没有办法做到这一点?
\documentclass[]{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{theorems}[numbered]
\newtheorem{remark}{Remark} %for remarks
\begin{document}
\section{First section}
\begin{frame}
\frametitle{Theorems}
\begin{theorem}
This is theorem 1.
\end{theorem}
\begin{theorem}
This is theorem 2.
\end{theorem}
\end{frame}
\end{document}
答案1
\lecture
对每个讲座 使用该命令(请参阅beamer
手册第10.4 将课程拆分为讲座),然后添加
\renewcommand\thetheorem{\arabic{lecture}.\arabic{theorem}}
\makeatletter
\@addtoreset{theorem}{lecture}
\makeatother
到文档的序言部分。这将为定理和其他预定义的定理类结构产生所需的结果;对于新用户定义的结构(例如示例中的注释),您将需要一组类似的命令:
\renewcommand\theremark{\arabic{lecture}.\arabic{remark}}
\makeatletter
\@addtoreset{remark}{lecture}
\makeatother
完整示例:
\documentclass[]{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{theorems}[numbered]
\newtheorem{remark}{Remark} %for remark
\renewcommand\thetheorem{\arabic{lecture}.\arabic{theorem}}
\renewcommand\theremark{\arabic{lecture}.\arabic{remark}}
\makeatletter
\@addtoreset{theorem}{lecture}
\@addtoreset{remark}{lecture}
\makeatother
\begin{document}
\lecture{Test lecture one}{lone}
\section{First section of lecture one}
\begin{frame}
\frametitle{Theorems}
\begin{theorem} This is theorem 1. \end{theorem}
\begin{theorem} This is theorem 2. \end{theorem}
\begin{corollary} This is a test corollary \end{corollary}
\begin{remark} This is a test remark \end{remark}
\end{frame}
\lecture{Test lecture two}{ltwo}
\section{First section of lecture two}
\begin{frame}
\frametitle{Theorems}
\begin{theorem} This is theorem 1. \end{theorem}
\begin{theorem} This is theorem 2. \end{theorem}
\begin{corollary} This is a test corollary \end{corollary}
\begin{remark} This is a test remark \end{remark}
\end{frame}
\end{document}
结果显示了两个讲座的编号: