[Tex/LaTex] Automatic frame titles and subtitles

beamer

Is there a way to automatically use the section name as the frame title and the subsection name as the frame subtitle?

I think this question is related, but when I tried to hack that solution to change the substitution from \insertsubsectionhead to \insertsectionhead as follows, my frame title simply disappeared:

\addtobeamertemplate{frametitle}{
   \let\insertframetitle\insertsectionhead}{}

(later)

\section{Introduction}

\begin{frame}
   \frametitle{}

. . . 

Does it matter where that template manipulation appears? I have it in my preamble right after I choose my theme.

Bottom line: I have no idea how these internals work, so worst case I'll just continue duplicating the sections and subsection names into the frame titles and subtitles. I like the idea of keeping that connection back to the outline in every frame.

Best Answer

To use section and subsection names in frame title in beamer, one can use \secname and \subsecname as shown below:

\section{About project}
\subsection{Easy stuff}
\begin{frame}{\secname : \subsecname}
    ...
\end{frame}