3

To the answer to question Is it possible to reduce the height of the frame title box in beamer? : If I do so, the frame subtitle disappears. I guessed that only frametitle will be affected. Am I wrong?

And also

\setbeamertemplate{framesubtitle}{%
    \nointerlineskip%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.0ex,dp=0.6ex]{framesubtitle}
        \hspace*{1ex}\insertsubsection: \insertframesubtitle%
    \end{beamercolorbox}%
}

is not effective.

\documentclass{beamer}
\usetheme[hideothersubsections] {Goettingen}
\usecolortheme{spruce}

\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \begin{beamercolorbox}[wd=\paperwidth,ht=6.5ex,dp=0.6ex]{frametitle}
        \hspace*{1ex}\insertframetitle%
    \end{beamercolorbox}%
}
\begin{document}

\section{Sec one}
\subsection{OneOne}
\begin{frame}{Frame Number 1}{Frame 1}
{1}
\end{frame}
\subsection{OneTwo}
\begin{frame}{Frame Number 2}
{Frame 2}

{2}
\end{frame}
\section{Sec two}
\subsection{TwoOne}
\begin{frame}{Frame Number 3}

{Frame 3}
{3}
\end{frame}
\end{document}
2
  • 1
    Your redefinition of the frametitle template does not include the frame subtitle. The frame subtitle is inserted with the macro \insertframesubtitle.
    – user94293
    Commented Aug 10, 2016 at 17:05
  • @ user94293 So you mean theres is no \setbeamertemplate{framesubtitle}?
    – katang
    Commented Aug 10, 2016 at 18:28

1 Answer 1

2

I guess your confusion is my fault. In the answer you reference no subtitles where involved, so I wrote this easy to understand solution. But in case of subtitles the problem is much more complicate, as the height of the box has to be adjusted if a framesubtitle is present or not. But instead of inventing the wheel again, the following is a tiny modification from the default frametitle-template. The change is marked with <- changed from 1ex !!!

\documentclass{beamer}

\mode<presentation>
{
  \usetheme{Copenhagen}
  \useoutertheme[footline=institutetitle]{miniframes}
}

\makeatletter
\setbeamertemplate{frametitle}{%
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,left,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1.7ex%  <-  changed from 1ex !!!
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    \strut\insertframetitle\strut\par%
    {%
        \ifx\insertframesubtitle\@empty%
        \else%
        {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
        \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
}
\makeatletter

\usepackage{etoolbox}

\begin{document}
\section{Foo}
\subsection{Bar}

\begin{frame}{Baz}
  Foobar
\end{frame}

\begin{frame}{Baz}{djh}
    Foobar
\end{frame}

\end{document}

enter image description here

You must log in to answer this question.

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