Spice Up Document Writing with Emacs Org-Mode

Introduction

In this tutorial, I want to explore few tools and plugins that helps with writing documents with org-mode.

Built-in Features

By default Emacs opens the whole document. You can use tabs to collapse certain sections. However, on a big document it gets cluttered pretty easily. There are commands like org-narrow-to-subtree, org-toggle-narrow-to-subtree and widen. These features help to focus on certain sections and come out of it. However, they are may not be obvious to many users.

Needed Feature

There is also a need to have a sidebar (like TOC) to track all the headings all the times. You can use a package called org-sidebar that helps with both of the above features (only focusing on a certain section, and keeping a TOC like sidebar). After installing the package use org-sidebar-tree command. You can use mouse or other shortcuts to select a section and only that part will show on right-side where you can work on that part of the document.

Converting document

I like to convert the org document to PDF and EPub formats (mostly epub). Instead of setting up various packages in emacs, I like to use command line tool (pandoc) to convert the document. I usually setup an alias in my .bashrc to convert the document that I am currently working on.

E.g. alias bookconvert=’/location_of_pandoc_installation/pandoc-3.1.2/bin/pandoc -f org -t epub3 /source_directory/my_book_notes.org –metadata title=”Awesome Title” -o ~/Desktop/awesome_book.epub’

Adjust location_of_pandoc_installation, source_directory, title and output file location and format according to your requirement.

Once, I have above command setup, I can run the command to convert the document anytime I want to export the document to epub.

References

  1. https://github.com/alphapapa/org-sidebar
  2. https://github.com/jgm/pandoc/releases

Leave a comment

Filed under Uncategorized

Leave a comment