I'm trying to set up automatic frame titles and subtitles as follows:
- If a frame has a title or subtitle set (even to
{}, it is used). - If subsection title is not empty, use section title as a frame subtitle, and subsection title as a frame title.
- Otherwise, use section title as a frame title, frame does not have a subtitle.
Here is a code that I tried (does not follow the first rule above, taken from Automatic frame titles and subtitles). It does not work as expected — with \subsection*{} frame title is empty and frame subtitle is set to section title.
\addtobeamertemplate{frametitle}{
\ifx\insertsubsection\empty
\let\insertframetitle\insertsectionhead
\else
\let\insertframetitle\insertsubsectionhead
\fi
}{}
\addtobeamertemplate{frametitle}{
\ifx\insertsubsection\empty
\else
\let\insertframesubtitle\insertsectionhead
\fi
}{}
\makeatletter
\CheckCommand*\beamer@checkframetitle{%
\@ifnextchar\bgroup\beamer@inlineframetitle{}}
\renewcommand*\beamer@checkframetitle{%
\global\let\beamer@frametitle\relax\@ifnextchar%
\bgroup\beamer@inlineframetitle{}}
\makeatother
Any hints?
