emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] A way to export to ODT


From: edgar
Subject: [O] A way to export to ODT
Date: Wed, 16 May 2018 01:31:20 +0000
User-agent: Roundcube Webmail/1.2.4

I want to share this little recipe in the hope that it is useful to someone. It is a partial solution to exporting with MathML to ODT from Org. I am not a fan of ODT, but my boss need DOCX like dope.

To get a working file
1. To get siunitx (partially) working, download [[https://github.com/Authorea/LaTeXML/blob/master/lib/LaTeXML/Package/siunitx.sty.ltxml][siunitx.sty.ltxml from Authorea's github.com]] (there is an issue on the upstream [[https://github.com/brucemiller/LaTeXML][LaTeXML]] for this already; the author may be more motivated is someone else asks for it and/or helps) and save it somewhere (remember this location, you'll need it later). Here, ~~/.emacs.d/plugins~ is used.

Do ~C-c C-c~ or ~C-c C-v C-e~ (src_emacs-lisp{(org-babel-execute-maybe)}) on the following block to add ~\mathrm{ยท}~ to the symbols (this removes italics from units). Change the path to the file accordingly.
   #+BEGIN_SRC bash
sed -i "s-\(DefMacro.*\)'\([[:alpha:]]*\)'-\1'\\\\mathrm{\2}'-g" ~/.emacs.d/plugins/siunitx.sty.ltxml
   #+END_SRC

Add any required symbol to that same file (note that there is a ~\mm~ which should be ~\mmHg~; commit e134a5b @ Jul 24, 2017). Note that if you add something like ~DefMacro('\mm','some');~, strange things start to happen.

2. Install ~latexml~ (with ~latexmlmath~; https://dlmf.nist.gov/LaTeXML/get.html). Then, execute this command in Emacs (change ~latexmlmath~ to the actual path)
   #+BEGIN_SRC emacs-lisp
     (setq org-latex-to-mathml-convert-command
"latexmlmath --presentationmathml=%o --preload=siunitx --path=~/.emacs.d/plugins/ --includestyles \"%i\"")
   #+END_SRC

3. Set the ~#+OPTIONS: LaTeX:t~ somewhere in the document

4. Export to odt with Org-mode (~C-c C-e o o~), and run this (you can do ~C-c C-c~ on it; make sure that LibreOffice is not running)
   #+BEGIN_SRC shell
libreoffice --headless --convert-to doc ./<this-file-sans-extension>.odt
   #+END_SRC

You can use a template with the line (change file name accordingly). Modify the file at will.
   #+BEGIN_SRC org
     ,#+ODT_STYLES_FILE: "../Templates/odt-review-template.ott"
   #+END_SRC

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]