4

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

1 Answer 1

2

You can add blank line if no subtitle is provided.

\documentclass[14pt]{beamer}
\usetheme{Singapore}
\makeatletter
\setbeamertemplate{frametitle}%
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \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}
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .