branch: externals/org
commit c426f49364ac0effb89ef4da47e1450994c3ddba
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-babel-latex-process-alist: Use latemk or run latex trice
    
    * lisp/ob-latex.el (org-babel-latex-process-alist): Change the default
    value to using latexmk/latex x 3, so that references are resolved.
    * etc/ORG-NEWS (The default value of
    ~org-babel-latex-process-alist~...): Announce the change.
    
    Link: https://list.orgmode.org/orgmode/87cyretut7.fsf@localhost/
---
 etc/ORG-NEWS     | 13 ++++++++++---
 lisp/ob-latex.el | 16 ++++++++++++++--
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b2e113cc79..4b0b77ca89 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -18,16 +18,23 @@ Please send Org bug reports to mailto:emacs-orgm...@gnu.org.
 # require user action for most Org mode users.
 # Sorted from most important to least important.
 
+** New features
+
+# We list the most important features, and the features that may
+# require user action to be used.
+
 ** New and changed options
 
 # Chanes deadling with changing default values of customizations,
 # adding new customizations, or changing the interpretation of the
 # existing customizations.
 
-** New features
+*** The default value of ~org-babel-latex-process-alist~ is no longer taken 
from ~org-preview-latex-process-alist~
 
-# We list the most important features, and the features that may
-# require user action to be used.
+The default value used to be pulled from =dvipng= process type from
+~org-preview-latex-process-alist~.  Now, it defaults to using
+=latexmk= (when available), or running =latex= multiple times, so that
+all the references are resolved in the generated png.
 
 ** New functions and changes in function arguments
 
diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index 58051fae19..b72ca06251 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -130,14 +130,26 @@ exporting the literal LaTeX source."
   :type '(repeat (string)))
 
 (defcustom org-babel-latex-process-alist
-  `(,(cons 'png (alist-get 'dvipng org-preview-latex-process-alist)))
+  `((png :programs ("latex" "dvipng") :description "dvi > png"
+        :message
+        "you need to install the programs: latex and dvipng."
+        :image-input-type "dvi" :image-output-type "png"
+        :image-size-adjust (1.0 . 1.0) :latex-compiler
+         ,(if (executable-find "latexmk")
+              '("latexmk -f -pdf -latex -interaction=nonstopmode 
-output-directory=%o %f")
+            '("latex -interaction nonstopmode -output-directory %o %f"
+              "latex -interaction nonstopmode -output-directory %o %f"
+              "latex -interaction nonstopmode -output-directory %o %f"))
+        :image-converter ("dvipng -D %D -T tight -o %O %f")
+        :transparent-image-converter
+        ("dvipng -D %D -T tight -bg Transparent -o %O %f")))
   "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")
+  :package-version '(Org . "9.8")
   :type '(alist :tag "LaTeX to image backends"
                :value-type (plist)))
 

Reply via email to