Function: org-odt-export-as-odf
org-odt-export-as-odf is an autoloaded, interactive and byte-compiled
function defined in ox-odt.el.gz.
Signature
(org-odt-export-as-odf LATEX-FRAG &optional ODF-FILE)
Documentation
Export LATEX-FRAG as OpenDocument formula file ODF-FILE.
Use org-create-math-formula to convert LATEX-FRAG first to
MathML. When invoked as an interactive command, use
org-latex-regexps to infer LATEX-FRAG from currently active
region. If no LaTeX fragments are found, prompt for it. Push
MathML source to kill ring depending on the value of
org-export-copy-to-kill-ring.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
;;;; Export to OpenDocument formula
;;;###autoload
(defun org-odt-export-as-odf (latex-frag &optional odf-file)
"Export LATEX-FRAG as OpenDocument formula file ODF-FILE.
Use `org-create-math-formula' to convert LATEX-FRAG first to
MathML. When invoked as an interactive command, use
`org-latex-regexps' to infer LATEX-FRAG from currently active
region. If no LaTeX fragments are found, prompt for it. Push
MathML source to kill ring depending on the value of
`org-export-copy-to-kill-ring'."
(interactive
`(,(let (frag)
(setq frag (and (setq frag (and (region-active-p)
(buffer-substring (region-beginning)
(region-end))))
(cl-loop for e in org-latex-regexps
thereis (when (string-match (nth 1 e) frag)
(match-string (nth 2 e) frag)))))
(read-string "LaTeX Fragment: " frag nil frag))
,(let ((odf-filename (expand-file-name
(concat
(file-name-sans-extension
(or (file-name-nondirectory buffer-file-name)))
"." "odf")
(file-name-directory buffer-file-name))))
(read-file-name "ODF filename: " nil odf-filename nil
(file-name-nondirectory odf-filename)))))
(let ((filename (or odf-file
(expand-file-name
(concat
(file-name-sans-extension
(or (file-name-nondirectory buffer-file-name)))
"." "odf")
(file-name-directory buffer-file-name)))))
(org-odt--export-wrap
filename
(let* ((buffer (progn
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect (concat org-odt-zip-dir
"content.xml") t))))
(coding-system-for-write 'utf-8)
(save-buffer-coding-system 'utf-8))
(set-buffer buffer)
(set-buffer-file-coding-system coding-system-for-write)
(let ((mathml (org-create-math-formula latex-frag)))
(unless mathml (error "No Math formula created"))
(insert mathml)
;; Add MathML to kill ring, if needed.
(when (org-export--copy-to-kill-ring-p)
(org-kill-new (buffer-string))))))))