emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* A way to export to ODT
@ 2018-05-16  1:31 edgar
  0 siblings, 0 replies; only message in thread
From: edgar @ 2018-05-16  1:31 UTC (permalink / raw)
  To: emacs-orgmode

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!  

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-16  1:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16  1:31 A way to export to ODT edgar

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).