1

I am still in the development of a theme for beamer and I found something that I can't understand. Usually in beamer there is a template and sometimes there is a parent template, from which you can set multiple templates to the same style at once.

Now let's have a look on the blocks, that come in three flavors:

  1. Regular blocks
  2. Alert blocks
  3. Example blocks

But as far as I see in the manual and in the code, these only share the Parent Beamer-Template blocks which is defined as:

\defbeamertemplateparent{blocks}{block begin,block end,%
  block alerted begin,block alerted end,%
  block example begin,block example end}
{}

All other templates, especially title and body are not linked, as far as I can see.

But given this MWE

\documentclass{beamer}

\setbeamerfont{block title}{size=\scriptsize}
\setbeamerfont{block body}{size=\scriptsize}

\begin{document}
\begin{frame}
\begin{alertblock}{An alert block}
    Shall alert people
\end{alertblock}
\begin{exampleblock}{An example block}
    Shall explain something to people
\end{exampleblock}
\begin{block}{A general block}
    For everything else
\end{block}
\end{frame}
\end{document}

results in:

enter image description here

As you can see in this image, all titles are set to \scriptsize, but only the body of the regular block changes to \scriptsize, the others stay at their natural size.

Why is this? I am asking because I don't see any link here. E.g. the block alerted begin is defined as:

\defbeamertemplate*{block alerted begin}{default}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title alerted}
    \usebeamerfont*{block title alerted}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title alerted}
  {}
  {\ifbeamercolorempty[bg]{block body alerted}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body alerted}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body alerted}%
    \ifbeamercolorempty[bg]{block body alerted}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

So how can it be that the font sizes for alerted and example block titles are changing? What am I overlooking?

1 Answer 1

1

There three environments block, alertblock, and exampleblock

  • use font templates block title, block title alerted, and block title example for their titles respectively, in which the latter two both inherit from the first one, and
  • use font templates block body, block body alerted, and block body example for their bodies, in which there are no inheritance in between them.
% beamerfontthemedefault.sty, lines 81-86
\setbeamerfont{block body}{}
\setbeamerfont{block body alerted}{}
\setbeamerfont{block body example}{}
\setbeamerfont{block title}{size=\large,parent={structure,block body}}
\setbeamerfont{block title alerted}{parent={block title,alerted text}}
\setbeamerfont{block title example}{parent={block title,example text}}

(link to related source lines)

Hence

  • when you change font template block title, it influences titles in each of three environments, while
  • when you change font template block body, it influences title in block environment alone.

The consistent inheritance relation can be achieved by specifying parent=block body for those two font templates, see

\documentclass{beamer}

\setbeamerfont{block body alerted}{parent=block body}
\setbeamerfont{block body example}{parent=block body}

\setbeamerfont{block title}{size=\scriptsize}
\setbeamerfont{block body}{size=\scriptsize}

\begin{document}
\begin{frame}
  \begin{alertblock}{An alert block}
      Shall alert people
  \end{alertblock}
  
  \begin{exampleblock}{An example block}
      Shall explain something to people
  \end{exampleblock}
  
  \begin{block}{A general block}
      For everything else
  \end{block}
\end{frame}
\end{document}

Some source file references (with default theme used):

  • All three environments are defined in beamerbaselocalstructure.sty.
  • block environment calls template block begin, which is defined in beamerinnerthemedefault.sty
  • alertblock and example block environments call templates block alerted begin and block title example respectively, which are both defined in beamerbaseauxtemplates.sty.
  • In each of three templates, one font templates is used when typesetting title, another one for body.
  • All six font templates mentioned above are defined in beamerfontthemedefault.sty.

PS: This might be a design or implementation error of beamer.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .