# Beamer: Full width image, aligned to top with a frame title

I would like to include a full width image, aligned to the top of a frame with a frame title. The problem is, I cannot get rid of a line of white space between the orange frame title header and the lion image.

\documentclass[t]{beamer}
% Frames are 128x96mm and top-aligned by default.

% Calculate with \sidebarwidth
\usepackage{calc}
\newlength{\sidebarwidth}

% Theme
\setlength{\sidebarwidth}{28mm}
\usetheme[height=16mm, right, width=\sidebarwidth]{Goettingen}
% Hence, a full frame image is 100x80mm
\usecolortheme{crane}

% Include full-width graphics
\usepackage{graphicx}
\newcommand{\includefullwidthgx}[2][]{%
\noindent\makebox[\columnwidth]{\includegraphics[width=128mm-\sidebarwidth, #1]{#2}}%
}%

\begin{document}
\begin{frame}
\frametitle{frame title text}
\includefullwidthgx{lion.jpg}
\end{frame}
\end{document}


• What a beautiful picture for TeX site! :-) Apr 23, 2013 at 11:59
• That was on purpose! It is a Wikimedia Commons image. Here is the link to the original: commons.wikimedia.org/wiki/File:Lion_in_masai_mara.jpg Apr 23, 2013 at 12:03
• If I'm not wrong, when you fix only one option width (or height) for includegraphics, option keepaspectratio is true by default, so image keeps its original proportions. If you want to cover all this area select another image or also fix option height. Apr 23, 2013 at 12:19
• Apr 23, 2013 at 12:23
• @Ignasi: I am aware of that, but I do not want to lose the white space below the picture. Apr 23, 2013 at 12:24

I helped myself out by adding a \vspace{-9.5pt}. The value seems not to change with standard themes. Nor does it matter whether a subtitle is present in the header. Still, I find it a non-general, somewhat sub-optimal solution. Who does better?

\documentclass[t]{beamer}
% Frames are 128x96mm and top-aligned by default.

% Calculate with \sidebarwidth etc.
\usepackage{calc}
\newlength{\sidebarwidth}

% Theme
\setlength{\sidebarwidth}{28mm}
\usetheme[height=16mm, right, width=\sidebarwidth]{Goettingen}
% Hence, a full frame image is 100x80mm
\usecolortheme{crane}

% Include full-width graphics
\usepackage{graphicx}
\newcommand{\includefullwidthgx}[2][]{%
\vspace{-9.5pt}
\noindent\makebox[\columnwidth]{\includegraphics[width=128mm-\sidebarwidth, #1]{#2}}%
}%

\begin{document}
\begin{frame}
\frametitle{Sub-optimal solution.}
\framesubtitle{Anyone does better?}
\includefullwidthgx{lion.jpg}
\end{frame}

\end{document}


• I am still looking for the mystery length;\vspace{\topskip} also eats too much space. May 15, 2013 at 18:01

The vertical space you see is composed of two parts, both of which are in some way specified in the beamerbaseframe.sty:

1. If the frametitle is non-empty, beamer appends a \vskip0.25em to the \beamer@frametitlebox (line 122). This is hard-coded but can be avoided by not specifying a frametitle.

2. In line 142 or 144, beamer issues a \vskip\beamer@frametopskip(autobreak). This skip is set depending on the vertical frame alignment (t/c/b); for t (top) it is 0.2cm plus…. It is set in the \define@key{beamerframe}{t}[true] (line 258) and can be changed by modifying or overwriting this \define@key.

These two components add up to the vertical space in your example. Beamer does not offer a straightforward way of getting rid of it, so probably it thinks it is a good thing.