Org Mode To Google Docs and Beyond

| foss | software |

Introduction

The other day I was attempting to make a structured document. It has been years since I have done this and I have forgotten what a pain in the ass most word processing software is. When I used to work for a .NET enterprise health care company, I would often find myself in "Word Hell" with no hope of ever returning. This time I found myself in a new place, Google Docs Hell. It's similar to Word hell, but runs in the cloud. All that I was really trying to do was create a document with numbered headings and a simple table of contents that links to said headings. I suppose that this is too much to ask for because although I was able to get my headings to work more or less, as soon as I tried to add content under the headings Google Docs decided that I really wanted random page breaks after every heading. After banging my head against the wall for a few minutes, with no clue on how to even begin to troubleshoot this issue, I busted out my trusty old friend Emacs. Emacs Org Mode has never failed me. I remember back in college when I needed to add code snippets or non-trivial equations into a document that I was working on, and this was a seemingly impossible task in any word processor that I found. Org Mode is well suited for this type of task since it is a plain text system, and in my experience plain text combined with a sane "compiler" is the only way to truly have WYSIWYG. Other native WYSIWYG editors like Word, Pages, Google Docs, and even LibreOffice are very complex pieces of software, so figuring out why a random page break is being inserted in the middle of an ordered list is only possible if you have no value for your time.

Enabling Org Mode Exporting to ODT

Recent versions of Org Mode are capable of exporting directory to ODT format, and it works more or less very well, but the documentation is not the greatest. For instance, this page says:
The ODT exporter relies on the zip program to create the final output. Check the availability of this program before proceeding further.
But it does not really tell you what zip really is. I am assuming its whatever is in my $PATH on OS X, but I can't really be too sure.
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
Also, no where in the docs does it tell you how to enable ODT exporting. In order to be able to export to ODT like you would export to any other format using the C-c C-e export menu, you need to explicitly enable ox-odt somewhere in your org-mode configuration file. Check out my .emacs.d repo for an example, but essentially adding this somewhere in your startup scripts should do the trick:
;; Load ODT backend to allow for exporting to open document format.
(require 'ox-odt)

Exporting to ODT

With all of that out of the way, we are free to start exporting things to ODT. Fire up org mode and write your document to your hearts content. When you are finished you can export it to ODT with C-c C-e o o. Opening up this file in LibreOffice or OpenOffice should show you a really nice representation of whatever you just wrote. The best part about this method is that you get a table of contents, and section numbering for free. In addition, you do not have to keep track of the numbers yourself, if you need to move stuff around or add new sections then org mode export will automatically update the numbering for you. Besides being able to export to ODT, org-mode also supports exporting to about a dozen other formats. If you have LaTeX and pandoc installed then the sky is truly the limit.

Uploading to Google Docs

While the editing capabilities of Google Docs are suspect, it is difficult to argue that its not one of the best tools for collaborating with your team. Unless you are writing a manifesto in a cabin, you likely want to share your latest creation with your team for feedback. I would not recommend uploading the ODT directly to Google Docs, since the formatting can get a bit thrown off. Instead I suggest exporting the file from LibreOffice into .doc or .docx and then uploading that. From my preliminary experiments this seemed to work the best.

Conclusion

If you are writing a complex structured document, especially one with formulas or code snippets. You will be hard pressed to find a better environment than Emacs with org-mode. Enabling the ODT export in org-mode makes it fairly simple to upload your documents to Google Docs and be able to collaborate with your team.

Thank you for reading! Share your thoughts with me on bluesky, mastodon, or via email.

Check out some more stuff to read down below.

Most popular posts this month

Recent Favorite Blog Posts

This is a collection of the last 8 posts that I bookmarked.

Articles from blogs I follow around the net

17/11/2024

# Back in May I wrote about being inspired to write a track based on a YouTube comment. I recorded a test not long after and built on that into June. Then the breakdown struck and I had a massive crisis of confidence alongside the depression and anxiety. I …

via Colin Walker - Daily Feed November 23, 2024

Weeknotes: asynchronous LLMs, synchronous embeddings, and I kind of started a podcast

These past few weeks I've been bringing Datasette and LLM together and distracting myself with a new sort-of-podcast crossed with a live streaming experiment. Project: interviewing people about their projects Datasette Public Office Hours Async LLM …

via Simon Willison's Weblog: Entries November 22, 2024

DNA Lounge: Wherein it's our birthday

DNA Lounge is 39 years old today, having opened on November 22, 1985! Our oldest known flyer. Photos from opening night. Our "Legacy" plaque. If you'd like us to stick around for the next four decades, or until the oceans boil, the stars weep bloo…

via jwz November 22, 2024

Generated by openring