8

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}

enter image description here

5

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}

enter image description here

  • 1
    I am still looking for the mystery length;\vspace{\topskip} also eats too much space. – Serge Stroobandt May 15 '13 at 18:01
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.