0

I've started to write my own beamer theme. Now, I would like to style the section page and the subsection page with a coloured background, while the rest of the pages have a white background. Headline and footline on "normal slides" have grey text. To make the design more readable, I would like them to have white text on the coloured background of the (sub)section pages. But somehow I cannot figure out how to change the headline and footline style specifically for the (sub)section pages.

I have tried to setup a boolean with \newif\ifbeamer@logogrey, which I then change to false within the section page-template and which I check for in headline and footline templates. But even though on the section page it is false, the header and footer are compiled as if it is true. Therefore, it seems to me like the head- and footline is compiled before the section page template, which is why the boolean is ignored.

Is there a way to prompt the recompile of the headline and footline template? Or do I have to change the location of changing the boolean value? Or is there a completely different approach to have specific styles for headline and footline in the (sub)section pages?

EDIT

Based on samcarter_is_at_topanswers.xyz answer I now use the conditional-variable I introduced and change it within \def\ps@navigation@sectionpage{. This allows me to adapt the colour and logo locally within the templates for headline and footline. An updated MWE:

beamercolorthemeUM.sty

\mode<presentation>
\setbeamercolor{frame head} {fg=black!65}
\setbeamercolor{footline}   {fg=black!65}
\setbeamercolor{bright}     {fg=white}

\mode
<all>

beamerthemeUM.sty

\RequirePackage{tikz}
\RequirePackage[absolute, overlay]{textpos} %somehow in my real template it works fine without overlay

\mode<presentation>

\usecolortheme{UM}

%Remove Navigation Symbols
\setbeamertemplate{navigation symbols}{}

%Condition if logo is white or graphite
\newif\ifbeamer@logogrey
\beamer@logogreytrue %default is graphite

\setbeamertemplate{headline}{
%If first page = title slide: leave empty
\ifnum \theframenumber=1
%for all other pages
\else
%see if content should be grey or white (for coloured frames)
{
    %###################################
    %on normal slides grey logo and text
    \ifbeamer@logogrey
        \def\col{frame head}
        \def\imgpath{assets/Logo.pdf}
    \else
    %on colored slides white
        \def\col{bright}
        \def\imgpath{assets/Logo-Negativ.pdf}
    \fi
    %###################################
    
    \begin{beamercolorbox}[wd=\beamer@paperwidth, ht=1.3cm]{\col}%
        %Uni Logo in upper left corner
        \includegraphics[height=.6cm,keepaspectratio]{\imgpath}
        \hfill
        %shorttitle of presentation in upper right corner
        \makebox[8cm][r]{\usebeamerfont{frame head} \insertshorttitle}
    \end{beamercolorbox}
    
}
\fi
}

\setbeamertemplate{footline}
{
%If first page = title slide: leave empty
\ifnum \theframenumber=1
%for all other pages
\else
{
    %################################################
    %on white (normal) slides: coloured line and text
    \ifbeamer@logogrey
        \def\col{footline}
        \def\colline{col1!30}
    \else
    %on coloured slides: white
        \def\col{bright}
        \def\colline{white!30}
    \fi
    %################################################
    
    \begin{beamercolorbox}[wd=\beamer@paperwidth, ht=1.3cm]{\col}
        %Line
        \textcolor{\colline}{\hrule}
        %Author in the left corner
        \makebox[8cm][l]{\usebeamerfont{footline} \insertauthor}
        \hfill
        %slide number in right corner
        \makebox[2cm][r]{\usebeamerfont{page number in head/foot} \insertframenumber}%
    \end{beamercolorbox}
}
\fi
}

%Section page
%hacking to trigger the right footline
%#####################################
\def\ps@navigation@sectionpage{%
    \beamer@logogreyfalse
    \@nameuse{ps@navigation}
}
%#####################################

\setbeamertemplate{section page}{

    %#####################################
    \thispagestyle{navigation@sectionpage}
    %#####################################
    
    %Bakground
    \begin{textblock*}{\beamer@paperwidth}(0cm,0cm)
        \begin{tikzpicture}
            \fill[col1] (0,0) rectangle (\beamer@paperwidth, \beamer@paperheight);
        \end{tikzpicture}
    \end{textblock*}
    
    \begin{beamercolorbox}{bright}%
        \huge\textbf{\insertsection}
    \end{beamercolorbox}
    
}

%Subsection page
%hacking to trigger the right footline
\def\ps@navigation@subsectionpage{%
    \beamer@logogreyfalse
    \@nameuse{ps@navigation}
}

\setbeamertemplate{subsection page}{
    
    \thispagestyle{navigation@subsectionpage}
    %Bakground
    \begin{textblock*}{\beamer@paperwidth}(0cm,0cm)
        \begin{tikzpicture}
            \fill[col2] (0,0) rectangle (\beamer@paperwidth, \beamer@paperheight);
        \end{tikzpicture}
    \end{textblock*}
    
    \begin{beamercolorbox}{bright}%
        \huge\textbf{\insertsection}
    \end{beamercolorbox}
    
}

\mode
<all>

presi.tex

\documentclass[aspectratio=169]{beamer}

\usetheme{UM}

\author{My Name}
\title[Exp. Presi]{Exemplary Presentation}
\date{2nd Jan 2024}
\institute{Conference Name for Title Slide}

%------------------------------------------------

\begin{document}
    
    \begin{frame}
        \titlepage
    \end{frame}
    
    \section{Fruits}
    \begin{frame}
        \sectionpage
    \end{frame}
    
    \subsection{Citrus}
    \begin{frame}
        \frametitle{\insertsection}
        \framesubtitle{\insertsubsection}
        
        \begin{itemize}
            \item Lemon
            \item Orange
        \end{itemize}
    \end{frame}
    
    \subsection{Apples}

    \begin{frame}
        \subsectionpage
    \end{frame}

    \begin{frame}
        \frametitle{\insertsection}
        \framesubtitle{\insertsubsection}
        
        \begin{itemize}
            \item Boskop
            \item Gala
        \end{itemize}
    \end{frame}

\end{document}
5
  • Welcome! I'm guessing you probably want to define distinct styles for the headline and footline templates and then use them in the relevant places in setting up the section/subsection code.
    – cfr
    Feb 14 at 19:32
  • Actually, you aren't changing the style, right? Only the colour(s)? So you don't need different templates but only a template which uses the appropriate colour.
    – cfr
    Feb 14 at 19:50
  • @neydiju See e.g. topanswers.xyz/tex?q=1004#a1198 for an example how to define different footlines for certain frames. The same technique will also work for headlines. Feb 14 at 21:39
  • @cfr thank you for the comment! Yes, both remarks apply. The relevant difference of the section page will only be the colours of background and head-/footlne. I tried to setup a template that uses the appropriate colours with checking the beamerif. But I cannot make it work. Any ideas how else to approach this? Distinct styles would also be interesting, I did not get my head around yet, how/where to apply them.
    – neydiju
    Feb 15 at 7:38
  • @samcarter_is_at_topanswers.xyz thank you for the link! That indeed looks very much like what I try to do. However I don't understand how to use it within the theme file. I added a \defbeamertemplate{footline}{white footline} additionally to \setbeamertemplate{footline} for the normal footline. I then called \setbeamertemplate{footline}[white footline] inside of the section page template, but without any effect. Still, the normal footline is used.
    – neydiju
    Feb 15 at 8:00

1 Answer 1

0

You could use the same approach as in https://topanswers.xyz/tex?q=1004#a1198

An example to swap out the whole footline:

\documentclass{beamer}


\defbeamertemplate{footline}{white footline}{white footline} 
\setbeamertemplate{footline}{normal footline} 

\makeatletter
\def\ps@navigation@sectionpage{%
  \setbeamertemplate{footline}[white footline]
  \@nameuse{ps@navigation}
}
\addtobeamertemplate{section page}{\thispagestyle{navigation@sectionpage}}{}
\makeatother

\AtBeginSection{
  \begin{frame}
    \usebeamertemplate{section page}
  \end{frame} 
}

\begin{document}

\section{title}
\begin{frame}
  abc
\end{frame}

\end{document}

Just replace a colour:

\documentclass{beamer}

\makeatletter
\setbeamertemplate{footline}{\usebeamercolor[fg]{test}footline} 
\setbeamercolor{test}{fg=red}

\def\ps@navigation@sectionpage{%
  \setbeamercolor{test}{fg=green}
  \@nameuse{ps@navigation}
}
\addtobeamertemplate{section page}{\thispagestyle{navigation@sectionpage}}{}
\makeatother

\begin{document}

\section{title}
\begin{frame}
  \usebeamertemplate{section page}
\end{frame} 

\begin{frame}
  abc
\end{frame}

\end{document}
7
  • Thank you again for the suggestion! However, I want to avoid \AtBeginSection{, so that it is an option to use the separator if needed. Also, I want to do the styling within the theme-file. Could you tell me how to apply it in there? As mentioned in the comment above, I could not figure out, how to call the special footer within the theme file.
    – neydiju
    Feb 15 at 15:39
  • @neydiju My answer has been edited :) Feb 15 at 15:39
  • Thank you! That works nicely! Is there any way, though, to avoid having to setup the footer twice? As cfr pointed out, I really only want to change the font colour....
    – neydiju
    Feb 15 at 15:53
  • @neydiju Instead of changing the footline template, you can as well just change the colour Feb 15 at 15:56
  • Thank you for your really fast replies! That's clever! But changing only the beamercolor is not enough, as a different logofile has to be included... But it is already working very well with your suggestion from before! The hope to reduce duplicate code is rather aesthetic :D
    – neydiju
    Feb 15 at 16:09

You must log in to answer this question.

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