emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix clipped LaTeX fragments (not Babel)
Date: Thu, 24 Nov 2022 00:07:12 +0100	[thread overview]
Message-ID: <m2k03lz2vz.fsf@me.com> (raw)

[-- 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

             reply	other threads:[~2022-11-23 23:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 23:07 Rudolf Adamkovič [this message]
2022-11-23 23:12 ` [PATCH] Fix clipped LaTeX fragments (not Babel) Ihor Radchenko
2022-11-24 20:49   ` Rudolf Adamkovič
2022-11-25  2:08     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k03lz2vz.fsf@me.com \
    --to=salutis@me.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).