mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:00:49 +00:00
Merge branch 'maint'
This commit is contained in:
commit
09e61233ed
|
@ -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-*)
|
||||
|
|
Loading…
Reference in a new issue