I have a LaTeX paper with multiple sections, subsections, and figures. My slides to present the paper will mostly consist of the same sections, subsections, and figures. So I am interested in automatically generating the Beamer code for a draft presentation with the following features:
- The sections and subsections from the paper are preserved in the slides.
- When a figure is referenced within a subsection of the paper, the figure is inserted in a slide for the corresponding subsection.
I was wondering if something along those lines already exists. Otherwise it would be fairly simple to write a script which parses the paper and generates the Beamer draft.
To further clarify my question, I made the following example:
Paper:
\documentclass{article}
\usepackage[affil-it]{authblk}
\author[1]{Phill}
\author[1]{Bill}
\affil[1]{Instutite of LaTeX}
\title{Paper 1}
\begin{document}
\section{sec1}
\subsection{sec1.1}
See the data in \ref{fig:1}.
\section*{Figures}
\begin{figure}
\includegraphics[scale = 0.5]{example-image}
\label{fig:1}
\end{figure}
\end{document}
Resulting slides:
\documentclass{beamer}
\title{Paper 1}
\author{Phill and Bill}
\Institute{Instutite of LaTeX}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\section{sec1}
\subsection{sec1.1}
\begin{frame}{\secname : \subsecname}
\begin{figure}
\includegraphics[scale = 0.5]{example-image}
\label{fig:1}
\end{figure}
\end{frame}
\end{document}
Best Answer
I went ahead and wrote a python script to solve the problem. Essentially the Beamer presentation will keep the format form the article (section subsections) and create a new slide for each figure, fitting the figure to the whole slide.
To use it you can simply run it in the same directory as your article file which should be named
main.tex
. The output presentation will be written toslides.tex
.