mirror of https://github.com/matze/mtheme.git
Base block spacing on bg colour, not theme option
This commit is contained in:
parent
c997553cad
commit
653826403e
|
@ -357,10 +357,6 @@ The list of options is structured as shown in the following example.
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{Inner theme}
|
\subsubsection{Inner theme}
|
||||||
\DescribeOption{block}{transparent, fill}{transparent}{
|
|
||||||
Optionally adds a light grey background to block environments like |theorem|
|
|
||||||
and |example|.
|
|
||||||
}
|
|
||||||
|
|
||||||
\DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{
|
\DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{
|
||||||
Adds a slide at the start of each section (|simple|) with an optional thin
|
Adds a slide at the start of each section (|simple|) with an optional thin
|
||||||
|
@ -416,6 +412,7 @@ terms of three beamer colors:
|
||||||
\item |alerted text| (colored fg, should be visible against dark or light)
|
\item |alerted text| (colored fg, should be visible against dark or light)
|
||||||
\item |example text| (colored fg, should be visible against dark or light)
|
\item |example text| (colored fg, should be visible against dark or light)
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
An easy way to customize the theme is to redefine these colors using
|
An easy way to customize the theme is to redefine these colors using
|
||||||
|
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
% \subsubsection{Options}
|
% \subsubsection{Options}
|
||||||
%
|
%
|
||||||
% \begin{macro}{block}
|
% \begin{macro}{block}
|
||||||
% Controls whether block environments are filled or transparent.
|
% Optionally adds a light grey background to block environments like
|
||||||
|
% |theorem| and |example|.
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\pgfkeys{
|
\pgfkeys{
|
||||||
/metropolis/color/block/.cd,
|
/metropolis/color/block/.cd,
|
||||||
|
@ -176,11 +177,22 @@
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
% Blocks
|
% Block environments such as |theorem| and |example| have no background color
|
||||||
|
% by default. The option |block=fill| sets a background color based on the
|
||||||
|
% background and foreground of |normal text|. The option |block=transparent|
|
||||||
|
% reverts the block environments to an empty background, which can be useful
|
||||||
|
% if changing colors mid-presentation.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\newcommand{\metropolis@block@transparent}{
|
\newcommand{\metropolis@block@transparent}{
|
||||||
\setbeamercolor{block title}{use=normal text, parent=normal text}
|
\setbeamercolor{block title}{%
|
||||||
|
use=normal text,
|
||||||
|
fg=normal text.fg,
|
||||||
|
bg=
|
||||||
|
}
|
||||||
|
\setbeamercolor{block body}{
|
||||||
|
bg=
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\newcommand{\metropolis@block@fill}{
|
\newcommand{\metropolis@block@fill}{
|
||||||
\setbeamercolor{block title}{%
|
\setbeamercolor{block title}{%
|
||||||
|
@ -188,6 +200,10 @@
|
||||||
fg=normal text.fg,
|
fg=normal text.fg,
|
||||||
bg=normal text.bg!80!fg
|
bg=normal text.bg!80!fg
|
||||||
}
|
}
|
||||||
|
\setbeamercolor{block body}{
|
||||||
|
use={block title, normal text},
|
||||||
|
bg=block title.bg!50!normal text.bg
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\setbeamercolor{block title alerted}{%
|
\setbeamercolor{block title alerted}{%
|
||||||
use={block title, alerted text},
|
use={block title, alerted text},
|
||||||
|
@ -201,10 +217,6 @@
|
||||||
}
|
}
|
||||||
\setbeamercolor{block body alerted}{use=block body, parent=block body}
|
\setbeamercolor{block body alerted}{use=block body, parent=block body}
|
||||||
\setbeamercolor{block body example}{use=block body, parent=block body}
|
\setbeamercolor{block body example}{use=block body, parent=block body}
|
||||||
\setbeamercolor{block body}{
|
|
||||||
use={block title, normal text},
|
|
||||||
bg=block title.bg!50!normal text.bg
|
|
||||||
}
|
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
% Footnotes
|
% Footnotes
|
||||||
|
|
|
@ -55,18 +55,6 @@
|
||||||
%
|
%
|
||||||
% \subsubsection{Options}
|
% \subsubsection{Options}
|
||||||
%
|
%
|
||||||
% \begin{macro}{block}
|
|
||||||
% This option controls the block style.
|
|
||||||
% \begin{macrocode}
|
|
||||||
\pgfkeys{
|
|
||||||
/metropolis/inner/block/.cd,
|
|
||||||
.is choice,
|
|
||||||
transparent/.code=\setlength{\metropolis@blockskip}{0ex},
|
|
||||||
fill/.code=\setlength{\metropolis@blockskip}{1ex},
|
|
||||||
}
|
|
||||||
% \end{macrocode}
|
|
||||||
% \end{macro}
|
|
||||||
%
|
|
||||||
% \begin{macro}{sectionpage}
|
% \begin{macro}{sectionpage}
|
||||||
% The |sectionpage| option defines the behaviour of the sectionpage.
|
% The |sectionpage| option defines the behaviour of the sectionpage.
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
|
@ -86,7 +74,6 @@
|
||||||
\newcommand{\metropolis@inner@setdefaults}{
|
\newcommand{\metropolis@inner@setdefaults}{
|
||||||
\pgfkeys{/metropolis/inner/.cd,
|
\pgfkeys{/metropolis/inner/.cd,
|
||||||
sectionpage=progressbar,
|
sectionpage=progressbar,
|
||||||
block=transparent,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
|
@ -328,87 +315,70 @@
|
||||||
%
|
%
|
||||||
% \subsubsection{Block environments}
|
% \subsubsection{Block environments}
|
||||||
%
|
%
|
||||||
% Regular block environment
|
%
|
||||||
|
% \begin{macro}{block}
|
||||||
|
% \begin{macro}{block alerted}
|
||||||
|
% \begin{macro}{block example}
|
||||||
|
%
|
||||||
|
% The three different block environments differ only in their colours.
|
||||||
|
% Rather than repeat the essentially the same template three times, we use
|
||||||
|
% the auxiliary macro |\metropolis@block| to define all three templates.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\newlength{\metropolis@blockskip}
|
\newlength{\metropolis@blocktitleskip}
|
||||||
\setbeamertemplate{block begin}{%
|
\newlength{\metropolis@blockbodyskip}
|
||||||
|
\newcommand{\metropolis@block}[1]{
|
||||||
\setlength{\parskip}{\metropolis@parskip}
|
\setlength{\parskip}{\metropolis@parskip}
|
||||||
|
% \end{macrocode}
|
||||||
|
%
|
||||||
|
% If a background color is defined for the block title or body, a little
|
||||||
|
% bit of padding is added to the corresponding box.
|
||||||
|
%
|
||||||
|
% \begin{macrocode}
|
||||||
|
\ifbeamercolorempty[bg]{block title}
|
||||||
|
{\setlength{\metropolis@blocktitleskip}{0ex}}
|
||||||
|
{\setlength{\metropolis@blocktitleskip}{1ex}}
|
||||||
|
\ifbeamercolorempty[bg]{block body}
|
||||||
|
{\setlength{\metropolis@blockbodyskip}{0ex}}
|
||||||
|
{\setlength{\metropolis@blockbodyskip}{1ex}}
|
||||||
\vspace*{1ex}
|
\vspace*{1ex}
|
||||||
|
% \end{macrocode}
|
||||||
|
%
|
||||||
|
% Each block environment consists of two (possibly coloured) beamer boxes:
|
||||||
|
% one for the title and one for the body.
|
||||||
|
%
|
||||||
|
% \begin{macrocode}
|
||||||
\begin{beamercolorbox}[%
|
\begin{beamercolorbox}[%
|
||||||
ht=2.4ex,
|
ht=2.4ex,
|
||||||
dp=1ex,
|
dp=1ex,
|
||||||
leftskip=\metropolis@blockskip,
|
leftskip=\metropolis@blocktitleskip,
|
||||||
rightskip=\metropolis@blockskip]{block title}
|
rightskip=\metropolis@blocktitleskip]{block title#1}
|
||||||
\usebeamerfont*{block title}\insertblocktitle%
|
\usebeamerfont*{block title#1}\insertblocktitle%
|
||||||
\end{beamercolorbox}%
|
\end{beamercolorbox}%
|
||||||
\vspace*{-1pt}
|
\nointerlineskip%
|
||||||
\usebeamerfont{block body}%
|
\usebeamerfont{block body#1}%
|
||||||
\begin{beamercolorbox}[%
|
\begin{beamercolorbox}[%
|
||||||
dp=1ex,
|
dp=1ex,
|
||||||
leftskip=\metropolis@blockskip,
|
leftskip=\metropolis@blockbodyskip,
|
||||||
rightskip=\metropolis@blockskip,
|
rightskip=\metropolis@blockbodyskip,
|
||||||
vmode]{block body}%
|
vmode]{block body#1}%
|
||||||
}
|
|
||||||
\setbeamertemplate{block end}{%
|
|
||||||
\end{beamercolorbox}
|
|
||||||
\vspace*{0.2ex}
|
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
% Alerted block environment
|
% This concludes the auxiliary macro |\metropolis@block|. Next,
|
||||||
|
% we define the block beamer templates using this macro.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\setbeamertemplate{block alerted begin}{%
|
\setbeamertemplate{block begin}{\metropolis@block{}}
|
||||||
\setlength{\parskip}{\metropolis@parskip}
|
\setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}}
|
||||||
\vspace*{1ex}
|
\setbeamertemplate{block example begin}{\metropolis@block{ example}}
|
||||||
\begin{beamercolorbox}[%
|
\setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||||
ht=2.4ex,
|
\setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||||
dp=1ex,
|
\setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||||
leftskip=\metropolis@blockskip,
|
|
||||||
rightskip=\metropolis@blockskip]{block title alerted}
|
|
||||||
\usebeamerfont*{block title alerted}\insertblocktitle%
|
|
||||||
\end{beamercolorbox}%
|
|
||||||
\vspace*{-1pt}
|
|
||||||
\usebeamerfont{block body alerted}%
|
|
||||||
\begin{beamercolorbox}[%
|
|
||||||
dp=1ex,
|
|
||||||
leftskip=\metropolis@blockskip,
|
|
||||||
rightskip=\metropolis@blockskip,
|
|
||||||
vmode]{block body alerted}%
|
|
||||||
}
|
|
||||||
\setbeamertemplate{block alerted end}{%
|
|
||||||
\end{beamercolorbox}
|
|
||||||
\vspace*{0.2ex}
|
|
||||||
}
|
|
||||||
% \end{macrocode}
|
|
||||||
%
|
|
||||||
% Example block environment
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
\setbeamertemplate{block example begin}{%
|
|
||||||
\setlength{\parskip}{\metropolis@parskip}
|
|
||||||
\vspace*{1ex}
|
|
||||||
\begin{beamercolorbox}[%
|
|
||||||
ht=2.4ex,
|
|
||||||
dp=1ex,
|
|
||||||
leftskip=\metropolis@blockskip,
|
|
||||||
rightskip=\metropolis@blockskip]{block title example}
|
|
||||||
\usebeamerfont*{block title example}\insertblocktitle%
|
|
||||||
\end{beamercolorbox}%
|
|
||||||
\vspace*{-1pt}
|
|
||||||
\usebeamerfont{block body example}%
|
|
||||||
\begin{beamercolorbox}[%
|
|
||||||
dp=1ex,
|
|
||||||
leftskip=\metropolis@blockskip,
|
|
||||||
rightskip=\metropolis@blockskip,
|
|
||||||
vmode]{block body example}%
|
|
||||||
}
|
|
||||||
\setbeamertemplate{block example end}{%
|
|
||||||
\end{beamercolorbox}
|
|
||||||
\vspace*{0.2ex}
|
|
||||||
}
|
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
|
% \end{macro}
|
||||||
|
% \end{macro}
|
||||||
|
% \end{macro}
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
|
|
|
@ -55,17 +55,7 @@
|
||||||
/metropolis/outer,
|
/metropolis/outer,
|
||||||
/metropolis/color,
|
/metropolis/color,
|
||||||
/metropolis/font,
|
/metropolis/font,
|
||||||
},
|
}
|
||||||
% \end{macrocode}
|
|
||||||
%
|
|
||||||
% Currently, the |block| option affects two subthemes and has to be handled
|
|
||||||
% separately.
|
|
||||||
%
|
|
||||||
% \begin{macrocode}
|
|
||||||
block/.code=\pgfkeysalso{
|
|
||||||
inner/block=#1,
|
|
||||||
color/block=#1,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
|
|
Loading…
Reference in New Issue