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.

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) 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.

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 Python Pune meetup. When you do M-x epresent-run it goes into full screen mode which a good feature. It’s a nice alternative to org-present but I may still stick to org-present.

Articles from Worg


Comments

comments powered by Disqus