#!/bin/blog --author=p4bl0

the blog where all numbers are written in base 10

outline-presentation-mode for Emacs

by p4bl0, on
last update by p4bl0, on

Context

Feel free to skip this section.

Two weeks ago my research group asked for a practical introduction to Git for the following week and I volunteered for this task. I usually use Beamer to make my presentations, but I always start by making a plan in a plain text file using Emacs outline-mode. Then I generally use a few Emacs keyboard macros to put the necessary LaTeX markup (\section, \subsection, etc.) around the sections titles, then I insert that in my beamer skeleton and start writing the content of the slides.

But this time, I don't really know why, I started to fill in the slide contents in outline-mode. Naturally, I then wanted to generate my presentation directly from that. And as a normal Emacs user (if you allow me that oxymoron), I decided that I should be able to do my presentation directly from within Emacs. I googled a bit and found, as I expected, tools that generate LaTeX from org-mode files, but also an attempt to do exactly what I wanted on github. I tried it and even though it didn't work quite well and didn't have the features I wanted, it was a good starting point. So I started hacking it to make it do what I want.

outline-presentation-mode

Introduction

Let me introduce you to outline-presentation-mode, which is a minor mode for making presentations with outline-mode files. Here is how it interprets outline's headings:

  • Headings at level 1, 2, and 3 are slides.
  • Headings at level greater than 3 are considered like titles inside the slides. For the rest of the article I consider them part of the text entry of headings at level 1, 2, and 3.
  • Headings at level 1 are considered sections. Their slides show their text entry plus the level 2 and 3 sub-headings they might have.
  • Headings at level 2 and 3 are considered normal slides, so only their text entry are shown.

Installation

To install outline-presentation-mode, you need to put the outline-presentation.el elisp file in your Emacs load-path and load it. This can be automatized by putting (require 'outline-presentation) in your .emacs file. You can of course M-x byte-compile-file this elisp file.

Usage

To start a presentation, you simply turn on the minor mode using M-x outline-presentation-mode. The presentation starts with the slides that contained the caret.

I want to be able to edit slides even in presentation mode so I use unusual keybindings to avoid overriding existing ones. Here are available actions:

  • A-M-n moves to the next slide;
  • A-M-p moves to the previous slide;
  • A-M-f moves to the next section slide (corresponding to an outline level 1 heading);
  • A-M-b moves to the previous section slide;
  • A-M-a moves to the first slide;
  • A-M-t displays only the section titles (table of contents);
  • A-M-y displays only the slide titles (table of contents);
  • A-M-s displays the slide which contains the caret (use it in one of the two "table of contents" displays);
  • A-M-r resumes to the slide from which you jumped to the table of contents (this can be used recursively);
  • A-M-q quits the presentation mode and goes back to outline-mode.

While the outline-presentation minor mode in on, the position part of the modeline contains your position in the presentation (for instance "13/42" if you are currently displaying the 13th of 42 slides) in addition to the usual position information. If you are displaying the table of contents (using A-M-t or A-M-y described above), this is replaced by "ToC".

As an example, you can find here the introduction to git that I gave to my research group. I don't know if the slides alone are very useful though. During the presentation I also had a terminal opened where I instantly demonstrated everything I talk about in the slides.

Hooks

You can tell Emacs to increase text size with M-x text-scale-adjust which is bound to C-x = by default. This is useful when using a videoprojector to give your presentation. You can do that automatically by adding a hook in outline-presentation-mode-hook. Like in this snippet from my init.el file:

;; outline-mode
(add-to-list 'auto-mode-alist
  '("\\.outline\\'" . outline-mode))
(require 'outline-presentation)
(add-hook 'outline-presentation-mode-hook
          (lambda () (text-scale-increase 3)))

Tips

You can use M-x center-line and M-x center-region for your title slides. Do not forget about M-x artist-mode either.

If you have any remark about this blog or if you want to react to this article feel free to send me an email at "pablo <r@uzy dot me>".