2

I am using beamer theme metropolis which does not support framesubtitles. I have therefore added it using \addtobeamertemplate. Unfortunately, I am not very familiar with latex.

Here are my issue:

  • the framesubtitle is not left-aligned with the frametitle. How do I achieve this? (more generally: how do I change alignment for title and subtitle in general)
  • the vertical spacing between frametitle and framesubtitle very small. How do I increase the spacing?

This is a minimum working example of my code:

\documentclass[8pt]{beamer}
\usetheme[block=fill]{metropolis}
\usepackage[utf8]{inputenc}


% Add framesubtitle to template
\setbeamercolor{framesubtitle}{fg=mDarkTeal}
\addtobeamertemplate{frametitle}{}{%
  \ifx\insertframesubtitle\@empty\else%
  \usebeamerfont{framesubtitle}%
  \usebeamercolor[fg]{framesubtitle}%
  %\vskip3pt
  \insertframesubtitle%
  \fi%
}



\begin{document}


\section{Chapter X}

\begin{frame}{Header 1}
    \framesubtitle{Subheader 2}

    Some text here!

\end{frame}

\end{document}

Thanks!

1

Only for example: main title to the right ans subtitle to the left:

\documentclass[8pt]{beamer}
\usetheme[block=fill]{metropolis}

\makeatletter
\setbeamercolor{framesubtitle}{fg=mDarkTeal}
\defbeamertemplate*{frametitle}{myframetitle}{%
    \nointerlineskip
    \begin{beamercolorbox}[%
        wd=\paperwidth,%
        sep=0pt,%
        leftskip=\metropolis@frametitle@padding,
        rightskip=\metropolis@frametitle@padding,
        ]{frametitle}%
        \metropolis@frametitlestrut@start
        \quad\insertframetitle%%%%%%%%%%%%%%%%%%%%%%
        \nolinebreak
        \metropolis@frametitlestrut@end
    \end{beamercolorbox}\par
    \usebeamerfont{framesubtitle}%
    \usebeamercolor[fg]{framesubtitle}%
    \vskip3pt
    \hspace*{-2.5\metropolis@frametitle@padding}%
    \insertframesubtitle
}
\makeatother
\setbeamertemplate{frametitle}[myframetitle]

\begin{document}

    \section{Chapter X}

    \begin{frame}{Header 1}
    \framesubtitle{Subheader 2}

    Some text here!

\end{frame}

\end{document}

enter image description here

| improve this answer | |
  • Yes. Works perfectly for aligning the framesubtitle to the frametitle. Any idea how I do it the other way around, i.e. move the frametitle a bit more to the right? – FredMaster Oct 31 '19 at 13:21
  • See edited answer – user187802 Oct 31 '19 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.