3

How can the line-spacing inside the headline-template be adjusted?

Consider the following code, if it is used inside a normal frame I can control the line-spacing by modifying the baselineskip in \fontsize{size}{baselineskip}.

But if I try to use it within the headline-template, changing the baselineskip does not make any difference.

\documentclass[t]{beamer}

% Fonts
\setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}

% Headline
\setbeamertemplate{headline}{%
    \begin{minipage}[b][0mm][t]{85mm}%
        \usebeamerfont{title}{%
            \inserttitle
        }%
    \end{minipage}%     
}

\title{Really long title to test all the three possible lines is not yet long enough but know}

  \begin{document}

    \begin{frame}[t]
    \end{frame}

    \setbeamertemplate{headline}{}
    \begin{frame}[t]
            \begin{minipage}[b][0mm][t]{85mm}%
                \usebeamerfont{title}{%
                    \inserttitle
                }%
            \end{minipage}% 
    \end{frame}

  \end{document}

enter image description here


I also tried the answer https://tex.stackexchange.com/a/66208/36296, but the line-spacing remains unchanged.

\documentclass[t]{beamer}

\def\beamer@typesetheadorfoot#1{% typeset the head or footline
    {\parskip0pt %\offinterlineskip%
        \hbox{%
            \hskip-\Gm@lmargin%
            \hbox{%
                \vbox{%
                    \@tempdima=\textwidth%
                    \textwidth=\paperwidth%
                    \hsize=\textwidth%
                    \def\\{,}%
                    \usebeamertemplate***{#1}%
                }}%
                \hskip-\Gm@rmargin%
            }}\hfil%
        }


% Fonts
\setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}

% Headline
\setbeamertemplate{headline}{%
    \begin{minipage}[b][0mm][t]{85mm}%
        \usebeamerfont{title}{%
            \linespread{3.}
            \inserttitle \par
        }%
    \end{minipage}%     
}

\title{Really long title to test all the three possible lines is not yet long enough but know}

  \begin{document}

    \begin{frame}[t]
    \end{frame}

    \setbeamertemplate{headline}{}
    \begin{frame}[t]
            \begin{minipage}[b][0mm][t]{85mm}%
                \usebeamerfont{title}{%
                    \inserttitle
                }%
            \end{minipage}% 
    \end{frame}

  \end{document}

1 Answer 1

4

Before inserting a headline template beamer issues \offinterlineskip which has the effect of preventing the change of baselines you wish to achieve. You can restore the usual line spacing behaviour with \normalbaselines:

Sample output

\documentclass[t]{beamer}

% Fonts
\setbeamerfont{title}{series=\bfseries,size*={16}{24}}

% Headline
\setbeamertemplate{headline}{%
   \begin{minipage}[b][0mm][t]{85mm}%
     \normalbaselines
     \usebeamerfont{title}
     \inserttitle
   \end{minipage}
}

\title{Really long title to test all the three possible lines is not
yet long enough but know}

\begin{document}

\begin{frame}[t]
\end{frame}

\end{document}

The beamer command that typesets the header is \beamer@typesetheadorfoot defined in beamerbasecomponents.sty.

2
  • Tanks a lot for your quick solution! Works perfect! Commented May 20, 2014 at 10:56
  • \offinterlineskip what a useful tag/command ! fixed the problem immediately
    – Vass
    Commented Feb 15, 2017 at 18:41

You must log in to answer this question.

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