5

The following MCE points out that, with some beamer's themes, the frame titles are vertically:

  • top aligned in presence of (possibly invisible) frame subtitles,
  • centered in absence of frame subtitles.

How could I get the frame titles top aligned in all cases?

\documentclass[9pt]{beamer}

\usetheme{PaloAlto}

\begin{document}

\begin{frame}
  \frametitle{Top aligned frame title if subtitle}
  \framesubtitle{Frame subtitle}
\end{frame}

\begin{frame}
  \frametitle{Top aligned frame title if (possibly invisible) subtitle}
  \framesubtitle{\mbox{}}
\end{frame}

\begin{frame}
  \frametitle{Vertically centered frame title if no frame subtitle}
\end{frame}

\end{document}

enter image description here

Denis Bitouzé
  • 9,652
  • 4
  • 27
  • 85
  • 1
  • Your tests are not complete: try with very long titles and/or subtitles. The title (and subtitle) are just stacked in a vertically centered box. 2) Each theme (or outer theme) chooses its own rules.
  • – Paul Gaborit Feb 28 '17 at 06:32
  • 1
    Article mode seems to behave the opposite, see http://tex.stackexchange.com/questions/354106/beamer-v3-40-interprets-empty-frame-titles-differently-than-previous-versions/354108 , maybe you can borrow some code from beamerarticle? – samcarter_is_at_topanswers.xyz Feb 28 '17 at 09:00
  • @PaulGaborit 1) I don't see your point with with very long titles and/or subtitles: they always look ugly if not alone (and don't look worse with samcarter's solution, except in the case of multilined frame title and no frame subtitle: nothing's perfect ;) 2) Indeed: that's the reason I specified "with some beamer's theme[s]". – Denis Bitouzé Feb 28 '17 at 20:07
  • 1
    The PaloAlto theme uses the sidebar outer theme: The frame title is vertically centered in a rectangular area at the top that always occupies the same amount of space in all frames. (beamer user guide, p.264). So, the frame title is not "top aligned in presence of (possibly invisible) frame subtitles" (example: a long title with two lines and a subtitle is not top aligned with a short title with a subtitle). – Paul Gaborit Feb 28 '17 at 22:23
  • @PaulGaborit IMHO, this sentence of the documentation is not precise enough: it doesn't tell what's the behavior of the frame subtitle area and the relative behaviors of the frame title and subtitle areas in case of subtitle. – Denis Bitouzé Mar 01 '17 at 07:49
  • 1
    @DenisBitouzé When the frame title and subtitle are to be typeset, this template is invoked with the beamer-color and -font frametitle set. This template is not invoked when the commands \frametitle or \framesubtitle are called. Rather, it is invoked when the whole frame has been completely read. Till then, the frame title and frame subtitle text are stored in a special place. This way, when the template is invoked, both inserts are setup correctly. The resulting TEX-box is then magically put back to the top of the frame. (beamer user guide, p.73) – Paul Gaborit Mar 01 '17 at 08:19