I try to reference correctly part
, chapter
, section
, and subsection
in a beamer presentation.
The code is:
\documentclass[envcountsect,10pt]{beamer}
\usepackage{chngcntr,xcolor,bbm,placeins,float,latexsym,amsxtra,amssymb,amsbsy,amsthm,amscd,amsfonts,amsmath,subcaption}
\usepackage{etoolbox}
\setbeamertemplate{caption}[numbered]
\counterwithin*{equation}{section}
\counterwithin*{figure}{section}
\setbeamertemplate{bibliography item}{\insertbiblabel}
\usetheme{Antibes}
\AtBeginPart{\frame{\partpage}}
\AtBeginSection{\frame{\sectionpage}}
\AtBeginSubsection{\frame{\subsectionpage}}
\setbeamertemplate{part page}
{
\begin{centering}
{\usebeamerfont{part name}\usebeamercolor[fg]{part name}\partname~\insertpartnumber}
\vskip1em\par
\begin{beamercolorbox}[sep=16pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
\end{centering}
}
\defbeamertemplate{part page}{mine}[1][]{%
\begin{centering}
{\usebeamerfont{part name}\usebeamercolor[fg]{part name}#1}
\vskip1em\par
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
\end{centering}
}
\defbeamertemplate{section page}{mine}[1][]{%
\begin{centering}
{\usebeamerfont{section name}\usebeamercolor[fg]{section name}#1}
\vskip1em\par
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
\end{centering}
}
\defbeamertemplate{subsection page}{mine}[1][]{%
\begin{centering}
{\usebeamerfont{subsection name}\usebeamercolor[fg]{subsection name}#1}
\vskip1em\par
\begin{beamercolorbox}[sep=8pt,center,#1]{part title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
\end{centering}
}
%\usecolortheme{default}
\setbeamertemplate{theorem}[ams style]
\setbeamertemplate{theorems}[numbered]
\renewcommand{\bibname}{References}
\newtheorem{remark}{\newline Remark}
\newtheorem{proposition}{\newline Proposition}
\numberwithin{section}{part}
\numberwithin{theorem}{section}
\renewcommand\thetheorem{\arabic{part}.\arabic{section}.\arabic{theorem}}
\renewcommand\thelemma{\arabic{part}.\arabic{section}.\arabic{lemma}}
\renewcommand\theproposition{\arabic{part}.\arabic{section}.\arabic{proposition}}
\renewcommand\thedefinition{\arabic{part}.\arabic{section}.\arabic{definition}}
\renewcommand\theproposition{\arabic{part}.\arabic{section}.\arabic{proposition}}
\renewcommand\theremark{\arabic{part}.\arabic{section}.\arabic{remark}}
\renewcommand\theexample{\arabic{part}.\arabic{section}.\arabic{example}}
\makeatletter
\@addtoreset{theorem}{section}
\@addtoreset{remark}{section}
\makeatother
\newenvironment{stepenumerate}{\begin{enumerate}[<+->]}{\end{enumerate}}
\newenvironment{stepitemize}{\begin{itemize}[<+->]}{\end{itemize} }
\newenvironment{stepenumeratewithalert}{\begin{enumerate}[<+-| alert@+>]}{\end{enumerate}}
\newenvironment{stepitemizewithalert}{\begin{itemize}[<+-| alert@+>]}{\end{itemize} }
\renewcommand{\theequation}{\arabic{part}.\arabic{section}.\arabic{equation}}
\renewcommand{\thefigure}{\arabic{part}.\arabic{section}.\arabic{figure}}
\def\stackunder#1#2{\mathrel{\mathop{#2}\limits_{#1}}}
\undef{\lemma}
\undef{\example}
\newtheorem{lemma}{\translate{Lemma}}
\theoremstyle{example}
\newtheorem{example}{\translate{Example}}[section]
\begin{document}
\setbeamertemplate{part page}[mine][Part 1]
\part{\bf A beautiful mind}
\begin{frame}[label=Part1]
This is the content of Part \ref{Part1} and should be printed as \textbf{'Part 1'}.
\end{frame}
\setbeamertemplate{part page}[mine][]
\part{Introduction}
\begin{frame}
This is the Introduction and has no reference.
\end{frame}
\setbeamertemplate{part page}[mine][Chapter 1]
\part{THE FIRST CHAPTER IN THE PRESENTATION}\label{Chapter1}
\begin{frame}
This is Chapter \ref{Chapter1} and should be printed as \textbf{'Chapter 1'}.
\end{frame}
\setbeamertemplate{section page}[mine][]
\section{1.1 The first section in Chapter 1}\label{Section1.1}
\begin{frame}
This is Section \ref{Section1.1} and should be printed as \textbf{'Section 1.1'}.
\end{frame}
\setbeamertemplate{section page}[]
\section{1.2 The second section in Chapter 1}\label{Section1.2}
\begin{frame}
This is Section \ref{Section1.2} and should be printed as \textbf{'Section 1.2'}.
\end{frame}
\setbeamertemplate{part page}[mine][Chapter 2]
\part{THE SECOND CHAPTER IN THE PRESENTATION}\label{Chapter2}
\setcounter{part}{2}
\begin{frame}
This is Chapter \ref{Chapter2} and should be printed as \textbf{'Chapter 2'}.
\end{frame}
\section{2.1 The first section in Chapter 2}\label{Section2.1}
\begin{frame}
This is Section \ref{Section2.1} and should be printed as \textbf{'Section 2.1'}.
\end{frame}
\subsection{The first subsection in Section 2.1}\label{Subsection2.1.1}
\begin{frame}
This is Subsection \ref{Subsection2.1.1} and should be printed as \textbf{'Subsection 2.1.1'}.
\end{frame}
\subsection{The second subsection in Section 2.1}\label{Subsection2.1.2}
\begin{frame}
This is Subsection \ref{Subsection2.1.2} and should be printed as \textbf{'Subsection 2.1.2'}.
\end{frame}
\section{2.2 The second section in Chapter 2}\label{Section2.2}
\begin{frame}
This is Section \ref{Section2.2} and should be printed as \textbf{'Section 2.2'}.
\end{frame}
\setbeamertemplate{part page}[mine][Part 2]
\part{\bf Life Is Beautiful}\label{Part2}
\begin{frame}
This is Part \ref{Part2} and should be referenced as \textbf{'Part 2'}.
\end{frame}
\setbeamertemplate{part page}[mine][Part 3]
\part{\bf Pulp Fiction}\label{Part3}
\begin{frame}
This is Part \ref{Part3} and should be referenced as \textbf{'Part 3'}.
\end{frame}
\setbeamertemplate{part page}[mine][Part 4]
\part{\bf Forrest Gump}\label{Part4}
\begin{frame}
This is Part \ref{Part4} and should be referenced as \textbf{'Part 4'}.
\end{frame}
\end{document}
The problem is that they not printed properly, e.g., Part 1 is printed as Part 2, Chapter 1 as Chapter 3, Section 1.1 as Section 3.1, Section 1.2 as Section 3.2, Chapter 2 as Chapter 4, Subsection 2.1.1 as Subsection 1, Subsection 2.1.2 as Subsection 2, Part 2 as Part 3, Part 3 as Part 4, Part 4 as Part 5. Only Sections 2.1 and 2.2 are referenced correctly (see the printscreens attached).
Any help would be much appreciated.