Pandoc does org-mode now

| categories: uncategorized | tags: | View Comments

Pandoc (http://johnmacfarlane.net/pandoc/ ) is a document converter. It does a pretty good job of converting a document in one format to another. Pandoc also knows about org-mode now, and can convert an org-file to a Word document! We are going to test it out in this post to see what it does well with.

1 A subsection with some equations

Einstein showed us that \(E = mc^2\).

A matrix looks like this:

\begin{equation} \begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix} \end{equation}

2 A section with a figure

Here is a figure in the document.

Figure 1: A cosine function.

3 A section with a table

Table 1: A simple table.
x y
1 1
2 4
3 9

4 Some citations

For fun, a reference to the org-mode book dominik-2010-org-mode.

5 some source code

here is a python block.

print 'hello pandoc'
hello pandoc

and finally, we write a block that will convert this file to a word document.

(save-buffer)
(shell-command "pandoc -s -s org-to-word.org -o org-to-word.docx")
0

Now, here is that org-to-word.docx

it is pretty good, and blazing fast. The output is not quite as good as the native org to pdf (org-to-word.pdf ), but since the translation is happening outside of Emacs the results are still pretty impressive, and if you need a Word document there is no substitute 1. The simple equation was translated to a Word equation format (cool!) but the matrix did not show up in the word document, nor did the figure caption. The code does show up, but the lines are not numbered as they are in the pdf. The citation did not work out of the box. The User guide suggests it might be possible to get this to work with a citations extension though.

I am impressed that the Word document has proper section headings. Overall, my impression is that this is a very good way to get 90+% of the way to a finished word document with an org-source file!

Footnotes:

1

Ok, there is the ODT export engine. So far I have not been able to make that export documents that Word can open though, and it takes more configuration than just installing Pandoc.

Copyright (C) 2014 by John Kitchin. See the License for information about copying.

org-mode source

Org-mode version = 8.2.6

blog comments powered by Disqus