Dealing with background spacing in different versions of beamer

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{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.

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

\documentclass{beamer}
\setbeamertemplate{background}{\rule{0.8cm}{7cm}}

\usepackage{xpatch}

\makeatletter
\xpatchcmd{\ps@empty}{%
}{%
}{\typeout{patching successful}}{\typeout{patching failure}}
\makeatother

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

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

• 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 '18 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. – samcarter is at topanswers.xyz Feb 26 '18 at 14:06