0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 20:07:46 +00:00

Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-06-25 23:09:41 +02:00
commit 09e61233ed

View file

@ -113,7 +113,9 @@
(:odt-table-styles nil nil org-odt-table-styles) (:odt-table-styles nil nil org-odt-table-styles)
(:odt-use-date-fields nil nil org-odt-use-date-fields) (:odt-use-date-fields nil nil org-odt-use-date-fields)
;; Redefine regular option. ;; 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 ;;; Dependencies
@ -3737,42 +3739,45 @@ contextual information."
(mathml (format "Creating MathML snippet %d..." count)))) (mathml (format "Creating MathML snippet %d..." count))))
;; Get an Org-style link to PNG image or the MathML ;; Get an Org-style link to PNG image or the MathML
;; file. ;; file.
(org-link (link
(let ((link (with-temp-buffer (with-temp-buffer
(insert latex-frag) (insert latex-frag)
(org-format-latex cache-subdir nil nil cache-dir ;; When converting to a PNG image, make sure to
nil display-msg nil ;; copy all LaTeX header specifications from the
processing-type) ;; Org source.
(buffer-substring-no-properties (unless (eq processing-type 'mathml)
(point-min) (point-max))))) (let ((h (plist-get info :latex-header)))
(if (string-match-p "file:\\([^]]*\\)" link) link (when h
(message "LaTeX Conversion failed.") (insert "\n"
nil)))) (replace-regexp-in-string
(when org-link "^" "#+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 ;; Conversion succeeded. Parse above Org-style link to
;; a `link' object. ;; a `link' object.
(let* ((link (let ((replacement
(org-element-map (cl-case (org-element-type latex-*)
(org-element-parse-secondary-string org-link '(link)) ;;LaTeX environment. Mimic a "standalone image
'link #'identity info t)) ;; or formula" by enclosing the `link' in
(replacement ;; a `paragraph'. Copy over original
(cl-case (org-element-type latex-*) ;; attributes, captions to the enclosing
;; Case 1: LaTeX environment. Mimic ;; paragraph.
;; a "standalone image or formula" by (latex-environment
;; enclosing the `link' in a `paragraph'. (org-element-adopt-elements
;; Copy over original attributes, captions to (list 'paragraph
;; the enclosing paragraph. (list :style "OrgFormula"
(latex-environment :name
(org-element-adopt-elements (org-element-property :name latex-*)
(list 'paragraph :caption
(list :style "OrgFormula" (org-element-property :caption latex-*)))
:name link))
(org-element-property :name latex-*) ;; LaTeX fragment. No special action.
:caption (latex-fragment link))))
(org-element-property :caption latex-*)))
link))
;; Case 2: LaTeX fragment. No special action.
(latex-fragment link))))
;; Note down the object that link replaces. ;; Note down the object that link replaces.
(org-element-put-property replacement :replaces (org-element-put-property replacement :replaces
(list (org-element-type latex-*) (list (org-element-type latex-*)