Skip to content

Instantly share code, notes, and snippets.

@Symbol1
Last active September 16, 2018 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Symbol1/d6d26db37996c6754630417a9f001172 to your computer and use it in GitHub Desktop.
Save Symbol1/d6d26db37996c6754630417a9f001172 to your computer and use it in GitHub Desktop.
% https://tex.stackexchange.com/questions/448512/total-number-of-frames-in-subsubsection
\documentclass{beamer}
\begin{document}
\makeatletter
\newif\ifincurrentsection
\newif\ifincurrentsubsection
\newif\ifincurrentsubsubsection
\newif\ifincurrentframe
\def\counteverything{
{
\def\stopcountingsubsubsection{
\ifx\subsubcount\undefined\else
\subsubindex-th frame out of \\
\subsubcount\ frames in current subsubsection
\global\let\subsubcount\undefined
\fi
}
\def\headcommand##1{##1}
\def\beamer@documentpages##1{
\stopcountingsubsubsection
}
\def\sectionentry##1##2##3##4##5{
\stopcountingsubsubsection
}
\def\beamer@subsectionentry##1##2##3##4##5{
\stopcountingsubsubsection
}
\def\beamer@subsubsectionentry##1##2##3##4##5##6{
\stopcountingsubsubsection
\ifnum\c@section=##2
\incurrentsectiontrue
\else
\incurrentsectionfalse
\fi
\ifnum\c@subsection=##3
\incurrentsubsectiontrue
\else
\incurrentsubsectionfalse
\fi
\ifnum\c@subsubsection=##4
\incurrentsubsubsectiontrue
\else
\incurrentsubsubsectionfalse
\fi
\ifincurrentsection
\ifincurrentsubsection
\ifincurrentsubsubsection
\xdef\subsubcount{0}
\fi
\fi
\fi
}
\def\slideentry##1##2##3##4##5##6{
\ifnum\c@subsectionslide=##3
\incurrentframetrue
\else
\incurrentframefalse
\fi
}
\def\beamer@sectionpages##1##2{}
\def\beamer@subsectionpages##1##2{}
\def\beamer@framepages##1##2{
\ifincurrentsection
\ifincurrentsubsection
\ifincurrentsubsubsection
\pgfmathtruncatemacro\subsubcount{\subsubcount+1}
\ifincurrentframe
\xdef\subsubindex{\subsubcount}
\fi
\fi
\fi
\fi
}
\input{\jobname.nav}
}
}
\setbeamertemplate{frametitle}{
\counteverything
}
\section{Sec1}
\subsection{Sec1-Ssec1}
\subsubsection{Sec1-Ssec1-sssec1}
\frame{{.}A}
\frame{{.}B\pause C}
\subsubsection{Sec1-Ssec1-sssec2}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\subsection{Sec1-Ssec2}
\subsubsection{Sec1-Ssec2-sssec1}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\frame{{.}G\pause H\pause I\pause J}
\subsubsection{Sec1-Ssec2-sssec2}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\frame{{.}G\pause H\pause I\pause J}
\frame{{.}K\pause L\pause M\pause N\pause O}
\section{Sec2}
\subsection{Sec2-Ssec1}
\subsubsection{Sec2-Ssec1-sssec1}
\frame{{.}A}
\frame{{.}B\pause C}
\subsubsection{Sec2-Ssec1-sssec2}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\subsection{Sec1-Ssec2}
\subsubsection{Sec2-Ssec2-sssec1}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\frame{{.}G\pause H\pause I\pause J}
\subsubsection{Sec2-Ssec2-sssec2}
\frame{{.}A}
\frame{{.}B\pause C}
\frame{{.}D\pause E\pause F}
\frame{{.}G\pause H\pause I\pause J}
\frame{{.}K\pause L\pause M\pause N\pause O}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment