2

I'm trying to adapt an unofficial Beamer template for my university (GitHub, Overleaf). Right now, when I try to compile this MWE:

\documentclass{beamer}

\usetheme[bgphoto]{polimi}

\title[MS thesis]{Thesis title}
\subtitle{Master Thesis in Computer Science and Engineering}
\author[Alessandro Bertulli]{Alessandro Bertulli, matr. xxxxxx}
\date[05/10/2023]{5th October 2023}

\begin{document}
\begin{frame}
  \maketitle
\end{frame}

\section{Introduction}
\begin{frame}[plain]{}
    \sectionpage
\end{frame}

\end{document}

I get this as the sectionpage:

enter image description here

I want to get rid of the header, which IIUC should be the effect of using plain as option. Apparently, this only works if it's not the first slide after the title, as shows the secon MWE:

\documentclass{beamer}

\usetheme[bgphoto]{polimi}

\title[MS thesis]{Thesis title}
\subtitle{Master Thesis in Computer Science and Engineering}
\author[Alessandro Bertulli]{Alessandro Bertulli, matr. xxxxxx}
\date[05/10/2023]{5th October 2023}

\begin{document}
\begin{frame}
  \maketitle
\end{frame}

\begin{frame}

\end{frame}

\section{Introduction}
\begin{frame}[plain]{}
    \sectionpage
\end{frame}

\end{document}

which gives enter image description here

What can be the reason? Thanks!


For completeness, I post here the style files:

beamerthemepolimi.sty:

% Pasquale Africa <[email protected]>
% Beamer port of the official PoliMi presentation theme.

\mode<all>

\newif\if@bgphoto
\@bgphotofalse
\DeclareOption{bgphoto}{\@bgphototrue}

\newif\if@nologo
\@nologofalse
\DeclareOption{nologo}{\@nologotrue}
\ProcessOptions

\RequirePackage{tikz}
\usetikzlibrary{calc}
\graphicspath{{beamerthemepolimi_img/}}

\RequirePackage{etoolbox} % \patchcmd

\useinnertheme{polimi}
\useoutertheme{polimi}
\usecolortheme{polimi}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{itemize items}[square]
\setbeamertemplate{itemize subitem}[triangle]

% Set margins.
\setbeamersize{text margin left=\xshift, text margin right=\xshift}
\setlength{\leftmargini}{\xshift}

\let\oldtoc\tableofcontents
\renewcommand{\tableofcontents}[1][]{%
    \hspace*{0.5\xshift}
    \begin{minipage}{\textwidth}
        \oldtoc[#1]
    \end{minipage}
}

beamerouterthemepolimi.sty

\mode<presentation>

\newlength{\xshift}
\setlength{\xshift}{0.05\paperwidth}

% Header.
\defbeamertemplate*{frametitle}{polimi}
{
    \begin{tikzpicture}[overlay, remember picture]
    \node at ([shift={(\xshift, -0.6)}] current page.north west) [anchor=south west, inner sep=0pt]
    {
        {\small \insertsectionhead \ifx\insertsubsection\empty\else\ - \insertsubsectionhead\fi\leavevmode}
    };
    \node at ([shift={(\xshift, -1.25)}] current page.north west) [anchor=south west, inner sep=0pt]
    {
        \insertframetitle
    };
    \end{tikzpicture}
    \vspace{1.1cm}
}

% Header.
\defbeamertemplate*{frametitle}{plain}{}

% Use frametitle template even if \frametitle is empty.
\patchcmd{\endbeamer@frameslide}{\ifx\beamer@frametitle\@empty}{\iffalse}{}{\errmessage{Failed to patch frametitle.}}

% Footer.
\defbeamertemplate{footline}{polimi}{
    \begin{minipage}[b][1cm][c]{\paperwidth}
        \ifnum\c@framenumber>0
            \begin{tikzpicture}[overlay, remember picture]
            \node at ([shift={(\xshift, 0.5)}] current page.south west) [anchor=west, inner sep=0pt]
            {
                {\scriptsize\color{white} \insertauthor}
            };
            \node at ([shift={(-0.5\xshift, 0.5)}] current page.south east) [anchor=east, inner sep=0pt]
            {
                \includegraphics[height=\baselineskip]{logo_bandiera.png}
            };
            \end{tikzpicture}
        \fi
    \end{minipage}
}

\setbeamertemplate{footline}[polimi]

% Enable nonumber option.
\BeforeBeginEnvironment{frame}{
    \setbeamertemplate{background}[polimi]
    \setbeamertemplate{frametitle}[polimi]
    \setbeamertemplate{headline}[frame number]
}

\makeatletter
\define@key{beamerframe}{nonumber}[true]{
    \setbeamertemplate{headline}{}
    \addtocounter{framenumber}{-1}
}
\makeatother

% Enable plain option.
\makeatletter
\define@key{beamerframe}{plain}[true]{
    \ifnum\c@framenumber>0
        \setbeamertemplate{background}[footer]
        \setbeamertemplate{frametitle}[plain]
        \setbeamertemplate{headline}{}
        \addtocounter{framenumber}{-1}
    \fi
}
\makeatother

beamerinnerthemepolimi.sty

\mode<presentation>

% Background.
\defbeamertemplate*{background}{polimi}{
    % Titlepage.
    \ifnum\c@framenumber=0
        \begin{tikzpicture}[overlay, remember picture]
            \if@bgphoto
                \node at (current page.north) [anchor=north, inner sep=0pt] {\includegraphics[width=\paperwidth]{bgphoto_cut.jpg}};
            \fi
            \node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.4415\paperheight, fill=bluePolimi] {};
            \if@nologo\else
                \node at (foot.north) [anchor=south, inner sep=0.5cm] {
                    \if@bgphoto
                        \includegraphics[width=0.3\paperwidth]{logo_centrato_COL_negativo.png}
                    \else
                        \includegraphics[width=0.3\paperwidth]{logo_centrato_COL_positivo.png}
                    \fi
                };
            \fi
            \node at ([shift={(0, -0.1)}] foot.north) {\includegraphics[width=\paperwidth]{decoration.pdf}};
        \end{tikzpicture}
    \else
        \begin{tikzpicture}[overlay, remember picture]
            \node (head) at (current page.north) [anchor=north, minimum width=\paperwidth, minimum height=0.1835\paperheight, fill=bluePolimi] {};
            \node at ([shift={(0, 0.1)}] head.south) {\includegraphics[width=\paperwidth]{decoration.pdf}};
            \node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.105\paperheight, fill=bluePolimi] {};
        \end{tikzpicture}
    \fi
}

% Only footer background.
\defbeamertemplate*{background}{footer}{
    \begin{tikzpicture}[overlay, remember picture]
    \node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.105\paperheight, fill=bluePolimi] {};
    \end{tikzpicture}
}

% Title page.
\defbeamertemplate*{title page}{polimi}[1][]
{
    \color{white}
    \vspace{4.25cm}
    
    \begin{minipage}[t][\baselineskip]{\paperwidth}
        {\Large\bf \inserttitle}
    \end{minipage}
    \\[\baselineskip]
    \begin{minipage}[t][2\baselineskip]{\paperwidth}
        {\large \insertsubtitle}
    \end{minipage}
    
    \vfill
    
    \begin{minipage}[t][\baselineskip]{\paperwidth}
        {\large\bf \insertauthor}
    \end{minipage}
    
    \begin{minipage}[t][\baselineskip]{\paperwidth}
        \insertdate
    \end{minipage}
    
    \vfill
    
    \addtocounter{framenumber}{-1}
}

% Table of Contents.
\setbeamertemplate{section in toc}[circle]
\setbeamertemplate{subsection in toc}{\leavevmode \leftskip=0.7em {\color{bluePolimi} $\bullet$} \hskip1pt \inserttocsubsection\par}  

% Section page.
\defbeamertemplate*{section page}{polimi}{
    \begin{tikzpicture}[overlay, remember picture]
        \node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.4415\paperheight, fill=bluePolimi] {};
        \node at ([shift={(0, -0.1)}] foot.north) {\includegraphics[width=\paperwidth]{decoration.pdf}};
        % \path let \p1 = ([shift={(0, 0.105\paperheight+0.25)}] current page.south west), \p2 = (current page.east) in (\x1, \y1) edge [white, line width=0.5] (\x2, \y1);
        \node at ([shift={(\xshift, 3.5)}] current page.south west) [anchor=north west, inner sep=0pt, text width=\textwidth]
        {
            {\color{white}\Large\bf \insertsection}
        };
    \end{tikzpicture}
}
\setbeamertemplate{section page}[polimi]


% Subsection page.
\defbeamertemplate*{subsection page}{polimi}{
    \begin{tikzpicture}[overlay, remember picture]
    \node (foot) at (current page.south) [anchor=south, minimum width=\paperwidth, minimum height=0.4415\paperheight, fill=bluePolimi] {};
    \node at ([shift={(0, -0.1)}] foot.north) {\includegraphics[width=\paperwidth]{decoration.pdf}};
    % \path let \p1 = ([shift={(0, 0.105\paperheight+0.25)}] current page.south east), \p2 = (current page.west) in (\paperwidth,\y1) edge [white, line width=0.5] (\x2,\y1);
    \node at ([shift={(\xshift, 3.5)}] current page.south west) [anchor=north west, inner sep=0pt, text width=\textwidth]
    {
        {\color{white}\Large\bf \insertsubsection}
    };
    \end{tikzpicture}
}
\setbeamertemplate{subsection page}[polimi]

EDIT: beamercolorthemepolimi.sty:

\mode<presentation>

\definecolor{bluePolimi}{RGB}{114, 143, 165}
\definecolor{greenPolimi}{RGB}{0, 110, 0}
\definecolor{redPolimi}{RGB}{180, 0, 0}

\setbeamercolor{frametitle}{fg=white}

\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=redPolimi}
\setbeamercolor{example text}{fg=greenPolimi}

\setbeamercolor{block title}{bg=bluePolimi, fg=white}
\setbeamercolor{block body}{bg=bluePolimi!10!white, fg=black}

\setbeamercolor{block title alerted}{bg=redPolimi, fg=white}
\setbeamercolor{block body alerted}{bg=redPolimi!10!white, fg=black}

\setbeamercolor{block title example}{bg=greenPolimi, fg=white}
\setbeamercolor{block body example}{bg=greenPolimi!10!white, fg=black}

\setbeamercolor{itemize item}{fg=bluePolimi}
\setbeamercolor{itemize subitem}{fg=bluePolimi}

\setbeamercolor{section in toc}{fg=black}
\setbeamercolor{subsection in toc}{fg=black}
\setbeamercolor{section number projected}{bg=bluePolimi}

\setbeamercolor{page number in head/foot}{fg=white}
0

1 Answer 1

3

For some reason, your theme redefines the plain frame option to only work for frame numbers > 0. At the same time it decreases the frame number by one for plain frames, which means that if there isn't a normal frame before the plain frame, it will be frame number 0 and thus your theme does not remove the headline.

You can redefine the redefined plain frame option to work for all frames like this:

\documentclass{beamer}

\usetheme[bgphoto]{polimi}

\title[MS thesis]{Thesis title}
\subtitle{Master Thesis in Computer Science and Engineering}
\author[Alessandro Bertulli]{Alessandro Bertulli, matr. xxxxxx}
\date[05/10/2023]{5th October 2023}

\makeatletter
\define@key{beamerframe}{plain}[true]{
%    \ifnum\c@framenumber>0
        \setbeamertemplate{background}[footer]
        \setbeamertemplate{frametitle}[plain]
        \setbeamertemplate{headline}{}
        \addtocounter{framenumber}{-1}
%    \fi
}
\makeatother

\begin{document}


\section{Introduction}
\begin{frame}[plain]
    \sectionpage
\end{frame}

\begin{frame}[plain]
    \sectionpage
\end{frame}

\end{document}
2
  • Thanks! I suspected the reason was related to the frame numbers, but I couldn't figure out why. I think it is made like so to have the title page different (see the GitHub link for a picture). But I wonder if it would be more robust by declaring the title background differently and remove this frame number hack. Can I overwrite the title frame background? Commented Sep 23, 2023 at 19:58
  • 1
    @AlessandroBertulli Using the frame number for this is definitely not very robust. There might be presentations without titlepage, a second title page in the middle of the presentation ... Personally I would do this via the page style, e.g. topanswers.xyz/tex?q=1004#a1198 Commented Sep 23, 2023 at 20:04

You must log in to answer this question.

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