Skip to content

Instantly share code, notes, and snippets.

@ivan-krukov
Created September 5, 2016 18:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-krukov/bfad014d34e8d4af6a7712f37ab446c8 to your computer and use it in GitHub Desktop.
Save ivan-krukov/bfad014d34e8d4af6a7712f37ab446c8 to your computer and use it in GitHub Desktop.
Metropolis Beamer theme framesubtitle

Metropolis framesubtitle

This is an attempt to have frame subtitle support for the Metropolis Beamer theme. Since there is no native support in the theme itself, this is somewhat of a hack.

This adds an extra beamercolorbox, equivalent to a frametitle box, but with a different name.

\documentclass{beamer}
\usetheme[progressbar=foot, numbering=none]{metropolis} % Use metropolis theme
%IMPORTANT: include the file
\usepackage{metropolis_framesubtitle}
\definecolor{Purple}{HTML}{911146}
% Set title color
\setbeamercolor{frametitle}{bg=Purple}
% IMPORTANT: set subtitle color
\setbeamercolor{framesubtitle}{fg=Purple, bg=normal text.bg}
\title{A minimal example}
\subtitle{Hello}
\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}
\begin{document}
\maketitle
\begin{frame}{This is title}{This is a subtitle}
Hello, world!
\end{frame}
\begin{frame}{Second Frame}{Another subtitle!}
Goodbye, world!
\end{frame}
\end{document}
\ProvidesPackage{metropolis_framesubtitle}
\addtobeamertemplate{frametitle}{}{%
\ifx\insertframesubtitle\@empty\else%
\usebeamerfont{frametitle}%
\usebeamercolor[fg]{framesubtitle}%
\begin{beamercolorbox}[%
wd=\paperwidth,%
sep=0pt,%
leftskip=\metropolis@frametitle@padding,%
rightskip=\metropolis@frametitle@padding,%
]{framesubtitle}%
\metropolis@frametitlestrut@start\insertframesubtitle\metropolis@frametitlestrut@end%
\end{beamercolorbox}%
\fi%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment