2

I am using Beamer and the Warsaw theme. I am trying to format the way sections appear in the frame header.

What I would like to get in header:

I - Section I

II - Section II

I did not manage to modify the numbering to uppercase roman letters. Here is a minimal example :

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usetheme{Warsaw}

\makeatletter
\def\insertsectionheadnumber{\@Roman\c@section}
\makeatother

\setbeamertemplate{section in head/foot}%
{\hfil\insertsectionheadnumber~-~\insertsectionhead}

\setbeamertemplate{section in head/foot shaded}%
{\color{structure!50}\hfil\insertsectionheadnumber~-~\insertsectionhead}

\begin{document}

\section{Section I}
\begin{frame}
\end{frame}

\section{Subsection II}
\begin{frame}
\end{frame}

\end{document}

What I tried so far to add in my preamble:

  • \renewcommand \thesection{\Roman{section}}: not working because Beamer uses \insertsectionheadnumber to insert the section number instead of the standard counter.

  • \renewcommand \insertsectionheadnumber{\Roman{section}}: I get the error \insertsectionheadnumber undefined.

  • \makeatletter \def\insertsectionheadnumber{\@Roman\c@section} \makeatother No error produced but it appears to have no effect.

  • Using \insertsectionnumber instead of \insertsectionheadnumber. Here, the \def command is working (numbers appear as roman), but all the sections are numbered with the counter of the current one (so in my example, on slide 1 every section will be numbered I, then on slide 2 they will all be numbered II).

I tried to look into the class files and found that \insertsectionheadnumber is defined in beamerbasenavigation.sty, but I don't understand the code I found there.

How should I define the \insertsectionheadnumber command, or is there another (better) way to do this ?

1
  • Welcome to TeX.SX!
    – egreg
    Oct 19, 2016 at 16:06

1 Answer 1

3

Based on the answer https://tex.stackexchange.com/a/163490/36296 you can use \MakeUppercase{\romannumeral\insertsectionheadnumber}

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usetheme{Warsaw}

\setbeamertemplate{section in head/foot}%
{\hfil \MakeUppercase{\romannumeral\insertsectionheadnumber}~-~\insertsectionhead}

\setbeamertemplate{section in head/foot shaded}%
{\color{structure!50}\hfil \MakeUppercase{\romannumeral\insertsectionheadnumber}~-~\insertsectionhead}

\begin{document}

\section{Section I}
\begin{frame}
\end{frame}

\section{Subsection II}
\begin{frame}
\end{frame}

\end{document}

enter image description here

1
  • It's working, thanks! I had seen the \setbeamertemplate{section in toc}[sections numbered roman] and tried to apply it to section in header/footer, but I had not seen the rest of the code.
    – user116737
    Oct 19, 2016 at 16:30

You must log in to answer this question.