emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Improve Org Babel LaTeX + Inkscape
Date: Thu, 03 Nov 2022 01:18:33 +0100	[thread overview]
Message-ID: <m235b06gbq.fsf@me.com> (raw)

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

Greetings!

The attached two patches improve Org Babel LaTeX export to SVG using
Inkscape.  See the commit messages for more details.  Thank you.

Rudy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-latex-Export-the-full-area-of-the-drawing.patch --]
[-- Type: text/x-patch, Size: 981 bytes --]

From 569675be7881d4bdd3a2589491d7ee5396c27314 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Thu, 3 Nov 2022 00:53:01 +0100
Subject: [PATCH 1/2] ob-latex: Export the full area of the drawing

* lisp/ob-latex.el (org-babel-latex-pdf-svg-process): Add the argument
-D (--export-area-drawing) to avoid sub-point cuts on hi-DPI screens,
where Inkscape sometimes cuts off a single physical pixel from the
exported drawing.
---
 lisp/ob-latex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index a86699e22..c39c9c5d3 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -110,7 +110,7 @@ exporting the literal LaTeX source."
   :type 'function)
 
 (defcustom org-babel-latex-pdf-svg-process
-  "inkscape --pdf-poppler %f -T -l -o %O"
+  "inkscape --pdf-poppler %f -D -T -l -o %O"
   "Command to convert a PDF file to an SVG file."
   :group 'org-babel
   :type 'string)
-- 
2.38.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ob-latex-Call-Inkscape-with-descriptive-arguments.patch --]
[-- Type: text/x-patch, Size: 1100 bytes --]

From 126b6b77b0a700740f837f729a0a6050e0837f71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Thu, 3 Nov 2022 01:05:47 +0100
Subject: [PATCH 2/2] ob-latex: Call Inkscape with descriptive arguments

* lisp/ob-latex.el (org-babel-latex-pdf-svg-process): Use descriptive
arguments, such as '--export-area-drawing' instead of '-D', to
optimize for readability and not brevity (which makes sense for
interactive use, which does not apply here).
---
 lisp/ob-latex.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index c39c9c5d3..69124a36c 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -110,7 +110,13 @@ exporting the literal LaTeX source."
   :type 'function)
 
 (defcustom org-babel-latex-pdf-svg-process
-  "inkscape --pdf-poppler %f -D -T -l -o %O"
+  "inkscape \
+--pdf-poppler \
+--export-area-drawing \
+--export-text-to-path \
+--export-plain-svg \
+--export-filename=%O \
+%f"
   "Command to convert a PDF file to an SVG file."
   :group 'org-babel
   :type 'string)
-- 
2.38.1


[-- Attachment #4: Type: text/plain, Size: 278 bytes --]

-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

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

             reply	other threads:[~2022-11-03  0:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  0:18 Rudolf Adamkovič [this message]
2022-11-03  7:29 ` [PATCH] Improve Org Babel LaTeX + Inkscape 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=m235b06gbq.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).