GeekSocket Plug in and be Geekified

Creating presentations with Org mode

As I said in the last blog post about Emacs, I use Org mode a lot. It’s the default mode I use for taking notes, tracking tasks etc. The export interface it provides is a really useful feature. There are a lot of packages, which provide ways to export the Org mode file to other formats like Markdown in addition to default supported formats HTML, PDF, text etc.

Presenting within Emacs

A few months ago I had a talk on Autoscaling in Kubernetes within our company. I thought, what if I just use the text written in Org mode to present the talk. Writing things in Org mode is simple, fast and clean way. A simple search about creating presentations with Org mode landed me to few really nice blog posts where people have compared different packages, modes that can be used.

How to present using Org-mode in Emacs by Sacha Chua

After reading above blog post I decided to go with org-present. It had all the features I was expecting at that time. Basically you write your points with headings and subheading and this mode will show a heading at a time. It also replaces links to images and shows those images on screen. This is quick way to create small presentations.

Update on 6th July, 2021: I have started using org-tree-slide instead of org-present, jump to the org-tree-slide section.

Setting up org-present

Download the org-present.el from GitHub repository rlister/org-present and place it into your load path. And follow the instructions given here.

This is a small Org file which I created for a quick introduction about containers

* What is a Container?
  - Containers?
  - Lightweight virtualization?
  - Same as VMs?
  - [[file:/tmp/test-1][A system]]
  - [[https://www.docker.com/resources/what-container][What is Docker/Container: docker.com]]
* What is Docker?
  - A way to run containers
  - Server Client to run containers
* Demo time
  - sudo docker container run hello-world
  - [[https://github.com/nginxinc/docker-nginx/blob/f4d30145c60c433966df96f618d78513fee9d322/mainline/stretch/Dockerfile][Dockerfile: nginx]]
  - https://training.play-with-docker.com/

Activate org-present with M-x org-present

As we can see in above images, it shows the file content in larger font size which is suitable for presenting. It also replaces image links to inline images. And we get SRC blocks as well. The only issue is that it does not wrap the long lines if a line is going outside of the viewing area. Even if we use M-q (fill-paragraph) or visual-line-mode, some of the lines will still have the issue.

Controls are simple, C-n, C-p for next and previous slides/points. To scroll we can use C-v and C-M-v. To exit the mode C-c C-q. To adjust the font size, C-x C-- can be used.

Using org-tree-slide

I came across org-tree-slide during EmacsConf 2020, a couple of speakers were using it during their talks.

In the presentation profile, org-tree-slide shows a header with title, current date, author name etc. Each heading is shows as a separate slide. This is different than org-present or epresent which show everything including sub headings under first level heading as one slide. It also shows breadcrumbs as we proceed into nested headings. I really liked the way headings and subheadings are handled. Slides transition with the slide-in animation.

Similar to org-present, org-tree-slide also supports editing the content while presenting.

The inline images can be displayed by doing C-c C-x C-v (org-toggle-inline-images). Run M-x org-tree-slide to start the presentation, then C-> and C-< can be used for navigation.

Exporting Org files as slides

Few days later, I wanted to present ‘Autoscaling in Kubernetes’ talk during a meetup and realized that I need something which will create proper slides where I can easily add images, export it as PDF etc. While searching again, I got a nice article where they have explained how we can use Org-Reveal mode to create presentations using Org files. It uses Reveal.js to generate the HTML file which we can view in the browser.

How to create slides with Emacs Org mode and Reveal.js by Scott Nesbitt

It provides a lot of features offered by Reaveal.js like speaker notes, setting background image for slides, setting background colors, slide numbering etc. Refer the README of Org-Reveal as well as https://revealjs.com

Setting up Org-Reveal

The Requirements and Installation section from GitHub repository yjwen/org-reveal explains how to install Org-Reveal. I just added following lines to my .emacs file.

;; Load Org-Reveal
(require 'ox-reveal)
(setq org-reveal-root "https://revealjs.com/")
(setq org-reveal-title-slide nil)

Let’s take a look at snippet of kubernetes-autoscaling.org file which I wrote while creating the presentation.

#+TITLE: Autoscaling in Kubernetes
#+AUTHOR: Bhavin Gandhi
#+EMAIL: @_bhavin192
#+REVEAL_THEME: black
#+OPTIONS: num:nil toc:nil ^:nil
* Autoscaling in Kubernetes
  Bhavin Gandhi

  [[https://twitter.com/_bhavin192][@_bhavin192]]

  [[https://geeksocket.in][geeksocket.in]]
* What is autoscaling?
  [[file:images/autoscaling-explained.png]] /Image Credits: [[http://blog.infracloud.io/kubernetes-autoscaling-explained][http://blog.infracloud.io/kubernetes-autoscaling-explained]]/
* Why you need autoscaling?
  - Cost saving
  - Less downtime
...

Here I have disabled the table of content and numbering with num:nil toc: nil

To export the file, C-c C-e this will open *Org export Dispatcher* buffer, then R B. It will export the file and open it in browser window.

Reveal.js slide

The full presentation generated with the help of Org-Reveal can be found here

Syntax highlighting of code blocks

By default the syntax highlighting is done with the help of theme you are using in Emacs and htmlize.el. It’s also possible to use highlight.js to get syntax highlighting. Read more about this here

Inline code highlighting: It’s also possible to add inline code block in Org mode like this one
src_go[:exports code]{package main; func main(){print("hello")}}
Stack Overflow answer

Exporting presentations as PDF

In order to save the presentation as PDF file we have to host the HTML file somewhere or start a local HTTP server. This can be done by running this command in the directory where the HTML file is,

$ python3 -m http.server 

Open the presentation in Chromium or Chrome browser and add ?print-pdf at the end of URL. It will look line something similar to http://localhost:8000/docker-intro.html?print-pdf. Then Ctrl + P, set Margins to None and enable Background graphics. Make sure Destination is set to Save as PDF and Save.

epresent

I saw Akshay using epresent to deliver his talk about Pipenv during a PythonPune meetup. When you do M-x epresent-run it goes into full screen mode which a good feature. It renders text, code blocks, images instead of showing Org mode markup text. It’s a nice alternative to org-present but I may still stick to org-present.

Articles from Worg


Comments

Comments are not enabled on this site. The old comments might still be displayed. You can reply on one of the platforms listed in ‘Posted on’ list, or email me.

Jason Braganza on Sun Mar 24, 2019 12:47 IST

This was really handy.
will try it someday!

and this is why you should write more.
while there might be enough org mode articles to go around, you ought to share what you learn.
because it’s your voice! and your audience!

I would not learn more, if it wasn’t for a friend like you sharing and egging me on.

Loved this
And write more!

Jason Braganza on Sun Mar 24, 2019 12:51 IST

small suggestion

there are numbers on the slides
suggest that you turn them off. or use them as X out of Y slides (7/10)
just numbers gives the audience slide anxiety because they do not know when this will get over :)

bhavin192 on Mon Apr 8, 2019 20:07 IST
Replying to comment by Jason Braganza: "small suggestion there are numbers …"

Yeah! you are right, though there is blue progress bar at the bottom, but having X/Y would be a good thing. Thanks.

Jason Braganza on Mon Apr 8, 2019 21:30 IST
Replying to comment by bhavin192: "Yeah! you are right, though there …"

missed the blue bar totally. which means its pretty non intuitive :)