4

I'm working on a beamer poster template where I need precise control over all margins. I got rid of most, but the mandatory frame environment(1) introduces a 5.69pt(2) which I cannot find(3).

Observe this example:

\documentclass[final,t]{beamer}

\usepackage[orientation=portrait,size=a4]{beamerposter}
\geometry{margin=0pt}%

\begin{document}%
\begin{frame}[t,plain]%
%\vskip-5.69pt%    <--- magical vertical space
\begin{pgfpicture}%
  \pgfsetlinewidth{1pt}%
  \pgfpathmoveto{\pgfpoint{0pt}{0pt}}%
  \pgfpathlineto{\pgfpoint{2cm}{0pt}}%
  \pgfpathlineto{\pgfpoint{2cm}{-2cm}}%
  \pgfusepath{stroke}%
\end{pgfpicture} with frame%
\end{frame}%
\end{document}%

If we build this and zoom in on the top left corner it looks like this:

vertical frame margin

Now, if we remove the \begin{frame}[t,plain] and \end{frame} we get this:

no vertical margin

Note that the thin black frame around the picture is the page border inserted by my pdf viewer.

I have no idea where the distance between the page border and the pdfpicture comes from. How do I get rid of it?


(1) I can omit the frame, but then I run into trouble with \items in itemize environments. TeX then suddenly claims \item to be an undefined control sequence.

(2) That's the overfull-ness of the \hbox reported by latex when I try to insert a minipage of the dimension [\paperheight]{\paperwidth}.

(3) I tried setting virtually every page margin to 0pt to no avail. Also, the official beamer guide does not mention this margin.

bitmask
  • 1,205

1 Answers1

6

It's a sneaky one: the t option doesn't push everything right to the top, it sets \beamer@frametopskip to 0.2cm plus 0.5\paperheight. (0.2cm are pretty exactly the 5.69pt you observe).

Adding

\makeatletter
\define@key{beamerframe}{t}[true]{% top
  \beamer@frametopskip=0pt %<-- was: .2cm plus .5\paperheight\relax%
  \beamer@framebottomskip=0pt plus 1fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
  \def\beamer@initfirstlineunskip{%
    \def\beamer@firstlineitemizeunskip{%
      \vskip-\partopsep\vskip-\topsep\vskip-\parskip%
      \global\let\beamer@firstlineitemizeunskip=\relax}%
    \everypar{\global\let\beamer@firstlineitemizeunskip=\relax}}
}

seems to fix that issue, at least for the tiny example I tested.

  • 4
    Regrettably, Till hard-coded a lot of fixed distances into beamer: they make my life tricky! – Joseph Wright May 27 '13 at 16:52
  • Thanks for pointing that out Joseph. This reminded me of my problem with another fixed distance in beamer: http://tex.stackexchange.com/questions/110229/beamer-full-width-image-aligned-to-top-with-a-frame-title – Serge Stroobandt May 27 '13 at 19:06