I have a number of slides prepared using LaTeX Beamer. They all belong to the same lecture series. Now, I would like to dynamically generate a Table of Content based on those multiple slides.

The input would look like a number XY of slides, e.g.



\title{Lecture XY}


\section{A section}



and then I would like to collect all title values from all files to form the top-level list, the sections within slides_XY.tex to become second-level lists within title and the frame titles to become third-level lists within sections.


  1. Lecture 01
    1. A section
      1. Hello
      2. Bye
  2. Lecture 02


If I try to use \input{}, I just get everything in the document AND I get multiple definitions of \title, among other problems.

I could do this with an external script, but I would like to keep this within LaTeX because the end goal would be to deploy those slides AND the overview with Overleaf.

  • Beamer uses things like \@writefile{toc}{\beamer@sectionintoc {1}{A section}{1}{0}{1}} in the aux file instead of the usual \@writefile{toc}{\contentsline {section}{\numberline {1}A section}{1}\protected@file@percent } in the aux file. You might be able to access them directly, but using them will be a problem. – John Kormylo Apr 18 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.