ox-pandoc - org-mode + org-ref to docx with bibliographies

| categories: pandoc, orgmode, docx | tags:

There is a new org-mode exporter: ox-pandoc . It seems like it makes it easy to convert org-mode to other formats, including docx, and including references in a bibliography. Let us try it out.

1 The setup

We have to modify org-ref org-ref modifies helm-bibtex to insert citation links. We have to undo that here to insert LaTeX style citations. We do that here so that the key binding for inserting references from org-ref inserts the LaTeX citations. This is necessary for pandoc to convert the reference citations to the bibliography in the docx format. If you do not use org-ref, this is probably not necessary.

(setq helm-bibtex-format-citation-functions
      '((org-mode . (lambda (x) (insert (concat
                                         "\\cite{"
                                         (mapconcat 'identity x ",")
                                         "}")) ""))))
org-mode lambda (x) (insert (concat \cite{ (mapconcat (quote identity) x ,) }))

We have to add ox-pandoc and require it.

(add-to-list 'load-path (expand-file-name "ox-pandoc" starter-kit-dir))
(require 'ox-pandoc)

2 The document

Now, for some text. Grindy wrote this nice paper on approaching chemical accuracy with density functional calculations \cite{grindy-2013-approac}. Two other interesting papers include these ones \cite{guldner-1961,guerrini-2008-effec-feo}.

An equation: \(e^x = 4\).

And a figure with a caption:

Figure 1: Make sure this is in your org-file.

3 Summary

This is better than what I have seen in the past. ox-pandoc has some options that might tailor the bibliography to specific formats. You lose some functionality of org-ref cite links by using raw LaTeX, but if that is not a deal breaker this might be a good way to go for some purposes.

Here is the word document that results from this file: test-doc.docx

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

org-mode source

Org-mode version = 8.2.10

Discuss on Twitter