diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 99dd8839c..3c597db40 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -710,6 +710,19 @@ any more. Run ~org-ctags-enable~ to setup hooks and advices: #+end_src ** New and changed options +*** =ob-latex= now uses a new option ~org-babel-latex-process-alist~ to generate png output + +Previously, =ob-latex= used ~org-preview-latex-default-process~ from +~org-preview-latex-process-alist~ to produce png output. Now, the +process settings are separated into a new dedicated option +~org-babel-latex-process-alist~. + +The default value is pulled from =dvipng= process type from +~org-preview-latex-process-alist~, preserving the existing behavior. +However, the output is now immune to changes in +~org-preview-latex-default-process~ and can be customized +independently of the image preview settings. + *** ~org-babel-lua-multiple-values-separator~ The string that separates the values of multi-valued results returned diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index 866ae1ba1..58051fae1 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -52,6 +52,7 @@ (defvar org-format-latex-options) ; From org.el (defvar org-latex-default-packages-alist) ; From org.el (defvar org-latex-packages-alist) ; From org.el +(defvar org-preview-latex-process-alist) ; From org.el (defvar org-babel-default-header-args:latex '((:results . "latex") (:exports . "results")) @@ -128,6 +129,18 @@ exporting the literal LaTeX source." :group 'org-babel :type '(repeat (string))) +(defcustom org-babel-latex-process-alist + `(,(cons 'png (alist-get 'dvipng org-preview-latex-process-alist))) + "Definitions of external processes for LaTeX result generation. +See `org-preview-latex-process-alist' for more details. + +The following process symbols are recognized: +- `png' :: Process used to produce .png output." + :group 'org-babel + :package-version '(Org . "9.7") + :type '(alist :tag "LaTeX to image backends" + :value-type (plist))) + (defun org-babel-expand-body:latex (body params) "Expand BODY according to PARAMS, return the expanded body." (mapc (lambda (pair) ;; replace variables @@ -169,9 +182,10 @@ This function is called by `org-babel-execute-src-block'." ((and (string-suffix-p ".png" out-file) (not imagemagick)) (let ((org-format-latex-header (concat org-format-latex-header "\n" - (mapconcat #'identity headers "\n")))) + (mapconcat #'identity headers "\n"))) + (org-preview-latex-process-alist org-babel-latex-process-alist)) (org-create-formula-image - body out-file org-format-latex-options in-buffer))) + body out-file org-format-latex-options in-buffer 'png))) ((string= "svg" extension) (with-temp-file tex-file (insert (concat (funcall org-babel-latex-preamble params)