I am trying to rebuild an existing PowerPoint template with beamer and for this I need precise vertical positioning of the content of a beamer frame. I already found out, how to deal with this for the headline
and footline
as well as for the frametitle
, but how is it for the content? I have the following MWE:
\documentclass[t]{beamer}
\usepackage{tikz}
\setbeamertemplate{frametitle}{\nointerlineskip\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-2cm,minimum height=1cm,fill=green]{frametitle};\end{tikzpicture}}
\setbeamertemplate{footline}{\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-2cm,minimum height=1cm,fill=yellow]{footline};\end{tikzpicture}}
\begin{document}
\begin{frame}
\nointerlineskip\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth,minimum height=1cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}
\frametitle{~}
\nointerlineskip
\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth,minimum height=1cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}
\frametitle{~}
\nointerlineskip
\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth,minimum height=\paperheight-2cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}[c]
\frametitle{~}
\nointerlineskip
\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth,minimum height=\paperheight-2cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\end{document}
What I want to achieve is, that the content starts right at the top with no frametitle or just at the lower edge of the frametitle with the [t]
option and that everything is centered to the area between frametitle
and footline
, so when I insert full size images they shall fill the full area instead of having whitespace at the top.
So what I want can be illustrated with this drawing of mine:
Instead my result looks like this:
How can I achieve to have no vertical white spaces between content and frametitle or content and upper edge? I prefer to be able to do this through adding commands to my theme. Bonus question: Where in beamer can I find the definitions of the whitespaces? And of course I am only looking for vertical alignment, it's clear the the boxes have the wrong width.
After some more investigation, this is what I was looking for, now comes part two of my question
So after playing around and looking into the beamer source, I found how and where the placement options are configured and here is what I actually want:
\documentclass{beamer}
\usepackage{tikz}
\makeatletter
\define@key{beamerframe}{MYc}[true]{% centered
\beamer@frametopskip=0pt plus 1fill\relax%
\beamer@framebottomskip=0pt plus 1fill\relax%
\beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
\beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
}
\define@key{beamerframe}{MYt}[true]{% top
\beamer@frametopskip=0pt\relax%
\beamer@framebottomskip=0pt plus 1fill\relax%
\beamer@frametopskipautobreak=\beamer@frametopskip\relax%
\beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
\define@key{beamerframe}{MYb}[true]{% bottom
\beamer@frametopskip=0pt plus 1fill\relax%
\beamer@framebottomskip=0pt\relax%
\beamer@frametopskipautobreak=\beamer@frametopskip\relax%
\beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
\makeatother
\setbeamertemplate{frametitle}{\nointerlineskip\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-2cm,minimum height=1cm,fill=green]{frametitle};\end{tikzpicture}}
\setbeamertemplate{footline}{\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-2cm,minimum height=1cm,fill=yellow]{footline};\end{tikzpicture}}
\begin{document}
\begin{frame}[MYt]
\nointerlineskip
\hspace{1cm}\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-1cm,minimum height=1cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}[MYt]
\frametitle{~}
\vspace*{-0.25em}
\nointerlineskip
\hspace{1cm}\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-1cm,minimum height=1cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}[MYt]
\frametitle{~}
\vspace*{-0.25em}
\nointerlineskip
\hspace{1cm}\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-1cm,minimum height=\paperheight-5cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}[MYc]
\frametitle{~}
\vspace*{-0.25em}
\nointerlineskip
\hspace{1cm}\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-1cm,minimum height=\paperheight-5cm,fill=orange]{content};\end{tikzpicture}
\end{frame}
\begin{frame}[MYb]
\frametitle{~}
\vspace*{-0.25em}
\nointerlineskip
\hspace{1cm}\begin{tikzpicture}\node[inner sep=0pt,outer sep=0pt,minimum width=\textwidth-1cm,minimum height=\paperheight-5cm,fill=orange]{content};\end{tikzpicture}
\vspace*{-1.3\baselineskip} \end{frame} \end{document}
But now I have two problems, the first one is, that if I leave the code between \makeatletter
and \makeatother
into my theme, it will only be available for the frame commands, but I would like to call \documentclass[MYt]{beamer}
. Or the other way around, can I make one of the options the standard behaviour of all frames after the theme has been loaded, so that I can avoid the [MYt]
after each frame?
And the second problem is, can I put the \vspace*{-0.25em}\nointerlineskip
that I need for every slide with frametitle and the \nointerlineskip
that I need for every slide without frametitle somewhere that it is called automatically and the user does not have to take care? The same applies for the \vspace*{-1.3\baselineskip}
at the bottom, but it is more important for [MYt]
and [MYc]
on slides with and without a frametitle.