Imprint | Privacy Policy

How to create presentations with emacs-reveal

(Press ? for help, n and p for next and previous slide; usage hints)

Jens Lechtenbörger (License Information)
January 2020 (emacs-reveal 5.2.0 and later)

Presentation Hints

General

  • This is a reveal.js presentation and an Open Educational Resource (OER)
    • Generated with emacs-reveal from Free/libre Org mode sources
    • Key bindings and navigation
      • Press “?” to see key bindings of reveal.js
        • In general, “n” and “p” move to next and previous slide; mouse wheel works as well
        • Search with Ctrl-Shift-F
      • Up/down (swiping, arrows) move within sections, left/right jump between sections (type “o” to see what is where)
      • Type slide’s number followed by Enter to jump to that slide
      • Browser history (buttons, Alt-CursorLeft, Alt-CursorRight)
      • Zoom with Ctrl-Mouse or Alt-Mouse

Offline work

  • Students often ask for download-able presentations
  • Alternatives
    1. Clone repository, build presentations locally (see Usage)
    2. Download build artifacts from recent pipeline (if not expired)
    3. Generate PDF
      • Why, really?
        • Why not download source files instead?
        • Org mode, which is plain text
      • Change the URL by adding “?print-pdf” after “.html”, then print to PDF file (usually, Ctrl-p)
      • Alternatively, generate PDF via LaTeX from Org source file
        • Replace .html (and whatever follows) in address bar of browser with .pdf

Audio

(Speaker) Notes

  • Slides contain additional notes as plain text if you see the folder icon at the top right (as on this slide)

    • Either press “v” to see the “courseware view” or click on that icon or press “s” to see the “speaker notes view”
    • You need to allow pop-ups
      • If the pop-up window does not work, you may need to press “s” twice or close the pop-up window once

Introduction

What’s This?

  • Emacs-reveal is free software to generate reveal.js presentations (slides with audio) from simple text files in Org mode

    Presenter explaining technical sketch on board

    Figure” under CC0 1.0; converted from Pixabay

    • Benefits
      • For your audience
        • Self-contained presentations embedding audio
        • Usable on lots of (including mobile and offline) devices with just a browser
      • For you as producer
        • Separation of layout and contents (similarly to, e.g., LaTeX)
        • Simple text format allows diff and merge for ease of collaboration

Prerequisites

  • I suppose (and strongly recommend) that you use GNU/Linux (help on getting started)
    • Actually, not much here is operating system specific
  • Emacs-reveal should really be used with the text editor GNU Emacs
    • (You could try other editors and build presentations within GitLab, thanks to GitLab’s infrastructure)
      • (In fact, you do not need an editor at all but could edit presentations using a Web browser on GitLab.com, e.g., with the Web IDE (requires login))

Installation and Quickstart

Installation of emacs-reveal

  • Starting with version 1.0.0, you can install emacs-reveal in a directory of your choice
    1. Choose directory, e.g., ~/.emacs.d/elpa, and clone software
      • cd ~/.emacs.d/elpa
      • git clone https://gitlab.com/oer/emacs-reveal.git
    2. Install required Emacs packages from MELPA
      • emacs --batch --load emacs-reveal/install.el --funcall install
      • (See comments in file install.el for update instructions)
    3. Maybe add lines like this to ~/.emacs
      • (add-to-list 'load-path "~/.emacs.d/elpa/emacs-reveal")
      • (require 'emacs-reveal)
        • Beware! This changes values of other packages without warning.
        • You may skip step (3) and restrict those changes to export runs.

Alternative installation

  • Starting with version 4.3.0, emacs-reveal includes the Lisp packages org, org-re-reveal, org-re-reveal-ref, and oer-reveal as submodules.
  • Thus, you can also initialize those submodules and adjust your load-path instead of the MELPA installation mentioned on the previous slide.
    • Submodule setup in directory emacs-reveal
      • git submodule sync --recursive
      • git submodule update --init --recursive
    • If you install your emacs-reveal into ~/.emacs.d/elpa as suggested above, emacs-reveal.el (starting with version 5.1.0) sets up your load-path to include the submodule packages

Quickstart with emacs-reveal

  • E.g., generate this howto
    1. Choose directory, clone howto
      • git clone https://gitlab.com/oer/emacs-reveal-howto.git
      • cd emacs-reveal-howto/
    2. Install submodules (the howto embeds a repository for figures)
      • git submodule sync --recursive
      • git submodule update --init --recursive
    3. Generate the HTML presentation from Org source howto.org
      • emacs --batch --load elisp/publish.el
      • Publication code needs to be able to locate emacs-reveal.el
        • Code in elisp/publish.el tries (a) load path after adding ~/.emacs.d/elpa/emacs-reveal (suggested as directory for emacs-reveal on previous slide) and (b) sibling directory emacs-reveal

Usage

Alternatives

  1. Create presentations locally on Command Line
  2. Create presentations in GNU Emacs
  3. Create presentations with Docker

    Docker logo

    Docker logo” under Docker Brand Guidelines; from Docker

  4. Create and publish presentations on GitLab

    GitLab Logo

    GitLab Logo” by GitLab under CC BY-NC-SA 4.0; from gitlab.com

Build Presentations on Command Line

  1. Install emacs-reveal and howto
  2. Create Org file in directory emacs-reveal-howto
    • See contained source file for this presentation, howto.org
  3. Build presentations for files ending in .org
    • (Except internal ones, see function oer-reveal-publish-all)
    • emacs --batch --load elisp/publish.el
      • Presentations are built in subdirectory public/
  4. Open presentation in Firefox
    • E.g.: firefox public/howto.html
  5. Optional: Copy public/ to public web server

Building Presentations in Emacs

  1. Generate HTML presentation for visited .org file using Org export functionality:
    Press C-c C-e w b (export with oer-reveal)
    • This generates HTML file in current directory and opens it in default browser
    • For this to work
      1. Settings of emacs-reveal should be in effect (emacs-reveal.el is loaded, e.g., with step (3) above)
      2. Necessary resources, in particular reveal.js, must be accessible in .org file’s directory
        • I use emacs --batch --load elisp/publish.el once to populate public/, then create a symbolic link:

          ln -s public/reveal.js

      3. For image grids, you may need: (setq oer-reveal-export-dir "./")

Org-re-reveal and oer-reveal

  • Emacs-reveal embeds the packages org-re-reveal and oer-reveal
    • Oer-reveal is an Org mode export backend (extending org-re-reveal)
      • Starting with oer-reveal 1.4.0, part of emacs-reveal 4.1.0
      • With key binding mentioned on previous slide
    • You can export with org-re-reveal (C-c C-e v v and C-c C-e v b) or oer-reveal (C-c C-e w w and C-c C-e w b)
      • With oer-reveal, additional reveal.js plugins are enabled by default
        • See customizable variables oer-reveal-plugins and oer-reveal-plugin-config

Build Presentations on GitLab

  1. Fork emacs-reveal-howto on GitLab (fork documentation)
    • git clone <the URL of YOUR GitLab project>
  2. Create or update Org files in cloned directory
    • Push changes to your fork
  3. GitLab infrastructure picks up changes and publishes presentations as GitLab Pages
    • Based on Continuous Integration (CI) infrastructure
    • CI run takes some minutes
    • Go to Settings → Pages to see the Pages’ address

Some Presentation Features

Text Slide

  • A list
  • With a sub-list whose items appear
    • This is emphasized
    • This is bold
    • This looks like code
    • This is green
    • Nothing special

Some Fragment Styles

  • Forget
  • Shrink
  • Grow
  • Very important

Fragments with Custom Order

  • I’m first.
  • Fourth.
  • Third.
  • Second.
  • I’m also first.

Centered Text

Just some horizontally centered text. Created by assigning a class with text-align: center.

On Sections

  • This slide is part of section Some Presentation Features
    • We can link to slides, e.g., an earlier slide
      • You can use the browser history to go back
    • Side note: Check source code to see two variants of link targets used on this slide
  • This slide can also be perceived as its own subsection
  • (This list item appears simultaneously with previous bullet point)

Another Slide

  • This slide is on a deeper level of nesting
  • This level of nesting is not shown in the table of contents in the slide’s bottom
  • By the way, the headings in the table of contents below are hyperlinks
    • And your browser remembers the history, back/forward buttons and shortcuts should work
    • Mousewheel and swiping work

Licensing

  • Starting with emacs-reveal 5.0.3 (and oer-reveal 2.0.2), presentations can show license information that is derived from SPDX headers of the REUSE project
    • See licensing slide at the end of this presentation
      • Information on that slide is derived from the following header lines of howto.org

        #+SPDX-FileCopyrightText: 2017-2020 Jens Lechtenbörger <https://lechten.gitlab.io/#me>
        #+SPDX-License-Identifier: CC-BY-SA-4.0
        
      • Note that SPDX headers must be prefixed with #+ to be recognized as Org mode keywords
    • License information is also embedded in machine-readable RDFa format
  • Macros to embed OER figures with (human- and machine-readable) license information are discussed later

Two Columns: Pro/Con of emacs-reveal

Pro

  • Free/libre open source software
  • Device-independent presentations
    • Also mobile and offline
    • Generated from simple text format
      • Easy to learn
      • Collaboration with diff/merge/git
      • Separation of layout and content

Con

  • No WYSIWYG
  • (Need to learn something new)

Figures and Audio

Slide with Figure and Audio

Figure with Caption and License

  • Display image with meta-data specified in file
    • Simplify sharing of images with source and license
  • Functionality and meta-data format are specific to emacs-reveal
    • See next slide for sample file

Balance tipping in favor of Yes

To share or not to share

Figure” under CC0 1.0; converted from Pixabay

Meta-Data File for Previous Image

;; Semicolon starts comment until end of line (Emacs Lisp).
;; Note that the line for dc:title below is just a comment.  In that
;; case, "Image" is used as generic title; uncomment for real title.
;; CC0 does not require attribution of author/creator; uncomment if needed.

((filename . "./figures/3d-man/decision-1013751_1920.jpg") ; Note the path prefix
; (dc:title . "The title given by the author")
 (licenseurl . "https://creativecommons.org/publicdomain/zero/1.0/")
 (licensetext . "CC0 1.0")
; (cc:attributionName . "Jens Lechtenbörger")
; (cc:attributionURL . "https://gitlab.com/lechten")
 (dc:source . "https://pixabay.com/en/decision-question-response-1013751/")
 (sourcetext . "Pixabay")
 (imgalt . "Balance tipping in favor of Yes")
 (imgadapted . "converted from") ; Adjust as needed
 (texwidth . 0.5) ; Width in percent of textwidth for LaTeX export
)

An Image Grid: Computers

Server

Server” under CC0 1.0; from Pixabay

C64

C64” under CC0 1.0; from Pixabay

Notebook

Notebook” under CC0 1.0; from Pixabay

Router

Router” under CC0 1.0; from Pixabay

Car

Car” under CC0 1.0; from Pixabay

Doll

Doll” under CC0 1.0; from Pixabay

TV

TV” under CC0 1.0; from Pixabay

Smart watch

Smart watch” under CC0 1.0; cropped from Pixabay

Fairphone 2

Fairphone 2” by Kaihsu Tai under CC BY-SA 4.0; cropped from Wikimedia Commons

Creation of Previous Image Grid

  • Single line in source file, using macro revealgrid

    {{{revealgrid(42,"./figures/devices/computer.grid",60,4,3,"\"ga1 ga2 ga2 ga3\" \"ga1 ga4 ga5 ga6\" \"ga7 ga8 ga9 ga9\"")}}}
    
    • Arguments explained in config.org of oer-reveal
    • With file computer.grid as follows

      ("./figures/devices/white-male-1834091_1920.meta"
       "./figures/devices/commodore-160186_1280-CC0.meta"
       "./figures/devices/laptop-154091_1280.meta"
       "./figures/devices/router-157597_1280.meta"
       "./figures/devices/car-49278_960_720.meta"
       "./figures/devices/beauty-1260974_1920.meta"
       "./figures/devices/vintage-tv-1116587_960_720.meta"
       "./figures/devices/smartwatch-1874536_1280.meta"
       "./figures/devices/Fairphone_2_reverse.meta")
      

Notes on figures

  • If you used emacs-reveal previously and did not like that it exported all figures from a growing repository, note that as of emacs-reveal 5.2.0 only used figures are exported
  • So far, emacs-reveal uses meta-data in an ad-hoc format (as shown on a previous slide)

Appearing Items with Audio

(Audios produced with MaryTTS, converted to Ogg format with Audacity)

  • One
  • Two
  • Three

Misc

Quiz Plugin

Sample Quiz

Klipse for Code Evaluation

  • Org-re-reveal supports Klipse
    • Teach programming
      • Code changes in upper part result in output changes in lower part
    • Browser-side code evaluation for various programming languages
      • See org-re-reveal-klipse-languages for supported subset
        • clojure, html, javascript, js, php, python, ruby, scheme, sql
      • To activate, either add option reveal_klipsify_src:t (as in header of this file) or set variable org-re-reveal-klipsify-src to t; be sure to disable scaling of reveal.js
      • Correct indentation may require that you set org-src-preserve-indentation to t (see bottom of this file)
  • Code on next two slides copied from README of Org-Reveal

HTML Src Block


<h1 class="whatever">hello, what's your name</h1>

Javascript Src Block


console.log("success");
var x='string using single quote';
x

PHP Src Block


$name = "Alice";
echo "Moin " . $name . "!";

Python Src Block


def factorial(n):
    if n < 2:
        return 1
    else:
        return n * factorial(n - 1)

print(factorial(10))

Figures with Babel

  • Org export can execute embedded source code, with results injected into exported HTML presentation
  • With emacs-reveal
    • Activate necessary source languages in oer-reveal-publish-babel-languages
    • Maybe generate figures into separate directory
      • Publish contents with org-publish-project-alist
  • See subsequent slides for sample code

Hello World with Dot

graph {
  hello [label="Hello"];
  world [label="World!"];

  hello -- world;
  }

hello-world.png

Relevant Excerpt of Publication Code

  • The following snippet of elisp/publish.el activates dot and publication of generated images

    • Adapt based on your needs
      • Note that necessary directories must exist (Babel does not create them)
    (make-directory "img" t)
    (setq oer-reveal-publish-babel-languages '((dot . t) (emacs-lisp . t))
          org-publish-project-alist
          (list (list "img"
                      :base-directory "img"
                      :base-extension "png"
                      :publishing-function 'org-publish-attachment
                      :publishing-directory "./public/img")))
    

Need Additional Software in Publication Process?

The End

Further Reading

Go for it!

Person taking steps to top

The road ahead …

Figure” under CC0 1.0; converted from Pixabay

https://gitlab.com/oer/

License Information

Except where otherwise noted, the work “How to create presentations with emacs-reveal”, © 2017-2020 Jens Lechtenbörger, is published under the Creative Commons license CC BY-SA 4.0.

No warranties are given. The license may not give you all of the permissions necessary for your intended use.

In particular, trademark rights are not licensed under this license. Thus, rights concerning third party logos (e.g., on the title slide) and other (trade-) marks (e.g., “Creative Commons” itself) remain with their respective holders.