The Emacs series
This is fifth in a series on Emacs and org-mode.
This blog post was generated from an org-mode source and is available as: a blog page, slides (PDF format), and a PDF document.
1 About org-mode exporting
1.1 Background
org-mode isn't just an agenda-making program. It can also export to lots of formats: LaTeX, PDF, Beamer, iCalendar (agendas), HTML, Markdown, ODT, plain text, man pages, and more complicated formats such as a set of web pages.
This isn't just some afterthought either; it's a core part of the system and integrates very well.
One file can be source code, automatically-generated output, task list, documentation, and presentation, all at once.
Some use org-mode as their preferred markup format, even for things like LaTeX documents. The org-mode manual has an extensive section on exporting.
1.2 Getting started
From any org-mode document, just hit C-c C-e
. From there will come
up a menu, letting you choose various export formats and options.
These are generally single-key options so it's easy to set and
execute. For instance, to export a document to a PDF, use
C-c C-e l p
or for HTML export, C-c C-e h h
.
There are lots of settings available for all of these export options; see the manual. It is, in fact, quite possible to use LaTeX-format equations in both LaTeX and HTML modes, to insert arbitrary preambles and settings for different modes, etc.
1.3 Add-on packages
ELPA containts many addition exporters for org-mode as well. Check there for details.
2 Beamer slides with org-mode
2.1 About Beamer
Beamer is a LaTeX environment for making presentations. Its features include:
- Automated generating of structural elements in the presentation (see, for example, the Marburg theme). This provides a visual reference for the audience of where they are in the presentation.
- Strong help for structuring the presentation
- Themes
- Full LaTeX available
2.2 Benefits of Beamer in org-mode
org-mode has a lot of benefits for working with Beamer. Among them:
- org-mode's very easy and strong support for visualizing and changing the structure makes it very quick to reorganize your material.
- Combined with org-babel, live source code (with syntax highlighting) and results can be embedded.
- The syntax is often easier to work with.
I have completely replaced my usage of LibreOffice/Powerpoint/GoogleDocs with org-mode and beamer. It is, in fact, rather frustrating when I have to use one of those tools, as they are nowhere near as strong as org-mode for visualizing a presentation structure.
2.3 Headline Levels
org-mode's Beamer export will convert sections of your document
(defined by headings) into slides. The question, of course, is:
which sections? This is governed by the H export setting
(org-export-headline-levels
).
There are many ways to go, which suit people. I like to have my presentation like this:
#+OPTIONS: H:2 #+BEAMER_HEADER: \AtBeginSection{\frame{\sectionpage}}
This gives a standalone section slide for each major topic, to
highlight major transitions, and then takes the level 2 (two
asterisks) headings to set the slide. Many Beamer themes expect a
third level of indirection, so you would set H:3
for them.
2.4 Themes and settings
You can configure many Beamer and LaTeX settings in your document by inserting lines at the top of your org file. This document, for instance, defines:
#+TITLE: Documents and presentations with org-mode #+AUTHOR: John Goerzen #+BEAMER_HEADER: \institute{The Changelog} #+PROPERTY: comments yes #+PROPERTY: header-args :exports both :eval never-export #+OPTIONS: H:2 #+BEAMER_THEME: CambridgeUS #+BEAMER_COLOR_THEME: default
2.5 Advanced settings
I like to change some colors, bullet formatting, and the like. I round out my document with:
# We can't just +BEAMER_INNER_THEME: default because that picks the theme default. # Override per https://tex.stackexchange.com/questions/11168/change-bullet-style-formatting-in-beamer #+BEAMER_INNER_THEME: default #+LaTeX_CLASS_OPTIONS: [aspectratio=169] #+BEAMER_HEADER: \definecolor{links}{HTML}{0000A0} #+BEAMER_HEADER: \hypersetup{colorlinks=,linkcolor=,urlcolor=links} #+BEAMER_HEADER: \setbeamertemplate{itemize items}[default] #+BEAMER_HEADER: \setbeamertemplate{enumerate items}[default] #+BEAMER_HEADER: \setbeamertemplate{items}[default] #+BEAMER_HEADER: \setbeamercolor*{local structure}{fg=darkred} #+BEAMER_HEADER: \setbeamercolor{section in toc}{fg=darkred} #+BEAMER_HEADER: \setlength{\parskip}{\smallskipamount}
Here, aspectratio=169
sets a
16:9 aspect ratio, and the remaining are standard LaTeX/Beamer
configuration bits.
2.6 Shrink (to fit)
Sometimes you've got some really large code examples and you might prefer to just shrink the slide to fit.
Just type C-c C-x p
, set the BEAMER_opt
property to shrink=15
.
(Or a larger value of shrink). The previous slide uses this here.
3 Interactive Slides
3.1 Interactive Emacs Slideshows
With the org-tree-slide package, you can display your slideshow from
right within Emacs. Just run M-x org-tree-slide-mode
. Then, use
C->
and C-<
to move between slides.
You might find C-c C-x C-v
(which is org-toggle-inline-images
)
helpful to cause the system to display embedded images.
3.2 HTML Slideshows
There are a lot of ways to export org-mode presentations to HTML, with various levels of JavaScript integration. See the non-beamer presentations section of the org-mode wiki for details.
4 Miscellaneous
4.1 Additional resources to accompany this post
- orgmode.org beamer tutorial
- LaTeX wiki
- Generating section title slides
- Shrinking content to fit on slide
- A great resource: refcard-org-beamer
- See its Github repo
- Make sure to check out both the PDF and the .org file
- A nice Theme matrix
4.2 Up next in my Emacs series…
mu4e for email!
Hey John:
First, I wanted to let you know that I’ve found these org-mode posts helpful. I’ve been moving down the path of learning and using org-mode for a while now and I found some useful tidbits in your posts.
I am struggling a bit to figure out how I want to handle the agenda view of TODO items. I like the idea of hierarchical TODO items. Something like this:
** TODO Some Big Project
*** TODO Some Action Item
*** TODO Another Action Item
**** TODO One of several things needed to accomplish “Another Action Item”
Given something like the above, when you open the agenda, all four of those TODOs will be listed equally. In my world, however, what I think I would like to see for an agenda view is only the “leaf” items (the 2nd and 4th line above) as those are the items that need to be done now and the other items depend on these things being done. I’d like the agenda to reflect that. Even if the agenda showed all of the items, if it could show them in a hierarchical fashion would be good.
Any thoughts on how to accomplish what I’m after. I haven’t be able to find the perfect solution yet. One option I’m considering is using a different keyword for those TODO items that depend on other TODO items. I suppose tags could be used too. But it seems like this should be possible:
(setq org-agenda-todo-type-show ‘(“leaf”))
Any other ideas?