# Why \nointerlineskip if background of Beamer-color frametitle is empty?

I'm trying to read the source of Beamer default outer theme (the file beamerouterthemedefault.sty). In line 144 there is this code:

\defbeamertemplate*{frametitle}{default}[1][left]
{
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
% more things here
}


My question is simple: what is the purpose of this \nointerlineskip, and how is this connected to the background of the frametitle Beamer-color?

Edit: I checked on the repository on Bitbucket, and couldn't find any hints there (I hoped for some enlightening commit message found through "blame" - but no, nothing.)

-
\nointerlineskip is useful, for example, when one wants to place two boxes (in vertical mode) one exactly above the other, with no glue between them. – egreg Mar 13 '13 at 9:52
@egreg: I know that, but the frametitle seems to be at the very top of the page anyway. After asking the question, I gave it a little thinking, and I have two hypotheses: (1) maybe \nointerlineskip suppresses \topskip? (I don't think so.) (2) maybe beamercolorbox puts some kind of a box above its contents (probably yes, though it'll take some time for me to analyse its code). – mbork Mar 13 '13 at 10:00
After skimming through beamer sources, it seems that hypothesis (2) is very probable. If nobody wants to answer this question, I'll probably be able to answer it myself in some time;)... – mbork Mar 13 '13 at 10:06
@mbork Care to answer here? (Till left us basically no notes on lots of odd things in beamer, and that makes my life 'interesting' whenever I try to fix something.) – Joseph Wright Aug 10 '13 at 9:23
@mbork Please take a look at this and add an answer if you've got one – Joseph Wright Sep 6 '14 at 21:43

In the definition of beamer@frameslide environment in beamerbaseframe.sty, there is an empty vbox above the frametitle:

\ifx\beamer@frametitle\@empty%
\setbox\beamer@frametitlebox=\box\voidb@x%
\else%
\setbox\beamer@frametitlebox=\vbox{
\vbox{}%
{\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}%
}%
\fi%


Now assume we remove \nointerlineskip line from the template code for frametitle, then there will be vertical space between the empty vbox and frametitle:

.\vbox(0.0+0.0)x0.0
.\glue(\lineskip) 1.0
.\hbox(19.136+0.0)x324.79259


The vertical space comes from \lineskip, since by default the height of the frametitle box is larger than \baselineskip.

When the backgoround color of the frametitle is empty, this extra vertical space is usually unobtrusive. But if the background color exists, and furthermore if the headline also exists, this space looks redundant：

To get rid of this extra space, we may also patch beamer@frameslide, removing the extra vbox{}.

\documentclass{beamer}
\usepackage{xpatch}
\usetheme{Copenhagen}
\begin{document}

\section{First Section}

\begin{frame}
\frametitle{Default frame title}
\end{frame}

\makeatletter
% remove \nointerlineskip in frametitle template
\xpatchcmd{\beamer@@tmpl@frametitle}{\nointerlineskip}{\relax}{}{}
\makeatother

\begin{frame}
\frametitle{Frame title without nointerlineskip}
\end{frame}

\makeatletter
% undo the above patch
%\xpatchcmd{\beamer@@tmpl@frametitle}{\relax}{\nointerlineskip}{}{}
% patch in another way: modify beamer@frameslide environment
\xpatchcmd{\endbeamer@frameslide}{\vbox{}}{}{}{}
\makeatother

\begin{frame}
\frametitle{Frame title without empty vbox}
\end{frame}

\end{document}

-