From 9afeab17fe978e9c4c9a234f5bd5ab1d2c26d42a Mon Sep 17 00:00:00 2001 From: tmgriffiths Date: Thu, 16 Jul 2015 14:07:31 +1000 Subject: [PATCH] Defined a length specific to frame title format Used the \heightof{} command from the calc package to ensure that the height used as a strut in the beamercolorbox is consistent. The height is set to the height of the tallest character of the font in a typeface independent manner, and also depending on whether the frame title is set in small caps uppercase or regular case. This ensure that the colorbox is always the height of the text plus 1.5ex above and below the text independent of format, text size, ratio and typeface. --- beamerouterthememetropolis.dtx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/beamerouterthememetropolis.dtx b/beamerouterthememetropolis.dtx index 33f2a53..a0a38d1 100644 --- a/beamerouterthememetropolis.dtx +++ b/beamerouterthememetropolis.dtx @@ -75,13 +75,18 @@ \pgfkeys{ /metropolis/outer/frametitleformat/.cd, .is choice, - regular/.code=\renewcommand{\@metropolis@frametitleformat}{}, + regular/.code={% + \renewcommand{\@metropolis@frametitleformat}{}% + \setlength{\@metropolis@frametitlestrut}{\heightof{ABCDEFGHIJKLMNOPQRSTUVXYZ}}% Usually around 1.6ex but is font dependant + }, lowercase/.code={% - \renewcommand{\@metropolis@frametitleformat}{\MakeLowercase} - }, + \renewcommand{\@metropolis@frametitleformat}{\MakeLowercase}% + \setlength{\@metropolis@frametitlestrut}{\heightof{abcdefghijklmnopqrstuvxyz}} + }, uppercase/.code={% - \renewcommand{\@metropolis@frametitleformat}{\MakeUppercase} - }, + \renewcommand{\@metropolis@frametitleformat}{\MakeUppercase}% + \setlength{\@metropolis@frametitlestrut}{\heightof{ABCDEFGHIJKLMNOPQRSTUVXYZ}}% Usually around 1.6ex but is font dependant + }, } % \end{macrocode} % \end{macro} @@ -199,13 +204,14 @@ % progress bar. % % \begin{macrocode} +\newlength{\@metropolis@frametitlestrut} \defbeamertemplate{frametitle}{plain}{% \nointerlineskip \begin{beamercolorbox}[% wd=\paperwidth, sep=1.5ex, ]{frametitle} - \insertframetitle\rule{0pt}{1ex}% + \insertframetitle\rule{0pt}{\@metropolis@frametitlestrut}% \end{beamercolorbox}% \vspace{\@metropolis@voffset} } @@ -215,7 +221,7 @@ wd=\paperwidth, sep=1.5ex, ]{frametitle} - \insertframetitle\rule{0pt}{1ex}% + \insertframetitle\rule{0pt}{\@metropolis@frametitlestrut}% \end{beamercolorbox}% \usebeamertemplate*{progress bar in head/foot} \vspace{\@metropolis@voffset}