在 2025/3/26 2:37, Ihor Radchenko 写道:
Billy Lei <leiyixi...@outlook.com> writes:

Subject: [PATCH] org-preview-latex-process-alist: Add xdv support for latex
  preview

* lisp/org.el (org-preview-latex-process-alist): Add new process "xelatex" to 
allow using xelatex to generate latex preview.

Thanks for the patch!

       :image-size-adjust (1.7 . 1.5)
       :latex-compiler ("latex -interaction nonstopmode -output-directory %o 
%f")
       :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S 
--output=%O"))
+    (xelatex
+     :programs ("xelatex" "dvisvgm")
+     :description "xdv > svg"
+     :message "you need to install the programs: xelatex and dvisvgm."
+     :image-input-type "xdv"
+     :image-output-type "svg"
+     :image-size-adjust (1.0 . 1.0)

Any reason you are using different value for :image-size-adjust here?

Also, please update :package-version tag in the defcustom and announce
the new value in the ORG-NEWS.


I've updated it to use (1.7 . 1.5) size adjust option. The :package-version tag and ORG-NEWS are also updated.
From e45350529359e39368bcd29241347ccf071bcb52 Mon Sep 17 00:00:00 2001
From: Leilei332 <leiyixi...@outlook.com>
Date: Sat, 22 Mar 2025 10:20:56 +0800
Subject: [PATCH] org-preview-latex-process-alist: Add xdv support for latex
 preview

* lisp/org.el (org-preview-latex-process-alist): Add new process "xelatex" to 
allow using xelatex to generate latex preview.
---
 etc/ORG-NEWS |  4 ++++
 lisp/org.el  | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 332586f..c4957e0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -237,6 +237,10 @@ You may return to the previous behaviour by setting
 Note that Emacs warnings can always be suppressed by clicking on ⛔
 symbol or by customizing ~warning-suppress-types~.
 
+*** Add xdv support for LaTeX preview
+
+A new process =xelatex= is added to ~org-preview-process-alist~ to allow 
generating LaTeX fragment preview through xdv file produced by XeLaTeX, which 
has better support for Unicode.
+
 *** New option ~org-edit-keep-region~
 
 Since Org 9.7, structure editing commands do not deactivate region
diff --git a/lisp/org.el b/lisp/org.el
index ebc8894..63b158b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3392,6 +3392,15 @@ All available processes and theirs documents can be 
found in
      :image-size-adjust (1.7 . 1.5)
      :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
      :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S 
--output=%O"))
+    (xelatex
+     :programs ("xelatex" "dvisvgm")
+     :description "xdv > svg"
+     :message "you need to install the programs: xelatex and dvisvgm."
+     :image-input-type "xdv"
+     :image-output-type "svg"
+     :image-size-adjust (1.7 . 1.5)
+     :latex-compiler ("xelatex -no-pdf -interaction nonstopmode 
-output-directory %o %f")
+     :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S 
--output=%O"))
     (imagemagick
      :programs ("latex" "convert")
      :description "pdf > png"
@@ -3453,7 +3462,7 @@ Place-holders only used by `:image-converter':
   %S    the image size scale ratio, which is used to adjust image size by some
         processing commands."
   :group 'org-latex
-  :package-version '(Org . "9.6")
+  :package-version '(Org . "9.8")
   :type '(alist :tag "LaTeX to image backends"
                :value-type (plist)))
 
-- 
2.48.1.windows.1

Reply via email to