emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix clipped LaTeX fragments (not Babel)
@ 2022-11-23 23:07 Rudolf Adamkovič
  2022-11-23 23:12 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Adamkovič @ 2022-11-23 23:07 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

Hi smart folks!

In aaccbb2f9, I fixed the clipping problems plaguing Babel LaTeX/SVG
output by adjusting Inkscape arguments.  Here, I fix the same problem
but for Org LaTeX fragments, this time adjusting dvisvgm arguments.
Also, I also made before/after screenshots, so that you can readily see
the difference.  Thank you for your time!

Rudy


[-- Attachment #2: test-old.png --]
[-- Type: image/png, Size: 110569 bytes --]

[-- Attachment #3: test-new.png --]
[-- Type: image/png, Size: 112240 bytes --]

[-- Attachment #4: old.png --]
[-- Type: image/png, Size: 20223 bytes --]

[-- Attachment #5: new.png --]
[-- Type: image/png, Size: 20077 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0001-org.el-Compute-exact-bounds-when-converting-LaTeX-ou.patch --]
[-- Type: text/x-patch, Size: 1122 bytes --]

From c5fe51c5a30f2fb2bb3bd426fd8a0dedb5278f44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Wed, 23 Nov 2022 23:03:37 +0100
Subject: [PATCH] org.el: Compute exact bounds 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 26a8db353..3039c301c 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


[-- Attachment #7: Type: text/plain, Size: 208 bytes --]

-- 
"The whole science is nothing more than a refinement of everyday
thinking."
-- Albert Einstein, 1879-1955

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-25  2:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 23:07 [PATCH] Fix clipped LaTeX fragments (not Babel) Rudolf Adamkovič
2022-11-23 23:12 ` Ihor Radchenko
2022-11-24 20:49   ` Rudolf Adamkovič
2022-11-25  2:08     ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).