# Avoid title moving when adding subtitle

I am writing a presentation using Latex and beamer. Each frame in my presentation has a title, and may or may not have an additional subtitle.

What bothers me is that when there is the subtitle, the title moves a little up, and that movement is evident (and looks bad) during the slideshow.

\documentclass[14pt]{beamer}
\usetheme{Singapore}
\begin{document}
\begin{frame}
\frametitle{This is a title}
\framesubtitle{This is a subtitle}
This is the text
\end{frame}
\begin{frame}
\frametitle{This is a title}
This is the text
\end{frame}
\end{document}

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – cfr Jan 2 '15 at 15:33
• Have you tried a different theme? This doesn't usually happen... – cfr Jan 2 '15 at 15:34
• This happens with beamer default theme as well. And I like the Singapore theme more than I dislike this movement :) – p91paul Jan 2 '15 at 15:41
• maybe some help here: Keep frame title constant height regardless of content. – barbara beeton Jan 2 '15 at 16:04

You can add blank line if no subtitle is provided.

\documentclass[14pt]{beamer}
\usetheme{Singapore}
\makeatletter
\setbeamertemplate{frametitle}%
{
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\begin{beamercolorbox}[sep=0.3cm,center,wd=\the\@tempdima]{frametitle}
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if@tempswa\else\csname beamer@ftecenter\endcsname\fi%
\strut\insertframetitle\strut\par%
{%
\ifx\insertframesubtitle\@empty%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\strut\par}%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
\fi%
}%
\vskip-1ex%
\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{beamercolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
\frametitle{This is a title}
\framesubtitle{This is a subtitle}
This is the text
\end{frame}
\begin{frame}
\frametitle{This is a title}
This is the text
\end{frame}
\end{document}