Next: , Previous: , Up: Top   [Contents][Index]


3 Getting Started with ODT export


3.1 Pre-requisites for ODT export

The ODT backend depends on the following programs

ProgramPurpose
zip1To produce OpenDocument files
unzip2To unzip custom styles
identify3To identify the size of an inline image
latex4To compile LaTeX fragments to ‘dvi’ images
dvisgm5To convert ‘dvi’ images to ‘svg
dvipng6To convert ‘dvi’ images to ‘png
convert7To convert inline ‘pdf’ to ‘png
latexmlmath8To convert LaTeX math snippets to MathML
mathtoweb9
jabref10To handle bibliography and citations

Of these, ‘zip’ is essential. Rest are optional.


3.2 Installation

You can install the OpenDocument Text export backend using the Emacs package manager. The archive URL for the package is https://kjambunathan.github.io/elpa/.

A typical configuration look like this

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("ox-odt" . "https://kjambunathan.github.io/elpa/")))))

In the ‘*Packages*’ buffer, packages from this archive show up as below

JabrefExportChicagoODF 1.2.2      ... Jabref Plugin for export to Chicago Manual of Style in OpenDocumentFormat
ox-odt                 9.2.6.263  ... OpenDocument Text Exporter for Org Mode

3.3 Configuration

Here is a sample configuration.

(custom-set-variables
 '(org-odt-convert-process "LibreOffice")
 '(org-odt-preferred-output-format "docx")
 '(org-odt-transform-processes
   '(("Optimize Column Width of all Tables"
      "soffice" "--norestore" "--invisible" "--headless"
      "macro:///OrgMode.Utilities.OptimizeColumnWidth(%I)")
     ("Update All"
      "soffice" "--norestore" "--invisible" "--headless"
      "macro:///OrgMode.Utilities.UpdateAll(%I)")
     ("Reload"
      "soffice" "--norestore" "--invisible" "--headless"
      "macro:///OrgMode.Utilities.Reload(%I)")))
 '(org-jabref-command '("/opt/jabref/bin/JabRef" "-n"))
 '(org-latex-to-mathml-convert-command
   "java -jar %j -unicode -force -df %o %I")
 '(org-latex-to-mathml-jar-file
   "/home/kjambunathan/Downloads/mathtoweb.jar"))

(require 'ox-odt)
(require 'ox-jabref)

;; (setcdr (assq 'system org-file-apps-defaults-gnu) "xdg-open %s")
(setcdr (assq 'system org-file-apps-gnu) "xdg-open %s")

(advice-add 'org-open-file :around
            (lambda (orig-fun &rest args)
              ;; Work around a weird problem with xdg-open.
              (let ((process-connection-type nil))
                (apply orig-fun args))))

Above configuration sets up the ODT backend as follows:

  1. Use ‘"LibreOffice"’ (i.e., ‘soffice’ executable) as the document converter
  2. Generate a ‘docx’ document for every ‘odt’ document
  3. Process the ‘odt’ document with a set of LibreOffice Basic Macros to
  4. Tell where your ‘JabRef’ and ‘mathtoweb’ executables are located, and how they are invoked.
  5. (if you are using a GNU system) open the ‘odt’ document with your preferred OpenDocument viewer, presumably ‘LibreOffice’.
  6. Load ‘ox-jabref’ so as to produce documents with bibliography and citations .

Footnotes

(1)

Info-ZIP

(2)

Info-ZIP

(3)

ImageMagick

(4)

TeX Live

(5)

TeX Live

(6)

dvipng

(7)

ImageMagick

(8)

LaTeXML

(9)

MathToWeb

(10)

JabRef


Previous: , Up: Getting Started with ODT export   [Contents][Index]