I now have several dozens of beamer TeX files with hundreds of slides. I am wondering is there an easy way of collecting all frames into one document? I think it can be done with any of the scripting languages, or Python, but does anyone know of a TeX-based program than can do this by specifying the directories to search?

The reason is that I am now wasting a lot of time searching old files for slides I know I have already prepared. So if they are all in one pdf I can quickly scan the frames to find the ones I need.

To be specific - I want to extract all \begin{frame}...\end{frame} text across hundreds of files to go into 1 TeX file.

  • Check out this question and the standalone package, it's a start at least. With the standalone package, you can insert all frames (and ignore the preamble). I haven't used it in beamer though but it's possible according to the documentation – Grimler Jun 18 '15 at 9:02
  • You could divide all your presentations into multiple files. One file with the preamble and another one with the actual content. Then \input the content into the file with the preamble or use \input multiple times for all your content tex files to get a presentation with all the frames in it. Information on \input – Benjamin Jun 18 '15 at 22:47

If you want to join all pdfs into one large pdf, you can use pdfpages package:



\includepdf[pages=-]{path to first file/first file}
\includepdf[pages=-]{path to second file/second file}

  • This would be OK for a small number of files, but I had a few hundred tex files. I ended up writing a bash script that looped through all the files and extracted everything between the begin doc and end doc tags, dumped it into a new file and added the preamble. – icenov Jul 20 '18 at 5:32
  • @icenov You could also do a bash script which writes the list of \includepdf commands without filtering the contents between \begin{document} and \end{document}. – Ignasi Jul 20 '18 at 7:43

Your Answer

