From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WGahLGTQx2XpFgEAqHPOHw:P1 (envelope-from ) for ; Sat, 10 Feb 2024 20:37:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WGahLGTQx2XpFgEAqHPOHw (envelope-from ) for ; Sat, 10 Feb 2024 20:37:08 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="gy4ET/Sy"; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707593828; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XreOSjjQxX+8tCqykcxAdzm6R1UGowbVgIeKb3BaQJU=; b=J15RD6O53E0zbCq0g6d0OfmbN6KJlv4MsljADfkKw6GnQaDU6rp7g8SWwcG55BOPLmPj/3 pTfT2elzShAaUH0nufd5O0wCFafdUQS35Iq0bk9wqLP3AAAprqxX8AF4JgxY1JI+l6NaZn Xa0UCF0fBMHemDSiTes5GzugHKWutjvQmrShmYKUiaar/gGW41lujn0eSfDiKi0dOGEKxN MUTfsk4+15HdQrD6CSfUnwSwIm0aXbmH3yJYD4jjfp6V1yEkhwTI9vZgCKRI1JS2SChxJT oYmZCtDu+9L5JsJ6Vj+Z3exx2n0VlG99DUA+2M4QYBnIc8GNDdsGtVNz6aV76Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="gy4ET/Sy"; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707593828; a=rsa-sha256; cv=none; b=l3CXEBlR1Y8DqVdOhyS1LLQ8vn2jmGhzzFAdTmFLym+3x4k5x9M2sZusM+RCdmRnZqS+am lJ1ICS5n2NBOm/SSKvowSGLFiw/kK3tbJB7yjjjx5eXCI2gjAaBLNUEWtq4jIpekc2xlx6 mLoEMP9qXBudu53C0Dej7n9Pp2uttcWSF+xkAUtzy/gVmvQvzW1l/qPPRTKH79zOydVyEQ o5fvNa6XDRcSSIM3cKWJd1fM6FubP1/FkSDrdpB+Bju0g/J1U4xWPFKzFbSLndXE9BCr9v MmvzjpKVixSsxiHXqLp+4oXs82qQ6kZY7ti89gDL14bDzDPWQh0m+HX6FR8I8g== 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 A4B00666B6 for ; Sat, 10 Feb 2024 20:37:08 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYt8z-0002oo-9B; Sat, 10 Feb 2024 14:36:09 -0500 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 1rYt8x-0002oG-Qy for emacs-orgmode@gnu.org; Sat, 10 Feb 2024 14:36:07 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYt8t-0000d3-AS for emacs-orgmode@gnu.org; Sat, 10 Feb 2024 14:36:07 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id D3531240029 for ; Sat, 10 Feb 2024 20:35:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707593759; bh=Gnon658ImBbEZuXqhJX89TQYQ8LeS5abBnwxnE2wkJk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=gy4ET/SylqJO0UszZMaj7NfermaE75Z1BItUx+hQZv8+QBVS8YY6XfN4HazAWKXs7 5z4nXmDHTdWM4qXsY4CELRWHjB8QDplSoV628jBiP0jAxdUXoOZJeE8rbdaPxMfNkx 20DTWDm+6vET1/vkO0ZssRAGx7/SmE6BgMVTZblbKCYByuOwV1pI9SgOzDuzFrxcou Kk4k9ughD/gp5jKJtgV2yQaGszmJhJ6dePfx9G63dZW/r2O+90AeXweKLRPLgh/9hN lunVSZeNfprsNLeP4MejFv9E6lWizU68ohwgph4yzeBiPDJmnZRpPsZi6uQ9/NyfR4 ga+7MZWmaFnAA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TXLYW2tysz6tn4; Sat, 10 Feb 2024 20:35:58 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Ihor Radchenko Cc: orgmode Subject: Re: [patch] Add two new header args to LaTeX block In-Reply-To: <87wmrc8b3e.fsf@posteo.net> ("Juan Manuel =?utf-8?Q?Mac=C3=AD?= =?utf-8?Q?as=22's?= message of "Sat, 10 Feb 2024 17:48:05 +0000") References: <87zfw9yt9m.fsf@posteo.net> <87wmrcpepp.fsf@localhost> <875xyw9wic.fsf@posteo.net> <87le7se0qu.fsf@localhost> <87wmrc8b3e.fsf@posteo.net> Date: Sat, 10 Feb 2024 19:35:57 +0000 Message-ID: <87r0hk863m.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -10.40 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -10.40 X-Migadu-Queue-Id: A4B00666B6 X-TUID: PSaNQi+xzyk2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Juan Manuel Mac=C3=ADas writes: >> Ihor Radchenko writes: >> Would it make sense to make :pdf-process work for png previews as well? > > It would be ideal. The expected value for org-latex-pdf-process is a > command or a list of commands, but org-preview-latex-default-process > expects a plist of various processes and parameters. Maybe with some > conditional? If only the png extension is provided (without the > :imagemagick argument), then the expected value is for > org-preview-latex-default-process. In all other cases, the value is for > org-latex-pdf-process. The argument could then be called simply > :process. E.g.: > > Assuming the user has somewhere (add-to-list > org-preview-latex-process-alist my-process): > > :results file :file foo.png :process 'my-process [or :process '(a plist)] > > In other cases, like this: > > :imagemagick yes :results file :file foo.png :process '("lualatex -intera= ction nonstopmode -output-directory %o %f") > > wdyt? I am attaching a new patch with this idea incorporated. I have also changed the name from full-to-pdf to standalone. Best regards, Juan Manuel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-latex.el-Add-two-new-header-args-to-LaTeX-bl.patch >From a7f72015007722e665338c39b9a02d675c31cd93 Mon Sep 17 00:00:00 2001 From: Juan Manuel Macias Date: Sat, 10 Feb 2024 02:01:08 +0100 Subject: [PATCH] lisp/ob-latex.el: Add two new header args to LaTeX block. * (org-babel-execute:latex): `:process' allows modifying the value of `org-latex-pdf-process' or `org-preview-latex-default-process' in a specific block. If only the `png' extension is provided (without the `:imagemagick' argument), then the expected value is for `org-preview-latex-default-process'. In all other cases, the value is for `org-latex-pdf-process'. This argument has no effect if the conversion is to `HTML'. The `:standalone' argument requires that the LaTeX block contains all the code necessary to be compiled, as if it were an autonomous LaTeX document: the expected result will always be a PDF file. --- lisp/ob-latex.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index acb83228b..8bec0c661 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -162,6 +162,14 @@ This function is called by `org-babel-execute-src-block'." (height (and fit (cdr (assq :pdfheight params)))) (width (and fit (cdr (assq :pdfwidth params)))) (headers (cdr (assq :headers params))) + (process (cdr (assq :process params))) + (org-preview-latex-default-process (if (and process + (string-suffix-p ".png" out-file) + (not imagemagick)) + process + org-preview-latex-default-process)) + (org-latex-pdf-process (if process process org-latex-pdf-process)) + (standalone (cdr (assq :standalone params))) (in-buffer (not (string= "no" (cdr (assq :buffer params))))) (org-latex-packages-alist (append (cdr (assq :packages params)) org-latex-packages-alist))) @@ -187,6 +195,14 @@ This function is called by `org-babel-execute-src-block'." (list org-babel-latex-pdf-svg-process) extension err-msg log-buf))) (rename-file img-out out-file t)))) + ((and (string= "pdf" extension) standalone) + (with-temp-file tex-file + (insert body)) + (when (file-exists-p out-file) (delete-file out-file)) + (let ((tmp-pdf (org-babel-latex-tex-to-pdf tex-file))) + (let* ((log-buf (get-buffer-create "*Org Babel LaTeX Output*")) + (err-msg "org babel latex failed")) + (rename-file tmp-pdf out-file t)))) ((string-suffix-p ".tikz" out-file) (when (file-exists-p out-file) (delete-file out-file)) (with-temp-file out-file -- 2.43.0 --=-=-=--