simplified block environments

This commit is contained in:
Jan Benda 2021-03-04 10:06:27 +01:00
parent ee734b55e5
commit 0c2aae823f
5 changed files with 68 additions and 113 deletions

View File

@ -57,20 +57,20 @@
\setbeamercolor{block title}{fg=white, bg=blue}
\setbeamercolor{block body}{fg=normal text.fg, bg=blue!20}
\setbeamercolor{block line top}{fg=}
\setbeamercolor{block line middle}{fg=}
\setbeamercolor{block line bottom}{fg=}
\setbeamercolor{block line middle}{fg=blue}
\setbeamercolor{block line bottom}{fg=blue}
\setbeamercolor{block title alerted}{parent={block title}, bg=red}
\setbeamercolor{block body alerted}{fg=red, bg=red!15}
\setbeamercolor{block line alerted top}{fg=}
\setbeamercolor{block line alerted middle}{fg=}
\setbeamercolor{block line alerted bottom}{fg=}
\setbeamercolor{block line alerted middle}{fg=red}
\setbeamercolor{block line alerted bottom}{fg=red}
\setbeamercolor{block title example}{parent={block title}, bg=lightgreen}
\setbeamercolor{block body example}{fg=normal text.fg, bg=lightgreen!40}
\setbeamercolor{block line example top}{fg=}
\setbeamercolor{block line example middle}{fg=}
\setbeamercolor{block line example bottom}{fg=}
\setbeamercolor{block line example middle}{fg=lightgreen}
\setbeamercolor{block line example bottom}{fg=lightgreen}
\if@beamer@colors@set

View File

@ -52,20 +52,20 @@
\setbeamercolor{block title}{fg=white, bg=utlightblue}
\setbeamercolor{block body}{fg=normal text.fg, bg=utlightblue!15}
\setbeamercolor{block line top}{fg=}
\setbeamercolor{block line middle}{fg=}
\setbeamercolor{block line bottom}{fg=}
\setbeamercolor{block line middle}{fg=utlightblue}
\setbeamercolor{block line bottom}{fg=utlightblue}
\setbeamercolor{block title alerted}{parent={block title}, bg=utred}
\setbeamercolor{block body alerted}{fg=utred, bg=utred!10}
\setbeamercolor{block line alerted top}{fg=}
\setbeamercolor{block line alerted middle}{fg=}
\setbeamercolor{block line alerted bottom}{fg=}
\setbeamercolor{block line alerted middle}{fg=utred}
\setbeamercolor{block line alerted bottom}{fg=utred}
\setbeamercolor{block title example}{parent={block title}, bg=utgreen}
\setbeamercolor{block body example}{fg=normal text.fg, bg=utgreen!30}
\setbeamercolor{block line example top}{fg=}
\setbeamercolor{block line example middle}{fg=}
\setbeamercolor{block line example bottom}{fg=}
\setbeamercolor{block line example middle}{fg=utgreen}
\setbeamercolor{block line example bottom}{fg=utgreen}
\addtobeamertemplate{proof begin}{%
\setbeamercolor{block title}{fg=white, bg=utmagenta}

View File

@ -54,7 +54,7 @@
\mode<presentation>
% margins:
\setbeamersize{text margin left=1em,text margin right=1em}
\setbeamersize{text margin left=1ex,text margin right=1ex}
% no navigation symbols:
\defbeamertemplate{navigation symbols}{empty}{}
@ -341,124 +341,68 @@
\setbeamertemplate{enumerate subitem}[alph] % default, circle, square, ball, alph, arabic, roman
%%%%% block environment:
%%%%% block environments:
\defbeamertemplate{block begin}{lines}[2]{%
\newcommand{\block@lines@begin}[3]{%
\par\vskip\medskipamount%
\usebeamerfont{block title}%
\usebeamerfont{block title#1}%
\IfStrEq{\insertblocktitle}{}{}{%
\ifbeamercolorempty[fg]{block line top}{}{%
\ifbeamercolorempty[fg]{block line#1 top}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line top}
\rule{\columnwidth}{#1}
\begin{beamercolorbox}[wd=\columnwidth,hd=#2]{block line#1 top}
\rule{\columnwidth}{#2}
\end{beamercolorbox}
\nointerlineskip%
}
\begin{beamercolorbox}[wd=\columnwidth,ht=2.5ex,dp=1ex,leftskip=2mm,rightskip=2mm]{block title}
\begin{beamercolorbox}[wd=\columnwidth,ht=2.4ex,dp=0.9ex,leftskip=2mm,rightskip=2mm]{block title#1}
\strut\insertblocktitle
\end{beamercolorbox}}
\nointerlineskip
\ifbeamercolorempty[fg]{block line middle}{}{%
\begin{beamercolorbox}[wd=\columnwidth,hd=#2]{block line middle}
\rule{\columnwidth}{#2}
\ifbeamercolorempty[fg]{block line#1 middle}{}{%
\begin{beamercolorbox}[wd=\columnwidth,hd=#3]{block line#1 middle}
\rule{\columnwidth}{#3}
\end{beamercolorbox}
\nointerlineskip}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[wd=\columnwidth,colsep=2mm]{block body}
\usebeamerfont{block body#1}%
\begin{beamercolorbox}[wd=\columnwidth,colsep=2mm]{block body#1}
}
\defbeamertemplate{block end}{lines}[1][1pt]{%
\newcommand{\block@lines@end}[2]{%
\vspace{-0.4ex}%
\end{beamercolorbox}%
\ifbeamercolorempty[fg]{block line bottom}{}{%
\ifbeamercolorempty[fg]{block line#1 bottom}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line bottom}
\rule{\columnwidth}{#1}
\begin{beamercolorbox}[wd=\columnwidth,hd=#2]{block line#1 bottom}
\rule{\columnwidth}{#2}
\end{beamercolorbox}
}%
}
\setbeamertemplate{block begin}[lines]{1pt}{1pt}
\setbeamertemplate{block end}[lines][1pt]
%%%%% block environment:
\defbeamertemplate{block begin}{lines}[2]{\block@lines@begin{}{#1}{#2}}
\defbeamertemplate{block end}{lines}[1]{\block@lines@end{}{#1}}
%%%%% block alerted environment:
\setbeamertemplate{block begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block end}[lines]{0.5pt}
\defbeamertemplate{block alerted begin}{lines}[2]{%
\par\vskip\medskipamount%
\usebeamerfont{block title alerted}%
\IfStrEq{\insertblocktitle}{}{}{%
\ifbeamercolorempty[fg]{block line alerted top}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line alerted top}
\rule{\columnwidth}{#1}
\end{beamercolorbox}
\nointerlineskip%
}
\begin{beamercolorbox}[wd=\columnwidth,ht=2.5ex,dp=1ex,leftskip=2mm,rightskip=2mm]{block title alerted}
\strut\insertblocktitle
\end{beamercolorbox}}
\nointerlineskip
\ifbeamercolorempty[fg]{block line alerted middle}{}{%
\begin{beamercolorbox}[wd=\columnwidth,hd=#2]{block line alerted middle}
\rule{\columnwidth}{#2}
\end{beamercolorbox}
\nointerlineskip}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[wd=\columnwidth,colsep=2mm]{block body alerted}
}
\defbeamertemplate{block alerted end}{lines}[1][1pt]{%
\end{beamercolorbox}%
\ifbeamercolorempty[fg]{block line alerted bottom}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line alerted bottom}
\rule{\columnwidth}{#1}
\end{beamercolorbox}
}%
}
%%%%% block alerted environment:
\setbeamertemplate{block alerted begin}[lines]{1pt}{1pt}
\setbeamertemplate{block alerted end}[lines][1pt]
\defbeamertemplate{block alerted begin}{lines}[2]{\block@lines@begin{ alerted}{#1}{#2}}
\defbeamertemplate{block alerted end}{lines}[1]{\block@lines@end{ alerted}{#1}}
\setbeamertemplate{block alerted begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block alerted end}[lines]{0.5pt}
%%%%% block example environment:
\defbeamertemplate{block example begin}{lines}[2]{%
\par\vskip\medskipamount%
\usebeamerfont{block title example}%
\IfStrEq{\insertblocktitle}{}{}{%
\ifbeamercolorempty[fg]{block line example top}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line example top}
\rule{\columnwidth}{#1}
\end{beamercolorbox}
\nointerlineskip%
}
\begin{beamercolorbox}[wd=\columnwidth,ht=2.5ex,dp=1ex,leftskip=2mm,rightskip=2mm]{block title example}
\strut\insertblocktitle
\end{beamercolorbox}}
\nointerlineskip
\ifbeamercolorempty[fg]{block line example middle}{}{%
\begin{beamercolorbox}[wd=\columnwidth,hd=#2]{block line example middle}
\rule{\columnwidth}{#2}
\end{beamercolorbox}
\nointerlineskip}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[wd=\columnwidth,colsep=2mm]{block body example}
}
%%%%% block example environment:
\defbeamertemplate{block example end}{lines}[1][1pt]{%
\end{beamercolorbox}%
\ifbeamercolorempty[fg]{block line example bottom}{}{%
\nointerlineskip
\begin{beamercolorbox}[wd=\columnwidth,hd=#1]{block line example bottom}
\rule{\columnwidth}{#1}
\end{beamercolorbox}
}%
}
\defbeamertemplate{block example begin}{lines}[2]{\block@lines@begin{ example}{#1}{#2}}
\defbeamertemplate{block example end}{lines}[1]{\block@lines@end{ example}{#1}}
\setbeamertemplate{block example begin}[lines]{1pt}{1pt}
\setbeamertemplate{block example end}[lines][1pt]
\setbeamertemplate{block example begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block example end}[lines]{0.5pt}
%%%%% title page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -50,13 +50,13 @@
\setbeamertemplate{enumerate subitem}[alph] % default, circle, square, ball, alph, arabic, roman
\setbeamertemplate{block begin}[lines]{1pt}{1pt} % default, rounded, lines
\setbeamertemplate{block end}[lines][1pt]
\setbeamertemplate{block end}[lines]{1pt}
\setbeamertemplate{block alerted begin}[lines]{1pt}{1pt} % default, rounded, lines
\setbeamertemplate{block alerted end}[lines][1pt]
\setbeamertemplate{block alerted end}[lines]{1pt}
\setbeamertemplate{block example begin}[lines]{1pt}{1pt} % default, rounded, lines
\setbeamertemplate{block example end}[lines][1pt]
\setbeamertemplate{block example end}[lines]{1pt}
\setbeamertemplate{title page}[leftlines] % leftlines, centerlines
\setbeamertemplate{title page graphic line}[default][1.4ex]

View File

@ -242,19 +242,19 @@
Block with title and content: \texttt{block} environment with title as argument.
\end{block}
\begin{block}{}
Block without title.
Block with empty title.
\end{block}
\begin{alertblock}{Careful!}
Alert block with title and content: \texttt{alertblock} environment with title as argument.
\end{alertblock}
\begin{alertblock}{}
Alert block without title.
Alert block with empty title.
\end{alertblock}
\begin{exampleblock}{Example}
Example block with title and content: \texttt{exampleblock} environment.
\end{exampleblock}
\begin{exampleblock}{}
Example block without title.
Example block with empty title.
\end{exampleblock}
\end{frame}
@ -431,7 +431,7 @@
\begin{frame}[fragile]{Title page authors}
\begin{block}{In preamble}
\verb!\author{Mary Hagedorn\inst{1} \and Walter Heiligenberg\inst{2}}!
\strut\verb!\author{Mary Hagedorn\inst{1} \and Walter Heiligenberg\inst{2}}!
\end{block}
\begin{block}{Author separator}
\verb!\setbeamertemplate{title page author and}[line]!
@ -450,7 +450,7 @@
\begin{frame}[fragile]{Title page institutes}
\begin{block}{In preamble}
\verb!\institute{\inst{1}Somewhere \and \inst{2}Somewhere else}!
\strut\verb!\institute{\inst{1}Somewhere \and \inst{2}Somewhere else}!
\end{block}
\begin{block}{Institutes separator}
\verb!\setbeamertemplate{title page institute and}[line]!
@ -469,7 +469,7 @@
\begin{frame}[fragile]{Title page date}
\begin{block}{In preamble}
\verb!\date[2020]{ICN 2020}!
\strut\verb!\date[2020]{ICN 2020}!
\end{block}
\begin{block}{Font}
\verb!\setbeamerfont{date}{size=\normalsize}!
@ -541,7 +541,18 @@
\end{itemize}
\end{frame}
\begin{frame}{More resources}
\begin{frame}{Beamer templates}
Templates are a powerful method of beamer that allow you to modify
the appearance of your presentation.
\bigskip
Read in the beamer user guide
\begin{itemize}
\item section 16.3 ``Changing the Templates Used for Different Elements of a Presentation''
\end{itemize}
\bigskip
You find a nice summary of common beamer template/color/font names in the
\begin{block}{Beamer appearance cheat sheet}
\url{http://www.cpt.univ-mrs.fr/~masson/latex/Beamer-appearance-cheat-sheet.pdf}
\end{block}