TransWikia.com

How to number frametitles

TeX - LaTeX Asked on April 11, 2021

I have a simple beamer presentation, with a Title frame (that is info on author, date, etc), and several sections with associated titleframes.
I would like to split this presentation into parts and number them accordingly, so the following structure results:

Title

additional frame, associated with title (unnumbered)

1 Section

1.1 first titleframe

1.2 second titleframe

2 Section

2.1 …

2.2 …

How can this be done? The Title should not be numbered, nor associated frames. Only sections, subsections, etc. Would also be nice if the "numbering" of a section could be toggled between on/off, but that is more optional.

Edit: The numbering does not have to be over the sections. If there is an easier way, I am open for anything.

I got the following:

documentclass[xcolor= pdftex, dvipsnames, table, 10pt]{beamer}
mode<presentation>
{
    usetheme{Default}
    %usetheme{Madrid}
    setbeamercovered{transparent}
    usecolortheme{whale}
}

AtBeginSection[]{
    begin{frame}
        vfill
        centering
        begin{beamercolorbox}[sep=8pt,center,shadow=false,rounded=true]{title}
            usebeamerfont{title}secnamepar%
        end{beamercolorbox}
        vfill
    end{frame}
}

begin{document} 

title{Title} 
author{Author}
institute{Firm}
date{Date} 

setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=false]
setbeamertemplate{footline}[page number]
setbeamertemplate{frametitle}[default][colsep=-4bp,rounded=false,shadow=false]
beamertemplatenavigationsymbolsempty

frame{titlepage}

section{First section}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

section{Second section}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

end{document}

Please tell me if any information is missing or if the above question is unclear in any regard.

One Answer

As a quick and dirty solution I can suggest redefining frametitle to put the frame number directly to the frame title. I guess that the proper solution would be to redefine the outer theme template for the frame title.

The changes include adding thesection to your section frames and a few lines after that which do the definition of the frame counter and adding it to the titles.

documentclass[xcolor= pdftex, dvipsnames, table, 10pt]{beamer}
mode<presentation>
{
    %usetheme{Default}
    %usetheme{Madrid}
    setbeamercovered{transparent}
    usecolortheme{whale}
}

AtBeginSection[]{
    begin{frame}
        vfill
        centering
        begin{beamercolorbox}[sep=8pt,center,shadow=false,rounded=true]{title}
            usebeamerfont{title}thesection secnamepar%
        end{beamercolorbox}
        vfill
    end{frame}
}

makeatletter
newcounter{frame}[section]
deftheframe{thesection.arabic{frame}}
AtBeginEnvironment{frame}{}
letframetitleoldframetitle
defframetitle#1{%
  refstepcounter{frame}%
  ifnumc@section=0
    frametitleold{#1}%
  else
    frametitleold{theframe #1}%
  fi
}
makeatother

begin{document} 

title{Title} 
author{Author}
institute{Firm}
date{Date} 

setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=false]
setbeamertemplate{footline}[page number]
setbeamertemplate{frametitle}[default][colsep=-4bp,rounded=false,shadow=false]
beamertemplatenavigationsymbolsempty

frame{titlepage}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

section{First section}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

section{Second section}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

begin{frame}
    frametitle{Title}
    framesubtitle{Subtitle}
end{frame}

end{document}

The result: enter image description here

Correct answer by Sergei Golovan on April 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP