9

I have separate tex files for my different lecture slides. I am trying to number my theorems by the lecture number. I am using the following:

\setbeamertemplate{theorems}[numbered]

But it starts from 1,2,.. in each lecture file. I want

1.1,1.2,... for lecture 1

2.1,2.2,... for lecture 2

and so on

Is there a way to do this?

\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}

Picture of the current output

1 Answers1

8

Use the \lecture command for each one of your lectures (refer to the beamer manual, Section 10.4 Splitting a Course Into Lectures), and then add

\renewcommand\thetheorem{\arabic{lecture}.\arabic{theorem}}
\makeatletter
\@addtoreset{theorem}{lecture}
\makeatother

to the preamble of your document. This will produce the desired result for theorems and the other predefined theorem-like structures; for newly user-defined structures (such as remark in your example), you'll need a similar set of commands:

\renewcommand\theremark{\arabic{lecture}.\arabic{remark}}
\makeatletter
\@addtoreset{remark}{lecture}
\makeatother

A complete example:

\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}

The result, showing the numbering for the two lectures:

enter image description here

Gonzalo Medina
  • 505,128