3

In some versions of the beamer class (e. g. the one in TeX Live 2016, v3.36), space with the height of the footline is inserted in the background layer before the background content for plain frames. However, in newer versions of beamer (e. g. v3.42 from TeX Live 2017), this doesn’t happen anymore and background content starts at the very top of the frame. I think this may be caused by commit f6e1d8e in beamer, so it doesn’t look like there is an easy user-side hook to control this.

As an illustration of the issue, consider the first page of the following minimal document:

\documentclass{beamer}
\setbeamertemplate{headline}{\color{red}\rule{\paperwidth}{1cm}}
\setbeamertemplate{background}{\rule{0.8cm}{7cm}}

\begin{document}
    \begin{frame}[plain]
        plain frame
    \end{frame}

    \begin{frame}
        normal frame
    \end{frame}
\end{document}

My problem is that I provide a beamer theme/template which uses a full-page background image on the title slide, so I’m using a plain frame as the title slide to hide the other frame parts. However, depending on the beamer version, the background image may be shifted down by the headline height.

How can I account for this shift depending on the version of beamer? TeX Live 2016 is pretty recent and I can’t simply tell all my users to upgrade their TeX installations (they may be using an LTS release of a Linux distribution or simply not have administrator privileges on their machines), so I’m looking for a LaTeX solution.

1 Answer 1

3

You could use xpatch to add the bug fix to older versions:

\documentclass{beamer}
\setbeamertemplate{headline}{\color{red}\rule{\paperwidth}{1cm}}
\setbeamertemplate{background}{\rule{0.8cm}{7cm}}

\usepackage{xpatch}

\makeatletter
\xpatchcmd{\ps@empty}{%
    \vbox{\hbox{\hskip-\Gm@lmargin\raise\headheight\box\beamer@tempbox\box\@tempboxa}\hfil}%
}{%
    \vbox{\hbox{\hskip-\Gm@lmargin\raise\headheight\box\beamer@tempbox\raise\headheight\box\@tempboxa}\hfil}%
}{\typeout{patching successful}}{\typeout{patching failure}}
\makeatother

\begin{document}
    \begin{frame}[plain]
        plain frame
    \end{frame}

    \begin{frame}
        normal frame
    \end{frame}
\end{document}
2
  • Hmm… Is there a way to make this safer by also checking for the beamer version number or date? Something like \ifnum\VERSION<X…? (I tend to be paranoid about edge cases, especially in LaTeX.)
    – Socob
    Feb 26, 2018 at 12:31
  • @Socob You could use \@ifclasslater, however this is also not fail safe as it would need a recent enough kernel version which includes this feature. I'd simply patch. If the package version used includes this bug, it will be corrected, if it does not it will not be patched. Feb 26, 2018 at 14:06

You must log in to answer this question.

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