2

I am trying to remove the space between the headline and frame title as shown in the image below.

enter image description here

The relevant part of my code is:

\documentclass[t]{beamer}
\useinnertheme{rectangles}
\usecolortheme{whale}

\usepackage{natbib, amsmath, bm, tikz, mathrsfs, tabularx, booktabs, csvsimple, siunitx, graphicx}
\usetikzlibrary{positioning, fit, arrows.meta, shapes, calc}

\setbeamertemplate{headline}{
\leavevmode%
  \begin{beamercolorbox}[wd=.15\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{palette primary}{\insertsectionhead}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.85\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{subsection in head/foot}{\insertsubsectionhead}
  \end{beamercolorbox}%
}

\setbeamertemplate{frametitle}{
\begin{beamercolorbox}[wd=\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{section in head/foot}{\insertframetitle}
\end{beamercolorbox}%
}

\setbeamertemplate{footline}{
  \begin{beamercolorbox}[wd=\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt, rightskip=10pt]{palette tertiary}{\insertshorttitle \hfill \insertframenumber/\inserttotalframenumber}
  \end{beamercolorbox}%
}

% get rid of nav bar
\setbeamertemplate{navigation symbols}{}

\title{Using Pricing Data and News Headlines to Predict the Direction of Stock Returns}
\author{Jack Dry}
\date{}

\begin{document}

\begin{frame}[plain]
\titlepage
\end{frame}

\section{Introduction}
\begin{frame}{Outline}
\tableofcontents[currentsection]
\end{frame}

\end{document}

If anyone could help me, I'd be very grateful!

  • Perhaps cheat and add something like \vskip-2pt at the end of headline – daleif Apr 3 at 10:59
3

If you look into the default definition of frametitles in beamer themes, you will see \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}% which will remove the space between lines if the frametitle has a background colour.

\documentclass[t]{beamer}
\useinnertheme{rectangles}
\usecolortheme{whale}

\usepackage{natbib, amsmath, bm, tikz, mathrsfs, tabularx, booktabs, csvsimple, siunitx 
%graphicx
}
\usetikzlibrary{positioning, fit, arrows.meta, shapes, calc}

\setbeamertemplate{headline}{%
\leavevmode%
  \begin{beamercolorbox}[wd=.15\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{palette primary}%
    \insertsectionhead%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.85\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{subsection in head/foot}%
    \insertsubsectionhead%
  \end{beamercolorbox}%
}

\setbeamertemplate{frametitle}{%
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\begin{beamercolorbox}[wd=\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt]{section in head/foot}%
    \insertframetitle%
\end{beamercolorbox}%
}

\setbeamertemplate{footline}{
  \begin{beamercolorbox}[wd=\paperwidth, ht=2.5ex, dp=1ex, leftskip=10pt, rightskip=10pt]{palette tertiary}{\insertshorttitle \hfill \insertframenumber/\inserttotalframenumber}
  \end{beamercolorbox}%
}

% get rid of nav bar
\setbeamertemplate{navigation symbols}{}

\title{Using Pricing Data and News Headlines to Predict the Direction of Stock Returns}
\author{Jack Dry}
\date{}

\begin{document}

\begin{frame}[plain]
\titlepage
\end{frame}

\section{Introduction}
\begin{frame}{Outline}
\tableofcontents[currentsection]
\end{frame}

\end{document}
  • 1
    I know, I'm trying to design a theme right now. There are many things in beamer that are not that easy to understand, or is even not documented. So looking in the sources is easier than trying to read the manual – daleif Apr 3 at 11:12
  • 1
    @daleif Things are also much easier to find in the sources than in the documentation. – user36296 Apr 3 at 11:14
  • grep + the emacs client feature is a life saver. – daleif Apr 3 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.