# Remove gap between frametitle and body

I wanted to add a logo at the top right corner of my frames so I edited the frametitle with \addtobeamertemplate{frametitle} and added the logo using a TikZ \node (as explained in this answer), like this:

\addtobeamertemplate{frametitle}{}{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=2pt] at (current page.north east) {\includegraphics[height=0.8cm]{example-image}};
\end{tikzpicture}}


The problem is that this modification adds an additional space between the frametitle and the body of the frame, thus wasting very valuable space.

This is how my frame looks before adding the \addtobeamertemplate{frametitle} block:

And this is how it looks after adding it (notice the wider gap):

How can I remove that gap?

Here is my MWE:

\documentclass{beamer}

\usepackage{tikz}

\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=2pt] at (current page.north east) {\includegraphics[height=0.8cm]{example-image}};
\end{tikzpicture}}

\begin{document}

\begin{frame}
\frametitle{Frame title}
\includegraphics[height=\textheight]{example-image}
\end{frame}

\end{document}


An overlay tikzpicture doesn't occupy space but it is nevertheless a box and so one must be careful where to insert it. In vertical mode (like here) it will create an additional line. I would use the footline template (and its second argument) to inject the logo:

\documentclass{beamer}

\usepackage{tikz}

\leavevmode\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=2pt] at (current page.north east) {\includegraphics[height=0.8cm]{example-image}};
\end{tikzpicture}\ignorespaces% \ignorespaces needed because of spurious space in the template
}{}

\begin{document}

\begin{frame}
\frametitle{Frame title}
\includegraphics[height=\textheight]{example-image}

\end{frame}

\end{document}