From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AK9iESgJY2OpJAEAbAwnHQ (envelope-from ) for ; Thu, 03 Nov 2022 01:19:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id zZ9PESgJY2M6bwAA9RJhRA (envelope-from ) for ; Thu, 03 Nov 2022 01:19:52 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 047B22242D for ; Thu, 3 Nov 2022 01:19:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqNwU-0001YU-MP; Wed, 02 Nov 2022 20:18:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqNwT-0001YF-0z for emacs-orgmode@gnu.org; Wed, 02 Nov 2022 20:18:45 -0400 Received: from qs51p00im-qukt01072102.me.com ([17.57.155.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqNwM-0007fX-L8 for emacs-orgmode@gnu.org; Wed, 02 Nov 2022 20:18:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1667434717; bh=+tTcXmAexVEHqAHX4SGcouhHO1ltjGxFhqRG7PKjq6w=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=fhpd3RLPev/+J4p37bk/+Qf0whRwFKiKnuuHSxfMgxqd4qD3y1x96W/jZh1hcHITa 1r+ksdS600QSHsjkaJM94WAyeG3tRsohrtRo7Kk5c+gBUegDL2C11YFY9KLR31MxFv Fm41RLmRGBybXtcJeUw5bq9uc/DIhgYbNhsaAaXAFAarePKGHQOaObYb04EKHzxc/u BigntXJnEKcLFOc30ejK3/djULUpiYn8zIuZr4iWFMqmJdPCr2df9OOB6pBMf4GrAC UXnhIXmn09g3VvtBsZTqR+oG/43tzB1Eg9hP3DGlqE0ibC9TwYVNd6rwDpi1Z5uQvU NCQw6lJ5FkgPA== Received: from Rudolfs-MacBook-Air.local (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01072102.me.com (Postfix) with ESMTPSA id 58D3F340686 for ; Thu, 3 Nov 2022 00:18:36 +0000 (UTC) From: =?utf-8?Q?Rudolf_Adamkovi=C4=8D?= To: emacs-orgmode@gnu.org Subject: [PATCH] Improve Org Babel LaTeX + Inkscape Date: Thu, 03 Nov 2022 01:18:33 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-ORIG-GUID: SQ0VKFWcepsZrQr53uoeU659AEeY8iV6 X-Proofpoint-GUID: SQ0VKFWcepsZrQr53uoeU659AEeY8iV6 X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.790,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-12=5F02:2020-02-14=5F02,2022-01-12=5F02,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxlogscore=715 phishscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2211030000 Received-SPF: pass client-ip=17.57.155.11; envelope-from=salutis@me.com; helo=qs51p00im-qukt01072102.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667434791; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+tTcXmAexVEHqAHX4SGcouhHO1ltjGxFhqRG7PKjq6w=; b=ez3RgN3z/3VEuQvvDHryl8ITOXoBGodLg3+t1euFTfpFNURNaz3zepUmO8sW2vL354fDTZ pPFInl2XePdtO2KQaR1n6Qmj0d+VcN3M7OX1Qm1uJwQdPv0Cc0FgtAzKfLtigHf8ml9JxE G8Bwl/qd51rEHqTzpw0//q66fFuYjQKkvTMqM+OvEqyY/mptM3vHhwmT8NtFsdaWfjTQrX Pe2xR5qKNbvh11dvSlJHwRY2XH2Y34ta5ih+4+iXYlkn1+Lbtk5it3XrY3AYuFMgv2t7wZ C/S4zC8C967593VGpbyy+YzBYvwXCPcErIvAcCLLjV6KNyVzwgt3P9mpeBHpaQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667434791; a=rsa-sha256; cv=none; b=VnP42U9KDfSmdEQxfhr+LHqKAqakv4iMKLsb1GYwd02aJJS4zlIft4qFGkBxyeuq5eakjj jqX/cgb1cMrLvQdUujc5FEL5NcxGEzbNaMZmZyLyp172tc4d5VJXQwtZXm/BcXWVanclBC w64xDRaTBQ7F5RlZHW2AJMQ+q+QerdoOBAHXYiMUG3CqcYKcyS8OmqXHpuT+kEmFOAELlZ RRn9/YhbH+PfyHgXZtkIBrcWNCyOHekBb8Ogg2qPNOHGpeeUOzQnFOLNVgDR6Wls/Wf/8o 3Pdk5SNQn69uCDbnMSqs1VxlHIDkGn/iGlRGhgRDCGZeJlE4olJnZadlt6YgGg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=fhpd3RLP; dmarc=pass (policy=quarantine) header.from=me.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.99 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=fhpd3RLP; dmarc=pass (policy=quarantine) header.from=me.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 047B22242D X-Spam-Score: -5.99 X-Migadu-Scanner: scn0.migadu.com X-TUID: DU7UMYyA+cWQ --=-=-= Content-Type: text/plain Greetings! The attached two patches improve Org Babel LaTeX export to SVG using Inkscape. See the commit messages for more details. Thank you. Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-latex-Export-the-full-area-of-the-drawing.patch >From 569675be7881d4bdd3a2589491d7ee5396c27314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-ob-latex-Call-Inkscape-with-descriptive-arguments.patch >From 126b6b77b0a700740f837f729a0a6050e0837f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "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=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--