I have a macro taken from this question that places a logo on all frames following \placelogotrue and on no frame following \placelogofalse. It largely works as intended, but it causes headline and foodline of the frames with the logo to be slightly shifted to the left, leaving some spurious whitespace (compare the upper image footline with the lower image headline in the pictures below):
Here's the code to reproduce:
% !TeX program = lualatex
\documentclass{beamer}
\usetheme{Malmoe}
% graphics
\DeclareGraphicsExtensions{.jpg,.jpeg,.png,.pdf}
% TikZ/PGF
\usepackage{pgf}
% customization of beamer style
\setbeamertemplate{bibliography item}{}
\setbeamertemplate{navigation symbols}{}
% define logo
\newif\ifplacelogo
\placelogotrue
\logo{\ifplacelogo\pgfputat{\pgfxy(-0.1,7.72)}{\pgfbox[right,base]{%
\includegraphics[height=7mm]{example-image-a}
}}\fi}%
% define custom headline
\setbeamertemplate{headline}
{%
\leavevmode%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
\hbox to .5\paperwidth{\hfil\insertsectionhead\hfil}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
\hbox to .5\paperwidth{\hfil\insertsubsectionhead\hfil}
\end{beamercolorbox}%
}
\begin{document}
\begin{frame}
\end{frame}
\placelogofalse
\begin{frame}
\end{frame}
\end{document}
Why is that? I would have expected \pgfputat not to alter spacing on the frame at all...
I'm compiling with LuaLaTeX Version 1.12.0 (TeX Live 2020) on Arch Linux.





rlapcan be used if the logo is on the left.llapandrlapcreate boxes of zero width and place their content to the left and right of it, respectively, over*lap*ping anything that's already there. – Betohaku Feb 24 '21 at 16:01