ob-latex: New custom option `org-babel-latex-process-alist'
* lisp/ob-latex.el (org-babel-latex-process-alist): New variable. (org-babel-execute:latex): Override `org-preview-latex-process-alist' when generating png output, making sure that the process yields an actual png image, even when `org-preview-latex-default-process' is non-default. * etc/ORG-NEWS (=ob-latex= now uses a new option ~org-babel-latex-process-alist~ to generate png output): Announce the change. Reported-by: Ihor Radchenko <yantar92@posteo.net> Link: https://orgmode.org/list/87cyretut7.fsf@localhost
This commit is contained in:
parent
e09ad15a71
commit
43ba00b2b1
13
etc/ORG-NEWS
13
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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue