* [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
* Re: [PATCH] Fix clipped LaTeX fragments (not Babel)
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č
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2022-11-23 23:12 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <salutis@me.com> writes:
> 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!
Thanks!
> - :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
> + :image-converter ("dvisvgm %f -n -e -c %S -o %O"))
Maybe you can use full argument versions instead of short ones?
Similar to
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=17425599c
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix clipped LaTeX fragments (not Babel)
2022-11-23 23:12 ` Ihor Radchenko
@ 2022-11-24 20:49 ` Rudolf Adamkovič
2022-11-25 2:08 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Adamkovič @ 2022-11-24 20:49 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
Ihor Radchenko <yantar92@posteo.net> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Compute-bounds-exactly-when-converting-LaTeX-.patch --]
[-- Type: text/x-patch, Size: 1128 bytes --]
From b1be654ba28ceca60d0b12778d374db27e6eced5 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 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-org.el-Use-long-option-names-when-launching-dvisvgm.patch --]
[-- Type: text/x-patch, Size: 1091 bytes --]
From 34e3ecd3b23fae330574fe1cbcb3154b2fb8a2c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
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
[-- Attachment #4: Type: text/plain, Size: 218 bytes --]
--
"I love deadlines. I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt, 2002
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).