Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
python + beamer: reads a list of files and descriptions and compiles a latex presentation using beamer. Details at: http://www.ayanguasgil.net/python/beamer.html
import csv
header = r"""
\documentclass[mathserif]{beamer}
\usetheme{default}
\begin{document}
"""
footer = r"""
\end{document}
"""
baseslide = r"""
\begin{frame}
\frametitle{%(title)s}
%(content)s
\begin{center}
\includegraphics[width=0.8\textwidth]{%(filename)s}
\end{center}
\end{frame}
"""
def parse_csv(filename):
data = [row for row in csv.reader(open(filename, 'rU'))]
slides = [create_slide(*row) for row in data]
return slides
def create_slide(filename, title, content):
slide = {}
slide['filename'] = filename
slide['content'] = content
slide['title'] = title
return (baseslide % slide)
if __name__ == '__main__':
import sys
print header + "".join(parse_csv(sys.argv[1])) + footer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment