1

I have been working on a slide presentation with beamer. Thanks to this question I have the following code which generates slides that have a header with the section and the subsection as

\documentclass[10pt]{beamer}
\graphicspath{{./Figures/}}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamercolor{progress bar}{fg=orange,bg=green}

\makeatletter
\setbeamertemplate{headline}
{% 
  {\usebeamerfont{section in head/foot}
  \begin{beamercolorbox}[ht=3.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
    \usebeamercolor[fg]{section in head/foot}%
    \insertsectionhead
  \end{beamercolorbox}}%
  \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
  \end{beamercolorbox}
  {\usebeamerfont{subsection in head/foot}
  \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
    leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
    \insertsubsectionhead
  \end{beamercolorbox}}%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}
\makeatother

\setbeamercolor{section in head/foot}{fg=normal text.bg, bg=structure.fg}

\setbeamerfont{section in head/foot}{size=\small}
\setbeamerfont{subsection in head/foot}{size=\small}

\begin{document}


\section{Introduction}
\subsection{Subsection}

\begin{frame}{Introduction}

    \begin{center}
    I have text here
    \end{center}

\end{frame}


\end{document}

Now, I was wondering if there exists a way to include subsubsections but in only a single slide e.g., add another line to the header for a single slide and then manually introduce the name of the sububsection, something like

question

While the others slides just have Section and Subsection at the beggining.

1 Answer 1

1

With an up-to-date beamer version (v3.70 or newer), you could temporarily add another box to the headline like this:

\documentclass[10pt]{beamer}
\graphicspath{{./Figures/}}
\usetheme[progressbar=frametitle]{moloch}% modern fork of the metropolis theme
\setbeamercolor{progress bar}{fg=orange,bg=green}

\makeatletter
\setbeamertemplate{headline}
{% 
  {\usebeamerfont{section in head/foot}
  \begin{beamercolorbox}[ht=3.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
    \usebeamercolor[fg]{section in head/foot}%
    \insertsectionhead
  \end{beamercolorbox}}%
  \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
  \end{beamercolorbox}
  {\usebeamerfont{subsection in head/foot}
  \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
    leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
    \insertsubsectionhead
  \end{beamercolorbox}}%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}
\makeatother

\setbeamercolor{section in head/foot}{fg=normal text.bg, bg=structure.fg}
\setbeamercolor{subsubsection in head/foot}{fg=normal text.bg, bg=structure.fg}

\setbeamerfont{section in head/foot}{size=\small}
\setbeamerfont{subsection in head/foot}{size=\small}
\setbeamerfont{subsubsection in head/foot}{size=\small}

\begin{document}


\section{Introduction}
\subsection{Subsection}
\subsubsection{Subsubsection}

\begingroup
\addtobeamertemplate{headline}{}{
  {\usebeamerfont{subsubsection in head/foot}
  \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
    leftskip=.3cm,rightskip=.3cm plus1fil]{subsubsection in head/foot}
    \insertsubsubsectionhead
  \end{beamercolorbox}}%
}
\begin{frame}{Introduction}

    \begin{center}
    I have text here
    \end{center}

\end{frame}
\endgroup

\begin{frame}
content...
\end{frame}

\end{document}

enter image description here

9
  • Hi. Thanks for the answer. However, I have copied it literally, but I am not getting the subsubsection in the first slide. Do you have any idea why? Commented May 25, 2023 at 10:49
  • @slow_learner Is your beamer version up to date? Commented May 25, 2023 at 10:51
  • @slow_learner With "first slide" do you mean the frame with I have text here or do your mean the section page for the introduction? Commented May 25, 2023 at 10:53
  • Thanks again. I have edited the question so you can see what I am getting. I think that my beamer is up to date, since it doesnt give me any issue anywhere else. I will try however to update the package Commented May 25, 2023 at 11:00
  • @slow_learner Check your .log file. You need beamer v3.70 for this to work. Commented May 25, 2023 at 11:00

You must log in to answer this question.

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