1

When I give presentations I usually organize my frames in the following way:

  • I create one frame about some topic, shown in the title
  • Inside that frame, I create one slide for each sub-topic with the only command
  • Inside each sub-topic slide, I typically put an animated itemize list with \item<N->

To simplify asking questions related to each slide, I'd like to put the slide numbering in the following way:

  • The count should progress for each frame
  • Each slide of the sub-topic of the frame should be numbered as Nframe.Nslide

For instance, if I'm displaying the third slide of the second frame I'd like the counter to display 2.3.

As far as I know, there are two possibilities for numbering:

  • Frame number (which, in my case, does not work because the counter does not increase with the sub-topic slides)
  • Page number (which, in my case, does not work because it counts also the animations in the itemize lists).

Here is an example with the desired behavior written in the slide:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usetheme{Dresden}
\setbeamersize{text margin left=.3cm,text margin right=.5cm}
\setbeamertemplate{itemize items}[triangles]
\title[]{Title}
\author[]{Author}
\date{date}
\setbeamercovered{transparent}

\setbeamertemplate{page number in head/foot}[totalpagenumber]

%1 titolo
\begin{document}
\beamertemplatenavigationsymbolsempty
\begin{frame}
\maketitle
\end{frame}

\begin{frame}{Frame 1}
    Frame 1, slide 1\\
    Should be numbered as slide 1
\end{frame}

\begin{frame}{Frame 2}
    \only<1-2>{
    \framesubtitle{Frame 2, slide 1}
    Should be numbered as slide 2.1
    \begin{itemize}
        \item <1-> Even if I use itemize
        \item <2-> With animations
    \end{itemize}
    }
    
    \only<3>{
    \framesubtitle{Frame 2, slide 2}
    Should be numbered as slide 2.2
    }
\end{frame}

\begin{frame}{Frame 3}
    Frame 3, slide 1\\
    Should be numbered as slide 3
\end{frame}

\end{document}

Thanks in advance :)

3
  • Behind the scenes, \item<> uses the same mechanism as \only<>. It will be complicate to disentangle them. Commented Apr 28 at 13:43
  • 1
    You could organise your presentation differently: use a section, subsection or subsubsection for each topic, a frame for each subtopic and as much animation as you want inside the frame. It will be easy to number the slides with sectionnumber.framenumber Commented Apr 28 at 13:55
  • Thanks! I like the idea of using sections instead of frames to divide the topics. But I can't number the slides with the section number first: I've tried \setbeamertemplate{page number in head/foot}[sectionnumber.framenumber] but this does not appear. If, instead, I use \setbeamertemplate{page number in head/foot}[framenumber] the counter appears but of course it displays only the framenumber.
    – LucioPhys
    Commented Apr 28 at 14:20

1 Answer 1

0

Behind the scenes, \item<> uses the same mechanism as \only<>. It will be complicate to disentangle them.

Instead, you could organise your presentation differently: use a section, subsection or subsubsection for each topic, a frame for each subtopic and as much animation as you want inside the frame:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usetheme{Dresden}
\setbeamersize{text margin left=.3cm,text margin right=.5cm}
\setbeamertemplate{itemize items}[triangles]
\title[]{Title}
\author[]{Author}
\date{date}
\setbeamercovered{transparent}


% total number of sections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{totcount}
\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
  \pretocmd{\section}{\refstepcounter{totalsection}}{}{}%
}%

% fix for xcntperchap from https://topanswers.xyz/tex?q=1987#a2230
\ExplSyntaxOn % fix xcntperchap
\cs_set_eq:NN \c_zero \c_zero_int
\ExplSyntaxOff
\usepackage{xcntperchap}
\RegisterCounters{section}{framenumber}

\newcounter{FrameInSection}

\AtBeginEnvironment{frame}{
\ifnum\thesection>0
\setcounter{FrameInSection}{\ObtainTrackedValueExp[\thesection]{section}{framenumber}}
\fi
}

\setbeamertemplate{page number in head/foot}{%
  \insertsectionnumber
  \ifnum\theFrameInSection>1
    .\insertframenumber
  \fi
}

\AtBeginSection{\setcounter{framenumber}{0}}

\setbeamertemplate{headline}{}

%1 titolo
\begin{document}
\beamertemplatenavigationsymbolsempty
\begin{frame}[noframenumbering,plain]
\maketitle
\end{frame}

\section{Topic 1}

\begin{frame}
    \frametitle{Topic 1}
    Frame 1, slide 1

    Should be numbered as slide 1
\end{frame}

\section{Topic 2}

\begin{frame}
    \frametitle{Topic 2}
    \framesubtitle{Frame 2, slide 1}
    Should be numbered as slide 2.1
    \begin{itemize}
        \item <1-> Even if I use itemize
        \item <2-> With animations
    \end{itemize}
\end{frame}
    
\begin{frame}
    \frametitle{Topic 2}
    \framesubtitle{Topic 2, slide 2}
    Should be numbered as slide 2.2
\end{frame}

\section{Topic 3}

\begin{frame}
    \frametitle{Topic 3}
    Frame 3, slide 1

    Should be numbered as slide 3
\end{frame}

\end{document}

enter image description here

2
  • That's amazing, thank you very much!
    – LucioPhys
    Commented Apr 28 at 14:45
  • @LucioPhys You're welcome! (... I just updated my answer to only show the subtopic if there is more than one subtopic in the topic) Commented Apr 28 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .