Tweak block padding

This commit is contained in:
Ross Churchley 2016-02-26 01:20:16 -08:00
parent c48cc90a7b
commit b97a35f847
1 changed files with 20 additions and 27 deletions

View File

@ -325,9 +325,9 @@
% the auxiliary macro |\metropolis@block| to define all three templates. % the auxiliary macro |\metropolis@block| to define all three templates.
% %
% \begin{macrocode} % \begin{macrocode}
\newlength{\metropolis@blocktitleadjustleft} \newlength{\metropolis@blocktitlesep}
\newlength{\metropolis@blocktitleadjustright} \newlength{\metropolis@blockbodysep}
\newlength{\metropolis@blockbodyadjust} \newcommand{\foo}{20}
\providecommand{\metropolis@strut}{% \providecommand{\metropolis@strut}{%
\vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}% \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%
} }
@ -337,7 +337,7 @@
% %
% If a background color is defined for the block title or body, we need to % If a background color is defined for the block title or body, we need to
% add a little bit of padding to the corresponding box. Ideally, this would % add a little bit of padding to the corresponding box. Ideally, this would
% be accomplished by setting |colsep=1ex|, which is intended to add % be accomplished by setting |colsep=0.75ex|, which is intended to add
% ``color separation space'' only when the box has a colored background. % ``color separation space'' only when the box has a colored background.
% Unfortunately, |colsep| also adds this separation if the background color % Unfortunately, |colsep| also adds this separation if the background color
% is inherited, even if the inherited color is actually empty. % is inherited, even if the inherited color is actually empty.
@ -345,29 +345,26 @@
% directive does not expand macros.) % directive does not expand macros.)
% %
% To achieve the correct spacing for |alertblock|s and |exampleblock|s % To achieve the correct spacing for |alertblock|s and |exampleblock|s
% as well as for normal blocks, we have to set |sep=1ex| in all cases and % as well as for normal blocks, we have to explicitly set the amount of
% then subtract it from the left and right edges if |block title| has % padding in a conditional based on whether the |block title| and
% an empty background. This solution assumes that either all or none of % |block body| have an empty background.
% |block title|, |block title alerted|, and |block title example| have an % This solution assumes that either all or none of |block title|,
% empty background, and likewise for |block body|, |block body alerted|, % |block title alerted|, and |block title example| have an empty
% background, and likewise for |block body|, |block body alerted|,
% and |block body example|. % and |block body example|.
% %
% \begin{macrocode} % \begin{macrocode}
\ifbeamercolorempty[bg]{block title}{ \ifbeamercolorempty[bg]{block title}
\setlength{\metropolis@blocktitleadjustleft}{-1ex} {\setlength{\metropolis@blocktitlesep}{0pt}}
\setlength{\metropolis@blocktitleadjustright}{-1ex plus 4em} {\setlength{\metropolis@blocktitlesep}{0.5ex}}
}{
\setlength{\metropolis@blocktitleadjustleft}{0pt}
\setlength{\metropolis@blocktitleadjustright}{0pt plus 4em}
}
\ifbeamercolorempty[bg]{block body} \ifbeamercolorempty[bg]{block body}
{\setlength{\metropolis@blockbodyadjust}{-1ex}} {\setlength{\metropolis@blockbodysep}{0pt}}
{\setlength{\metropolis@blockbodyadjust}{0ex}} {\setlength{\metropolis@blockbodysep}{0.75ex}}
\setlength{\parskip}{0pt} \setlength{\parskip}{0pt}
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
sep=1ex, sep=\metropolis@blocktitlesep,
leftskip=\metropolis@blocktitleadjustleft, leftskip=0.5\metropolis@blocktitlesep,
rightskip=\metropolis@blocktitleadjustright]{block title#1} rightskip=0.5\metropolis@blocktitlesep plus 4em]{block title#1}%
\usebeamerfont*{block title#1}% \usebeamerfont*{block title#1}%
\metropolis@strut% \metropolis@strut%
\insertblocktitle% \insertblocktitle%
@ -375,12 +372,8 @@
\end{beamercolorbox}% \end{beamercolorbox}%
\nointerlineskip% \nointerlineskip%
\usebeamerfont{block body#1}% \usebeamerfont{block body#1}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[sep=\metropolis@blockbodysep, vmode]{block body#1}%
sep=1ex, \ifbeamercolorempty[bg]{block body}{}{\vspace{-\metropolis@parskip}}
leftskip=\metropolis@blockbodyadjust,
rightskip=\metropolis@blockbodyadjust,
vmode]{block body#1}%
\vspace{-\metropolis@parskip}
\setlength{\parskip}{\metropolis@parskip} \setlength{\parskip}{\metropolis@parskip}
} }
% \end{macrocode} % \end{macrocode}