Ihor Radchenko <[email protected]> writes:

> Maybe you can use full argument versions instead of short ones?

Good idea, Ihor!  Please see the two attached patches.  I re-attach the
first patch again because I reworded the first line of its commit
message to put more emphasis on the term "exact".

Rudy

>From b1be654ba28ceca60d0b12778d374db27e6eced5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <[email protected]>
Date: Wed, 23 Nov 2022 23:03:37 +0100
Subject: [PATCH 1/2] org.el: Compute bounds exactly when converting LaTeX
 output to SVG

* lisp/org.el (org-preview-latex-process-alist): Call `dvisvgm' with
`-e' (`--exact-bbox') instead of `-b min' (`--bbox=min') to measure
the exact bounds around visual glyphs, as opposed to using font
metrics, to avoid clipping at the edges.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 64b33e597..2f473f54d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3243,7 +3243,7 @@ All available processes and theirs documents can be found in
      :image-output-type "svg"
      :image-size-adjust (1.7 . 1.5)
      :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
-     :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
+     :image-converter ("dvisvgm %f -n -e -c %S -o %O"))
     (imagemagick
      :programs ("latex" "convert")
      :description "pdf > png"
-- 
2.38.1

>From 34e3ecd3b23fae330574fe1cbcb3154b2fb8a2c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <[email protected]>
Date: Thu, 24 Nov 2022 21:41:35 +0100
Subject: [PATCH 2/2] org.el: Use long option names when launching dvisvgm

* lisp/org.el (org-preview-latex-process-alist): Use long option names
when launching dvisvgm, optimizing for maintainability, instead of
brevity.  For example, use `--no-fonts' instead of `-n'.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2f473f54d..472e87b9b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3243,7 +3243,7 @@ All available processes and theirs documents can be found in
      :image-output-type "svg"
      :image-size-adjust (1.7 . 1.5)
      :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
-     :image-converter ("dvisvgm %f -n -e -c %S -o %O"))
+     :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S --output=%O"))
     (imagemagick
      :programs ("latex" "convert")
      :description "pdf > png"
-- 
2.38.1

-- 
"I love deadlines.  I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt, 2002

Rudolf Adamkovič <[email protected]> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

Reply via email to