I am using ToC slides for currentsection and currentsubsection. That gives intended behavior if there are frames after a section and before the next subsection starts. But if there are section and subsection immediately adjacent with no frames in between, this gives two almost identical ToCs. See example.
Ideally, I'd like to suppress page 7 and only have page 8 appear; the one between frames C and D. Manual techniques (switching style on/off in the text etc.) are not really an option; too many slides generated from org-mode.
I could not find any relevant ideas how to approach that. Thanks for any hints!
\documentclass[nooutline]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\AtBeginSection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsection,hideothersubsections]
\end{frame}}
\AtBeginSubsection[]{
\begin{frame}<beamer>
\frametitle{Table of contents}
\tableofcontents[currentsubsection,currentsection, subsectionstyle=show/shaded/hide]
\end{frame}}
%---------
\begin{document}
\section{Section 1}
\begin{frame}{Frame A}
\end{frame}
\subsection{Subsection 1.1}
\begin{frame}{Frame B}
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame C}
\end{frame}
\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Frame D}
\end{frame}
\subsection{Subsection 2.2}
\begin{frame}{Frame E}
\end{frame}
\end{document}