Hacker News new | ask | show | jobs
by kmundnic 2526 days ago
How do you deal with different sections from google docs? As in, how do you format these into markdown or latex sections?

I've been working with psychologists and I've taught them the basics of a latex document, but I see how extracting the sections they have written from a google doc could be useful.

1 comments

I wrote a docs api v1 -> org converter in python. I just pulled it into its own repo and it still has a bunch of dependencies related to how I handle auth for other projects, but if you want to take a look it is at [0]. There is an example of how I use the Docs class in an org source bock in the readme (note that I use evil mode, and that you need to view raw to see everything that is going on with the headers). It currently requires a little dance to get everything in the right place at the right indent level, but it could be fully automated. I'm in the process of writing a converter going the other direction in elisp, and I will probably rewrite the python into elisp at some point as well, but for now, following the keystrokes is faster for me than trying to reimplement it to integrate with the org-mode api.

As an overview I use the heading level in the google doc as the corresponding * level (e.g. h1 -> , h2 -> *, etc.). Nearly every construct in the google doc has a 1:1 mapping with some org mode convention (there are some things that I still write in org-syntax in the google doc, such as figure captions and stuff like that.

If I need to export to markdown from org I usually try pandoc (I very rarely do this though). Importing from markdown I use pandoc as well, newer versions do a pretty good job and only need a few tweaks from time to time. Latex export is straight forward using org-mode's built in exporter [1] via the export dispatcher. For full pdf export I use lualatex via texlive with all the pain that that entails.

0. https://github.com/tgbugs/gdocorgpy 1. https://orgmode.org/manual/LaTeX-export.html 2. https://orgmode.org/manual/The-Export-Dispatcher.html#The-Ex...