Tx · LaTeX & TikZ

Beamer Copenhagen: How to Change the Headline Height?

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify the header

    Copenhagen’s top navigation is a Beamer headline template, not the ordinary page-style header.

  2. 2. Edit the template

    Set the headline template and adjust the height and depth of its beamercolorboxes.

  3. 3. Check the result

    Compile and inspect every slide type; navigation content must fit inside the revised boxes.

In a Beamer presentation using the Copenhagen theme, the colored navigation bars at the top of each slide are the headline. They are built by Beamer templates, so changing LaTeX’s \headheight is generally not the way to make those bars taller or shorter.

The dependable approach is to redefine the headline and set the dimensions of its color boxes. The example below keeps Copenhagen’s section and subsection navigation in its usual side-by-side layout and makes both headline boxes taller.

Why \headheight usually does not help

In ordinary LaTeX page styles, \headheight is a length associated with the running header area. Beamer handles its headline separately: the headline template creates the material shown above the frame, and its content contributes to the space reserved for that template.

Copenhagen uses Beamer’s navigation-style headline. Its visible height comes from the ht (height) and dp (depth below the baseline) options on the beamercolorbox elements in that template. Increasing \headheight may change a page-style setting or affect a package that reads it, but it does not normally change those boxes.

Adjust Copenhagen’s headline boxes

This complete example reproduces Copenhagen’s usual side-by-side section and subsection navigation, with taller boxes. It requires only the Beamer class; no additional package is needed.

\documentclass{beamer}
\usetheme{Copenhagen}

% Replace the headline and set the dimensions of its two boxes.
\setbeamertemplate{headline}{%
  \leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.5ex,dp=1.5ex]{section in head/foot}%
      \insertsectionnavigation{.5\paperwidth}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=3.5ex,dp=1.5ex]{subsection in head/foot}%
      \insertsubsectionnavigation{.5\paperwidth}%
    \end{beamercolorbox}%
  }%
}

\begin{document}
\section{Introduction}
\subsection{First topic}
\begin{frame}{A frame}
  The headline boxes are taller.
\end{frame}
\end{document}

The first beamercolorbox draws the section-navigation box on the left; the second draws the subsection-navigation box on the right. In each, ht sets the height above the baseline and dp sets the depth below it. Change these values to suit the font size and appearance you want. For instance, increase ht to add vertical room above the baseline, or dp to add room below it.

Because this code replaces the entire headline template, it also means you are responsible for what appears there. If you only want to add a small amount of space without changing the navigation boxes, you can instead append vertical space to the existing template:

\addtobeamertemplate{headline}{}{\vskip 2pt}

This adds space after the current headline content. It is a quick adjustment, but redefining the color boxes gives you more direct control over their dimensions.

If you have a \headheight warning

First identify which package reports it. A warning from fancyhdr, for example, refers to the page-style header that package manages; it is distinct from Copenhagen’s Beamer headline. If you really are using a page-style package that requires a larger header area, set the length it recommends, such as \setlength{\headheight}{15pt}, in the preamble. Use the value in the warning rather than treating 15 pt as a universal setting.

For a normal Beamer presentation, avoid loading or configuring fancyhdr just to resize the Copenhagen navigation bars. Adjust the Beamer template instead. Also avoid changing \topmargin to compensate: that changes page layout and can create unwanted spacing without fixing the headline itself.

Common mistakes

  • Changing \headheight and expecting Copenhagen’s bars to grow. The headline template controls those bars; \headheight is not their sizing control.
  • Changing only ht. The box also has depth. Adjust both if the text looks cramped or vertically misaligned.
  • Making a box too short. If the navigation text or theme font exceeds the specified dimensions, it may look clipped or overlap. Compile and inspect slides with long section names, not just a short example.
  • Replacing the headline without preserving navigation. A new template replaces the existing one. Include the navigation commands you still want, or use the append method for a minor spacing change.

If your goal is to change the headline’s content or arrangement rather than its height, edit the same template and its navigation commands; \headheight is still not the relevant control.

References

  1. The beamer class package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.