4

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
    Can you please show us a simple complete document showing the relevant settings that you are using? – Gonzalo Medina Jul 7 '14 at 15:00
3

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

  • @user2160204 You're welcome! Don't fotget that if you consider that my answer solved your problem, you can mark it as accepted by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. – Gonzalo Medina Jul 19 '14 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.