summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-25 23:09:41 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-25 23:09:41 +0200
commit09e61233ed5a24687e20b7dc18a1c985d423fb24 (patch)
tree7ae723cd0f088ee7d0631d51fe79bba6cf69052a
parentd9344b9ad674f567829864364a973bf452a948f0 (diff)
parent7b065b1d0a0811304a7599b9feb1c239df1a48db (diff)
downloadorg-mode-09e61233ed5a24687e20b7dc18a1c985d423fb24.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ox-odt.el75
1 files changed, 40 insertions, 35 deletions
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 364a106..a353902 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -113,7 +113,9 @@
(:odt-table-styles nil nil org-odt-table-styles)
(:odt-use-date-fields nil nil org-odt-use-date-fields)
;; Redefine regular option.
- (:with-latex nil "tex" org-odt-with-latex)))
+ (:with-latex nil "tex" org-odt-with-latex)
+ ;; Retrieve LaTeX header for fragments.
+ (:latex-header "LATEX_HEADER" nil nil newline)))
;;; Dependencies
@@ -3737,42 +3739,45 @@ contextual information."
(mathml (format "Creating MathML snippet %d..." count))))
;; Get an Org-style link to PNG image or the MathML
;; file.
- (org-link
- (let ((link (with-temp-buffer
- (insert latex-frag)
- (org-format-latex cache-subdir nil nil cache-dir
- nil display-msg nil
- processing-type)
- (buffer-substring-no-properties
- (point-min) (point-max)))))
- (if (string-match-p "file:\\([^]]*\\)" link) link
- (message "LaTeX Conversion failed.")
- nil))))
- (when org-link
+ (link
+ (with-temp-buffer
+ (insert latex-frag)
+ ;; When converting to a PNG image, make sure to
+ ;; copy all LaTeX header specifications from the
+ ;; Org source.
+ (unless (eq processing-type 'mathml)
+ (let ((h (plist-get info :latex-header)))
+ (when h
+ (insert "\n"
+ (replace-regexp-in-string
+ "^" "#+LATEX_HEADER: " h)))))
+ (org-format-latex cache-subdir nil nil cache-dir
+ nil display-msg nil
+ processing-type)
+ (goto-char (point-min))
+ (org-element-link-parser))))
+ (if (not (eq 'link (org-element-type link)))
+ (message "LaTeX Conversion failed.")
;; Conversion succeeded. Parse above Org-style link to
;; a `link' object.
- (let* ((link
- (org-element-map
- (org-element-parse-secondary-string org-link '(link))
- 'link #'identity info t))
- (replacement
- (cl-case (org-element-type latex-*)
- ;; Case 1: LaTeX environment. Mimic
- ;; a "standalone image or formula" by
- ;; enclosing the `link' in a `paragraph'.
- ;; Copy over original attributes, captions to
- ;; the enclosing paragraph.
- (latex-environment
- (org-element-adopt-elements
- (list 'paragraph
- (list :style "OrgFormula"
- :name
- (org-element-property :name latex-*)
- :caption
- (org-element-property :caption latex-*)))
- link))
- ;; Case 2: LaTeX fragment. No special action.
- (latex-fragment link))))
+ (let ((replacement
+ (cl-case (org-element-type latex-*)
+ ;;LaTeX environment. Mimic a "standalone image
+ ;; or formula" by enclosing the `link' in
+ ;; a `paragraph'. Copy over original
+ ;; attributes, captions to the enclosing
+ ;; paragraph.
+ (latex-environment
+ (org-element-adopt-elements
+ (list 'paragraph
+ (list :style "OrgFormula"
+ :name
+ (org-element-property :name latex-*)
+ :caption
+ (org-element-property :caption latex-*)))
+ link))
+ ;; LaTeX fragment. No special action.
+ (latex-fragment link))))
;; Note down the object that link replaces.
(org-element-put-property replacement :replaces
(list (org-element-type latex-*)