feat!: simplify blocks and remove blocks with background

This commit is contained in:
Johan Larsson 2024-01-11 11:12:07 +01:00
parent fbfcc0b7ad
commit d5317d4d05
7 changed files with 170 additions and 351 deletions

View File

@ -198,26 +198,7 @@ or show \textbf{bold} results.\end{verbatim}
\end{table} \end{table}
\end{frame} \end{frame}
\begin{frame}{Blocks} \begin{frame}{Blocks}
Three different block environments are pre-defined and may be styled with an Three different block environments are pre-defined.
optional background color.
\begin{columns}[T,onlytextwidth]
\column{0.5\textwidth}
\begin{block}{Default}
Block content.
\end{block}
\begin{alertblock}{Alert}
Block content.
\end{alertblock}
\begin{exampleblock}{Example}
Block content.
\end{exampleblock}
\column{0.5\textwidth}
\molochset{block=fill}
\begin{block}{Default} \begin{block}{Default}
Block content. Block content.
@ -231,7 +212,6 @@ or show \textbf{bold} results.\end{verbatim}
Block content. Block content.
\end{exampleblock} \end{exampleblock}
\end{columns}
\end{frame} \end{frame}
\begin{frame}{Math} \begin{frame}{Math}
\begin{equation*} \begin{equation*}

View File

@ -385,10 +385,6 @@ The list of options is structured as shown in the following example.
} }
\subsubsection{Color theme} \subsubsection{Color theme}
\DescribeOption{block}{transparent, fill}{transparent}{
Optionally adds a light grey background to block environments like |theorem|
and |example|.
}
\DescribeOption{background}{dark, light}{light}{ \DescribeOption{background}{dark, light}{light}{
Provides the option to have a dark background and light foreground instead Provides the option to have a dark background and light foreground instead

View File

@ -34,18 +34,6 @@
% %
% \subsubsection{Options} % \subsubsection{Options}
% %
% \begin{macro}{block}
% Optionally adds a light grey background to block environments like
% |theorem| and |example|.
% \begin{macrocode}
\pgfkeys{
/moloch/color/block/.cd,
.is choice,
transparent/.code=\moloch@block@transparent,
fill/.code=\moloch@block@fill,
}
% \end{macrocode}
% \end{macro}
% %
% \begin{macro}{colors} % \begin{macro}{colors}
% Provides the option to have a dark background and light foreground instead % Provides the option to have a dark background and light foreground instead
@ -66,7 +54,6 @@
\newcommand{\moloch@color@setdefaults}{ \newcommand{\moloch@color@setdefaults}{
\pgfkeys{/moloch/color/.cd, \pgfkeys{/moloch/color/.cd,
background=light, background=light,
block=transparent,
} }
} }
% \end{macrocode} % \end{macrocode}
@ -172,34 +159,9 @@
} }
% \end{macrocode} % \end{macrocode}
% %
% Block environments such as |theorem| and |example| have no background color % Block environments use alerted tex and example text for the title
% 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{\moloch@block@transparent}{
\setbeamercolor{block title}{%
use=normal text,
fg=normal text.fg,
bg=
}
\setbeamercolor{block body}{
bg=
}
}
\newcommand{\moloch@block@fill}{
\setbeamercolor{block title}{%
use=normal text,
fg=normal text.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},
fg=alerted text.fg fg=alerted text.fg
@ -208,8 +170,6 @@
use={block title, example text}, use={block title, example text},
fg=example text.fg fg=example text.fg
} }
% \setbeamercolor{block body alerted}{use=block body, parent=block body}
% \setbeamercolor{block body example}{use=block body, parent=block body}
% \end{macrocode} % \end{macrocode}
% %
% Footnotes % Footnotes

View File

@ -362,120 +362,6 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
%
%
% \subsubsection{Block environments}
%
%
% \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 |\moloch@block| to define all three templates.
%
% \begin{macrocode}
% \newlength{\moloch@blocksep}
% \newlength{\moloch@blockadjust}
% \setlength{\moloch@blocksep}{0.75ex}
% \setlength{\moloch@blockadjust}{0.25ex}
% \providecommand{\moloch@strut}{%
% \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()}%
% }
% \newcommand{\moloch@block}[1]{
% \par\vskip\medskipamount%
% \setlength{\parskip}{0pt}
% \end{macrocode}
%
% 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
% be accomplished by setting |colsep=0.75ex|, which is intended to add
% ``color separation space'' only when the box has a colored background.
% Unfortunately, |colsep| also adds this separation if the background color
% is inherited, even if the inherited color is actually empty.
% (The technical reason for this boils down to the fact that the |\ifx|
% directive does not expand macros.)
%
% To achieve the correct spacing for |alertblock|s and |exampleblock|s
% as well as for normal blocks, we have to begin the |beamercolorbox|
% differently based on whether |block title| has an empty background.
%
% If the |block title| background is empty, or the user has explicitly
% removed the background from (e.g.) |block title alerted|, we just need to
% set a rightskip for a nice ragged-right block title.
%
% \begin{macrocode}
% \ifbeamercolorempty[bg]{block title#1}{%
% \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{%
% \ifbeamercolorempty[bg]{block title}{%
% \begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}%
% }%
% \end{macrocode}
%
% Otherwise, if the |block title| has a background, we set the padding based
% on |\moloch@blockskip|. However, we have to visually compensate for
% the |\moloch@strut| added to the block title (see below) by
% subtracting |\moloch@blockadjust| from the top and bottom padding.
%
% \begin{macrocode}
{%
% \begin{beamercolorbox}[
% sep=\dimexpr\moloch@blocksep-\moloch@blockadjust\relax,
% leftskip=\moloch@blockadjust,
% rightskip=\dimexpr\moloch@blockadjust plus 4em\relax
% ]{block title#1}%
% }}%
% \end{macrocode}
%
% We can now set the contents of the |block title|. The zero-width but
% positive-height box |\moloch@strut| ensures that the block title box
% has a consistent height, even if it lacks punctuation, ascenders, or
% descenders.
%
% \begin{macrocode}
% \usebeamerfont*{block title#1}%
% \moloch@strut%
% \insertblocktitle%
% \moloch@strut%
% \end{beamercolorbox}%
% \end{macrocode}
%
% Next, we typeset the |block body|. This the code is similar to, but simpler
% than, the |block title| code since we don't need to adjust for any struts.
%
% \begin{macrocode}
% \nointerlineskip%
% \ifbeamercolorempty[bg]{block body#1}{%
% \begin{beamercolorbox}[vmode]{block body#1}}{
% \ifbeamercolorempty[bg]{block body}{%
% \begin{beamercolorbox}[vmode]{block body#1}%
% }{%
% \begin{beamercolorbox}[sep=\moloch@blocksep, vmode]{block body#1}%
% \vspace{-\moloch@parskip}
% }}%
% \usebeamerfont{block body#1}%
% \setlength{\parskip}{\moloch@parskip}%
% }
% % \end{macrocode}
% %
% % This concludes the auxiliary macro |\moloch@block|. Finally,
% % we define the block beamer templates using this macro.
% %
% % \begin{macrocode}
% \setbeamertemplate{block begin}{\moloch@block{}}
% \setbeamertemplate{block alerted begin}{\moloch@block{ alerted}}
% \setbeamertemplate{block example begin}{\moloch@block{ example}}
% \setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}}
% \setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}
% \setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
% \subsubsection{Lists and floats} % \subsubsection{Lists and floats}
% %
% \begin{macrocode} % \begin{macrocode}

View File

@ -12,8 +12,7 @@
% \iffalse % \iffalse
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthememoloch} \ProvidesPackage{beamerthememoloch}[2017/01/23 v1.2 Moloch Beamer theme]
[2017/01/23 v1.2 Moloch Beamer theme]
%</package> %</package>
% \fi % \fi
% \CheckSum{0} % \CheckSum{0}
@ -112,7 +111,6 @@
usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction}, usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction},
nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none}, nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none},
darkcolors/.code=\pgfkeysalso{color/background=dark}, darkcolors/.code=\pgfkeysalso{color/background=dark},
blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill},
} }
% \end{macrocode} % \end{macrocode}
% %

View File

@ -15,8 +15,7 @@
%<driver> \ProvidesFile{pgfplotsthemetol.dtx} %<driver> \ProvidesFile{pgfplotsthemetol.dtx}
%<*package> %<*package>
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pgfplotsthemetol} \ProvidesPackage{pgfplotsthemetol}[2017/01/23 PGFplots colors based on Paul Tol's SRON technical note]
[2017/01/23 PGFplots colors based on Paul Tol's SRON technical note]
%</package> %</package>
%<driver> \documentclass{ltxdoc} %<driver> \documentclass{ltxdoc}
%<driver> \usepackage{pgfplotsthemetol} %<driver> \usepackage{pgfplotsthemetol}