1

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}
1

Possibility 1: Hiding the subsection page

\documentclass[nooutline]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\newcounter{foo}

\AtBeginSection[]{
  \begin{frame}<beamer>
    \frametitle{Table of contents}
    \tableofcontents[currentsection,hideothersubsections]
  \end{frame}}

\AtBeginSubsection[]{
    \setcounter{foo}{\insertsectionstartpage}
    \addtocounter{foo}{1}
    \ifnum\thepage=\thefoo  
    \else
  \begin{frame}<beamer>
    \frametitle{Table of contents} 
    \tableofcontents[currentsubsection,currentsection, subsectionstyle=show/shaded/hide]
  \end{frame}
  \fi
  }

%---------


\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}

Possibility 2: Hiding the section page

\documentclass[nooutline]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\newcounter{foo}

\makeatletter
\AtBeginSection[]{
    \beamer@nextpage\beamer@endpageofsubsection%
    \setcounter{foo}{\beamer@tempcount}
    \ifnum\thepage=\thefoo  
    \else
        \begin{frame}<beamer>
    \frametitle{Table of contents}
    \tableofcontents[currentsection,hideothersubsections]
  \end{frame}
    \fi
}
\makeatother

\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}
  • Well - maybe an option, but I'd really rather draw attention to the subsection there. Of course, your solution is better than nothing :-). – Holger Karl Sep 6 '18 at 11:36
  • @HolgerKarl Please see my edited answer – user36296 Sep 6 '18 at 11:53
  • @HolgerKarl You're welcome! – user36296 Sep 6 '18 at 12:22

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.