Skip to main content

13.12.9 Math formatting in ODT export

The ODT exporter has special support for handling math.

β€’ LaTeX math snippetsΒ Β Embedding in LaTeX format.
β€’ MathML and OpenDocument formula filesΒ Β Embedding in native format.

13.12.9.1 LaTeX math snippets​

LaTeX math snippets (see LaTeX fragments) can be embedded in the ODT document in one of the following ways:

MathML​

Add this line to the Org file. This option is activated on a per-file basis.

#+OPTIONS: tex:t

With this option, LaTeX fragments are first converted into MathML fragments using an external LaTeX-to-MathML converter program. The resulting MathML fragments are then embedded as an OpenDocument Formula in the exported document.

You can specify the LaTeX-to-MathML converter by customizing the variables org-latex-to-mathml-convert-command and org-latex-to-mathml-jar-file.

If you prefer to use MathToWeb1 as your converter, you can configure the above variables as shown below.

(setq org-latex-to-mathml-convert-command
"java -jar %j -unicode -force -df %o %I"
org-latex-to-mathml-jar-file
"/path/to/mathtoweb.jar")

or, to use LaTeX​ML2 instead,

(setq org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o")

To quickly verify the reliability of the LaTeX-to-MathML converter, use the following commands:

M-x org-export-as-odf​

Convert a LaTeX math snippet to an OpenDocument formula (β€˜.odf’) file.

M-x org-export-as-odf-and-open​

Convert a LaTeX math snippet to an OpenDocument formula (β€˜.odf’) file and open the formula file with the system-registered application.

PNG images​

Add this line to the Org file. This option is activated on a per-file basis.

#+OPTIONS: tex:dvipng
#+OPTIONS: tex:dvisvgm

or

#+OPTIONS: tex:imagemagick

Under this option, LaTeX fragments are processed into PNG or SVG images and the resulting images are embedded in the exported document. This method requires dvipng program, dvisvgm or ImageMagick programs.

13.12.9.2 MathML and OpenDocument formula files​

When embedding LaTeX math snippets in ODT documents is not reliable, there is one more option to try. Embed an equation by linking to its MathML (β€˜.mml’) source or its OpenDocument formula (β€˜.odf’) file as shown below:

[[./equation.mml]]

or

[[./equation.odf]]