2

I don't get how to achieve my desired vertical placement with beamer. Let me give you my MWE first:

\documentclass[t]{beamer}

\usepackage{tikz}

\setbeamertemplate{frametitle}{%
\begin{tikzpicture}%
\node[anchor=north west,fill=red,inner sep=0pt,outer sep=0pt] at (0,0) {\insertframetitle};%
\end{tikzpicture}%
}

\begin{document}
\begin{frame}
\frametitle{This is the title}
Test
\end{frame}

\begin{frame}
%\frametitle{This slide has no title}
Test
\end{frame}
\end{document}

What I want to achieve with the frame title is to place it directly at the top of the slide, but I get a small white skip before my box, so the box is not placed, where I would expect it: enter image description here

The second thing I want to achieve is, that the main content of every content slide is placed in the same box, or the same location, so to speak, no matter if there is a title or not. But as far as I see, if there is no \frametitle, beamer does not make use of the frametitle template and so I don't see a way to achieve this behavior.

Thanks for any suggestions, comments, improvement, or solution proposals!

1

A lot of things are going on here. To remove all white space between the boxes, this would be the appropriate settings:

\documentclass[t]{beamer}

\usepackage{tikz}

\makeatletter
\define@key{beamerframe}{t}[true]{% top
    \beamer@frametopskip=0pt\relax%
    \beamer@framebottomskip=0pt plus 1fill\relax%
    \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
    \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
\makeatother

\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \begin{tikzpicture}%
    \node[anchor=north west,fill=red,inner sep=0pt,outer sep=0pt] at (0,0) {\insertframetitle};%
    \end{tikzpicture}%
    \vspace*{-0.25ex}%
}

\begin{document}
    \begin{frame}
    \frametitle{This is the title}
    \nointerlineskip
    Test
\end{frame}

\begin{frame}
\nointerlineskip
Test
\end{frame}
\end{document}

So basically \vspace{0.25ex} are always introduced through beamer between frame title and content, which we have to get rid of. And the \nointerlineskip is also suppressed between all sorts of vboxes. Then we get minimum spacing.

| improve this answer | |

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.