1

I am trying to replace "Section 1" and "Subsection 1" with their corresponding numbers just before the section's and subsection's name. That is: "1 This is the first section" & "1.1 This is the first subsection". Basically, I want to use the same numbering procedure as in a normal LaTeX document, but I have no idea how to achieve this.

\documentclass[xcolor=dvipsnames]{beamer}

\usetheme{Frankfurt}     
\usecolortheme{crane} 
\usefonttheme{default}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]

\title{Some title}
\author{Someone}
\date{today}

\begin{document}

\maketitle

\begin{frame}
  \section{This is the first section}
  \sectionpage
  \subsection{This is the first subsection}
  \subsectionpage
\end{frame}

\end{document}

enter image description here

2
  • Welcome to TEX.SE! There are literally dozens of beamer styles so there is no way to help you without knowing your setup. Please provide a full minimal working example starting with \documentclass{...} and ending with \end{document}.
    – campa
    Apr 15, 2021 at 13:15
  • @campa thanks, I updated it!
    – Dumbo
    Apr 15, 2021 at 13:19

1 Answer 1

1

(please note that sectioning commands like \section, \subsection etc. should always be outside of frame environments)

You can redefine the templates for the section and subsection pages like this:

\documentclass[xcolor=dvipsnames]{beamer}

\usetheme{Frankfurt}     
\usecolortheme{crane} 
\usefonttheme{default}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]

\title{Some title}
\author{Someone}
\date{today}

\makeatletter
\setbeamertemplate{section page}
{
  \begingroup
    \centering
%    {\usebeamerfont{section name}\usebeamercolor[fg]{section name}\sectionname~\insertsectionnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=12pt,center,colsep=-4bp,rounded=true,shadow=true]{section title}
      \usebeamerfont{section title}\insertsectionnumber~\insertsection\par
    \end{beamercolorbox}
  \endgroup
}
\setbeamertemplate{subsection page}
{
  \begingroup
    \centering
%    {\usebeamerfont{subsection name}\usebeamercolor[fg]{subsection name}\subsectionname~\insertsubsectionnumber}
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,colsep=-4bp,rounded=true,shadow=true]{subsection title}
      \usebeamerfont{subsection title}\insertsubsectionnumber~\insertsubsection\par
    \end{beamercolorbox}
  \endgroup
}
\makeatother

\begin{document}

\maketitle

  \section{This is the first section}
    \subsection{This is the first subsection}

\begin{frame}
  \sectionpage
  \subsectionpage
\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 .