2

I'm using Beamer with a custom template. Among other things, I have re-defined the headline to render the title within a parbox, together with other things that make the template, such as a logo, some horizontal lines drawn with Tikz, etc. Note that I have removed much of these secondary things to come up with the minimal example I provide here and that still reproduces the problem.

And well, the problem is that sometimes when the title is very long and has to be split in two lines, the line separation becomes different through the presentation, which is a very annoying behaviour. Not only that, but sometimes "extra slides" appear. In the particular example I provide, I intend to create two slides, but I get three, although one is empty! The text compiles without problems and I have no idea of what is going on, despite a guess that I'm doing something wrong with that parbox and line breaking.

What might be causing this misbehaviour?

\pdfminorversion=4
\PassOptionsToPackage{draft}{graphicx}
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[utf8]{inputenc}
%\usepackage]{graphicx}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{amsfonts}
\usepackage{textpos}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%THIS THEME DISCARDS THE TITLE IN THE SLIDES, AND USES HEADLINE INSTEAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{frametitle}{}
\providecommand\insertframetitle{}
\setbeamertemplate{headline}{

  \hspace{1cm}
  \fbox{\parbox[][1.1cm][c]{.65\textwidth}{\flushleft\bf\Large\insertframetitle}}

  \begin{textblock*}{100mm}(.8\textwidth,-1.0cm)
    \includegraphics[width=2.0cm]{logo.pdf}
  \end{textblock*}

  \vspace*{0.2cm}

  \hspace*{0.6cm}
  \tikz \fill [] (0,0) rectangle (9.0, 2pt);
}

\begin{document}

\begin{frame}{Climate Reconstructions and Simulations}
  Text text text
\end{frame}

\begin{frame}{What the model does right: synoptic-regional scale connections}
  Text text text
\end{frame}

\end{document}

Slide1 Slide2 Slide3

1 Answer 1

3

Change \providecommand\insertframetitle{} to \providecommand\insertframetitle*{}.

From the beamer user guide:

If you add one star, three things happen. First, the template is put inside a TEX-group, thereby limiting most side effects of commands used inside the template. Second, inside this group the beamer-color named element name is used and the foreground color is selected. Third, the beamer-font element name is also used. This one-starred version is usually the best version to use.


Edit: Thanks to Ignasis comment, I was able to figure it out. Use struts and change the alignment of the content in the parbox.

\providecommand\insertframetitle*{}
\setbeamertemplate{headline}{

  \hspace{1cm}
  \fbox{\parbox[][1.1cm][b]{.65\textwidth}{\flushleft\bf\Large\strut\insertframetitle\strut}}

  \begin{textblock*}{100mm}(.8\textwidth,-1.0cm)
    \includegraphics[width=2.0cm]{logo.pdf}
  \end{textblock*}

  \vspace*{0.2cm}

  \hspace*{0.6cm}
  \tikz \fill [] (0,0) rectangle (9.0, 2pt);
}

\strut is similar to doing \vphantom{}. I looked up the default definition of the frametitle (in beameroutertheme.sty) and found that it contained \strut\insertframetitle\strut. This together with changing from \parbox[][1.1cm][c]... to \parbox[][1.1cm][b]... gives you exactly what you want!

3
  • Thanks, this fixes the spurious third slide. However it still does not fix the different vertical spacing in both slides.
    – Pythonist
    Commented Jun 12, 2015 at 12:13
  • It's due to y, g and p in the second title having depth while no character in the first title has it. Don't know how to fix it yet though..
    – user49901
    Commented Jun 12, 2015 at 12:21
  • 2
    @Onturenio: insert \vphantom{g} after Climate or any other place of title first line
    – Ignasi
    Commented Jun 12, 2015 at 13:48

You must log in to answer this question.

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