5

In my thesis I have specific theorem/lemma numbering. As I do not present all theoerems and lemma's in the beamer presentation the numbering will become different. How can I manually give the theorems and lemma's in my beamer presentation the correct numbering.

\begin{document}
\theoremstyle{plain}
\newtheorem{thm}{Sætning}[section]

\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}

\theoremstyle{plain}
\newtheorem{lem}[thm]{Lemma}

\theoremstyle{definition}
\newtheorem{eks}[thm]{Eksempel}

\theoremstyle{plain}
\newtheorem{prop}[thm]{Proposition}

\theoremstyle{plain}
\newtheorem{kor}[thm]{Korollar}

\theoremstyle{definition}
\newtheorem{ov}[thm]{Øvelse}


\frame{\titlepage \vspace{-0.5cm}
}


\frame
{
\frametitle{Oversigt}
\tableofcontents%[pausesection]
}

\section{Præsentation af sætningen.}
\frame{
\frametitle{Picard's sætning}
\begin{thm}
Lad $G$ være åben i $\mathbb{C}$. En funktion $h:G\to \mathbb{R}$ kaldes 
harmonisk hvis $h\in C^2(G)$ og $\Delta h=0$ i $G.$ 
\end{thm}
}
\end{document}
6
  • 1
    Welcome! You can always play with \setcounter. If you want more details, consider providing an MWE.
    – user121799
    Jan 16, 2018 at 17:32
  • 1
    Can you provide an example of your beamer code where you write up your theorems and presentation?
    – Werner
    Jan 16, 2018 at 17:34
  • I really want to give you examples, but I'm not quite sure what to link and how to link it?
    – seht111
    Jan 16, 2018 at 17:39
  • @seht111 see this link minimal working example (MWE) on how to create a short example. Jan 16, 2018 at 17:48
  • 1
    You forgot to add the preamble, i.e. \documentclass, and all the packages you're using. Anyway, putting \setcounter{thm}{7} just before a theorem should give the theorem the number 8=7+1.
    – user121799
    Jan 16, 2018 at 17:53

2 Answers 2

5

Assuming your theorem are somehow labelled in your thesis, e.g.

\documentclass{book}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}\label{th:first}
theo1
\end{theorem}

\begin{theorem}\label{thm:second}
theo2
\end{theorem}

\ref{thm:second}

\end{document}

then you can use the xr-hyper package to get these numbers into your presentation:

\RequirePackage{xr-hyper}
\documentclass{beamer}
\usepackage[utf8]{inputenc}    

\theoremstyle{plain}
\newtheorem{thm}{Sætning}[section]

\externaldocument{nameofyourthesisfile}

\begin{document}

\section{Præsentation af sætningen.}
\begin{frame}
\frametitle{Picard's sætning}

\begin{thm}[\ref{thm:second}]
Lad $G$ være åben i $\mathbb{C}$. En funktion $h:G\to \mathbb{R}$ kaldes 
harmonisk hvis $h\in C^2(G)$ og $\Delta h=0$ i $G.$ 
\end{thm}

\end{frame}
\end{document}

enter image description here

3
  • @ChristianHupfer Only one package missing is an improvement to all packages missing in the OP :) Jan 16, 2018 at 18:44
  • @ChristianHupfer And of course thanks for spotting this problem! Jan 16, 2018 at 18:57
  • Huh? I spotted nothing ;-)
    – user31729
    Jan 16, 2018 at 19:07
5

You can define a new environment that takes as argument the theorem type and, optionally, a number.

Note that it's best to define the environments before \begin{document} and that the syntax \frame{...} is deprecated.

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{xparse}

\usetheme{Warsaw}

\newcommand{\thisthmnumber}{}

\theoremstyle{plain}
\newtheorem{thm}{Sætning\thisthmnumber}
\newtheorem{lem}{Lemma\thisthmnumber}
\newtheorem{prop}{Proposition\thisthmnumber}
\newtheorem{kor}{Korollar\thisthmnumber}

\theoremstyle{definition}
\newtheorem{defn}{Definition\thisthmnumber}
\newtheorem{eks}{Eksempel\thisthmnumber}
\newtheorem{ov}{Øvelse\thisthmnumber}

\NewDocumentEnvironment{statement}{mo}
 {%
  \IfValueT{#2}{\renewcommand{\thisthmnumber}{ #2}}\begin{#1}%
 }
 {\end{#1}}

\begin{document}

\begin{frame}
\titlepage \vspace{-0.5cm}
\end{frame}


\begin{frame}
\frametitle{Oversigt}
\tableofcontents%[pausesection]
\end{frame}

\section{Præsentation af sætningen.}

\begin{frame}
\frametitle{Picard's sætning}

\begin{statement}{lem}
Easy lemma
\end{statement}

\begin{statement}{thm}[1]
Lad $G$ være åben i $\mathbb{C}$. En funktion $h\colon G\to \mathbb{R}$ kaldes 
harmonisk hvis $h\in C^2(G)$ og $\Delta h=0$ i $G$. 
\end{statement}

\end{frame}

\end{document}

enter image description here

A slightly different idea if you want to recycle your statements with minimum manual intervention: the manually assigned number is added in parentheses. This way also the theorem attribution can be stated.

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{xparse}

\usetheme{Warsaw}

% tweak \newtheorem
\let\originalnewtheorem\newtheorem
\RenewDocumentCommand{\newtheorem}{ommo}{%
  \originalnewtheorem{#2inner}{#3\thisthmnumber}
  \NewDocumentEnvironment{#2}{od()}
   {%
    \IfValueT{##2}{\renewcommand{\thisthmnumber}{ ##2}}%
    \IfValueTF{##1}{\begin{#2inner}[##1]}{\begin{#2inner}}%
   }
   {\end{#2inner}}
}
\newcommand{\thisthmnumber}{}

\theoremstyle{plain}
\newtheorem{thm}{Sætning}[section]
\newtheorem[thm]{lem}{Lemma}
\newtheorem[thm]{prop}{Proposition}
\newtheorem[thm]{kor}{Korollar}

\theoremstyle{definition}
\newtheorem[thm]{defn}{Definition}
\newtheorem[thm]{eks}{Eksempel}
\newtheorem[thm]{ov}{Øvelse}

\begin{document}

\begin{frame}
\titlepage \vspace{-0.5cm}
\end{frame}


\begin{frame}
\frametitle{Oversigt}
\tableofcontents%[pausesection]
\end{frame}

\section{Præsentation af sætningen.}

\begin{frame}
\frametitle{Picard's sætning}

\begin{lem}
Easy lemma
\end{lem}

\begin{thm}(1)
Lad $G$ være åben i $\mathbb{C}$. En funktion $h\colon G\to \mathbb{R}$ kaldes 
harmonisk hvis $h\in C^2(G)$ og $\Delta h=0$ i $G$. 
\end{thm}

\begin{thm}[Picard](3.1)
Lad $G$ være åben i $\mathbb{C}$. En funktion $h\colon G\to \mathbb{R}$ kaldes 
harmonisk hvis $h\in C^2(G)$ og $\Delta h=0$ i $G$. 
\end{thm}

\end{frame}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .