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][1]][1]
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]: https://i.stack.imgur.com/7cU0Q.png
Top Answer
samcarter
The easiest approach to place the frametitle at the very top of the page is to position it relative to the page:
```
\documentclass[t]{beamer}
\usepackage{tikz}
\makeatletter
\setbeamertemplate{frametitle}{%
\begin{tikzpicture}[remember picture, overlay]%
\node[anchor=north west,fill=red,inner sep=0pt,outer sep=0pt, xshift=\Gm@lmargin] at (current page.north west) {\insertframetitle};%
\end{tikzpicture}%
}
\makeatother
\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}
```
![Screen Shot 2020-07-05 at 14.08.57.png](/image?hash=e4cef943693477177c3fc731d04182570ecbe2db3b2822a790991af749f34d0c)