Now, while I am no stranger to LaTeX, especially for writing a quick
presentation, it can be a painful to remember the various directives and
options. I am not really a daily LaTeX-user, so I tend to forget these
things. I am a daily org-mode user though, and org-mode can export to
LaTeX (which then, in turn, are translated into PDFs). So why not use
org-mode to generate presentations?
It turns out that that is quite easy.
First, we need to define some of the LaTeX-boilerplate, and tell org-mode
about it, so we never need to think about it again. Put the following in
your .emacs:
(unless (boundp 'org-export-latex-classes)
(setq org-export-latex-classes nil))
(add-to-list 'org-export-latex-classes
'("beamer"
"\\documentclass[11pt]{beamer}\n
\\mode<{{{beamermode}}}>\n
\\usetheme{{{{beamertheme}}}}\n
\\usecolortheme{{{{beamercolortheme}}}}\n
\\beamertemplateballitem\n
\\setbeameroption{show notes}
\\usepackage[utf8]{inputenc}\n
\\usepackage[T1]{fontenc}\n
\\usepackage{hyperref}\n
\\usepackage{color}
\\usepackage{listings}
\\lstset{numbers=none,language=[ISO]C++,tabsize=4,
frame=single,
basicstyle=\\small,
showspaces=false,showstringspaces=false,
showtabs=false,
keywordstyle=\\color{blue}\\bfseries,
commentstyle=\\color{red},
}\n
\\usepackage{verbatim}\n
\\institute{{{{beamerinstitute}}}}\n
\\subject{{{{beamersubject}}}}\n"
("\\section{%s}" . "\\section*{%s}")
("\\begin{frame}[fragile]\\frametitle{%s}"
"\\end{frame}"
"\\begin{frame}[fragile]\\frametitle{%s}"
"\\end{frame}")))
(add-to-list 'org-export-latex-classes
'("letter"
"\\documentclass[11pt]{letter}\n
\\usepackage[utf8]{inputenc}\n
\\usepackage[T1]{fontenc}\n
\\usepackage{color}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
This is based on the template by Thomas S. Dye on the org-mode mailing
list. You can of course add other packages to it with \usepackage. In my
version, I have add the Listings-package for including syntax-highlighted
snippets of source code in my presentations. Importantly, I added the
[fragile] options to the frame-settings, otherwise you cannot include
such source code fragments without LaTeX complaining in various unhelpful
ways.
Note, you can customize the way the Listings package works by changing the
template above; or by setting the options in the org-file; this involves
some 'raw LaTeX' though. It might make sense to define some macros for
that.
Now, we can easily make a presentation in org-mode; simply start the file
with something like:
#+LaTeX_CLASS: beamer
#+MACRO: BEAMERMODE presentation
#+MACRO: BEAMERTHEME Antibes
#+MACRO: BEAMERCOLORTHEME lily
#+MACRO: BEAMERSUBJECT RMRF
#+MACRO: BEAMERINSTITUTE Miskatonic University, Astrology Dept.
#+TITLE: Presentation with Org-Mode and Beamer
#+AUTHOR: Someone
Of course, you can change these parameters; for example, you might want to
change the BEAMERTHEME into Madrid or Warsaw, or … – see the Beamer User Guide (PDF).
After having set up these things, you can write presentations in the familiar
org-mode mark-up.