From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yFoFCNrCqmDcPwEAgWs5BA (envelope-from ) for ; Sun, 23 May 2021 23:02:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MJ0RA9rCqmCXDgAAbx9fmQ (envelope-from ) for ; Sun, 23 May 2021 21:02:18 +0000 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 5F3171244D for ; Sun, 23 May 2021 23:02:17 +0200 (CEST) Received: from localhost ([::1]:54790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkvEk-000426-CN for larch@yhetil.org; Sun, 23 May 2021 17:02:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkvE6-00040j-7T for emacs-orgmode@gnu.org; Sun, 23 May 2021 17:01:34 -0400 Received: from mout01.posteo.de ([185.67.36.65]:55815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkvE3-0001MK-QM for emacs-orgmode@gnu.org; Sun, 23 May 2021 17:01:33 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 003AE240027 for ; Sun, 23 May 2021 23:01:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1621803688; bh=dq69J+JKOHsSxnwSYo7+KViO9gOkYVUlWG1aTmq/mWw=; h=Subject:To:Cc:From:Date:From; b=eyF4cCFmm5hMRkIszuvLSnzoA71kDZ5IX7W2PUXjvB4bncP60yusn4IPNbHxyl5PU VqELxX5bFU3Uu+RXmICHAVS04heb0C6vOmipQ+BjYXzQQPfjh+9xbySRI5gKX0A2IP IgmJDx2ASIbNXa4lM9UFPd0cs3G3Y04fssVvZ2r662udM2f35AoTbRYuBVYQRidksA 1GDzXUAh8F66czRNi8RN5vpG73zn2r1ld6/D17UtD5XS3rPX3MMQ5EZI6z0jk2OQSv OnO8OBhmmMu6DDBkrwJNzydTuwXRkF19OS2qa9WZA0pO4DtDCiw4UE0d1tSF0Kdte4 BqxPY4zbG92xQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FpCSR2h3Zz9rxH; Sun, 23 May 2021 23:01:27 +0200 (CEST) Subject: Re: Bug: [PATCH] Can't set background color of latex fragment To: emacs-orgmode References: <24643289-d817-7eed-91cd-4c9f26edc206@posteo.eu> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: <644826ea-9421-4e61-6bb8-1ad42156bcf7@posteo.eu> Date: Sun, 23 May 2021 21:01:27 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------9E362BD159BB8D49A2966F05" Content-Language: fr Received-SPF: pass client-ip=185.67.36.65; envelope-from=sebastien.miquel@posteo.eu; 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastien.miquel@posteo.eu Cc: Roshan Shariff Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621803737; h=from:from:sender:sender:reply-to: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=3r1TgoHLxE+WfDtUppUmC+TEuYQtzj8l3LWArdvKWHQ=; b=pPRgufsnl40dglKhCUuCiO6X9BlLGROmBs2yOZJYjdDpteAEWXQXqjm2jLsoDPIS0W+wUP 8203+WW2b3KevL8SiuXAHmIIWJTyGTCj/le2jQ1uXfSUSqj6cHQwZSUO69DwCj6Xk3WNj/ /TFWUPzGqqkbMexmKF5sS+P+XzuFszotjbAEZM/vy24yV1GeLjDlXLzD7UuJ+NwcIWMO1H nqLDRkWgkUefu1SrBJyWZk9oP7gHbEmVAskK1DN83USgwGpGJ8wV9BZSB0mXPYJUwM0KWB wFk59gofU7g7D1JKuA3k6QvvJ5y7z0XZsDzH6sEjnjEm0u2BnLluLUyNRp+q0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621803737; a=rsa-sha256; cv=none; b=LcTERIz+ydEZtoyCJMsyexlvLTGf6r37tuIkTOTthg9HFxe0VnUnFCC8j12soV0ank3qsA rkhG0lZbcH7vv0/uTXrtvhRjgfDpLQ68YnTdRMf5n0tc11/N6H/PhicPG4ilAh0l6278i4 q5DAUKzbTpavnS8dK9g9KSWG7jF31HuXmeI04Fl4pGPjURCUZUm3KLf/2sA/VpNhL740hK A9/yRQ05uFP6v6n6VPlekDMLSVcGAWrpveHlNUwsFeKz66Vj5yJTiCWe3+vywzc0nGn3xY XIQLNyC4YfB6cQ/woBZviorRTO2oqQadazaLh/YOoigiK8GOXKgo1hFKzN28Wg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=eyF4cCFm; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=eyF4cCFm; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 5F3171244D X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: +iaNtwvg0/DA This is a multi-part message in MIME format. --------------9E362BD159BB8D49A2966F05 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Here's a patch that fixes this bug by calling `dvipng' with the `-bg Transparent' argument only when no background color is set. Regards, -- Sébastien Miquel --------------9E362BD159BB8D49A2966F05 Content-Type: text/x-patch; charset=UTF-8; name="0001-org.el-org-create-formula-image-Fix-ignored-backgrou.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org.el-org-create-formula-image-Fix-ignored-backgrou.pa"; filename*1="tch" >From 5872fc3143162fbda11cf2aa5a3798567664be99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Sun, 23 May 2021 22:07:25 +0200 Subject: [PATCH] org.el (org-create-formula-image): Fix ignored background color * lisp/org.el (org-preview-latex-process-alist): add a `:transparent-image-converter' property for `dvipng'. (org-create-formula-image): If available, use `:transparent-image-converter' when no background color is set. --- lisp/org.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02eb..d544e62fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3319,7 +3319,9 @@ All available processes and theirs documents can be found in :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f")) + :image-converter ("dvipng -D %D -T tight -o %O %f") + :transparent-image-converter + ("dvipng -D %D -T tight -bg Transparent -o %O %f")) (dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" @@ -3374,6 +3376,9 @@ PROPERTIES accepts the following attributes: given to the shell and supports any of the following place-holders defined below. +If set, :transparent-image-converter is used instead of :image-converter to +convert an image when the background color is nil or \"Transparent\". + Place-holders used by `:image-converter' and `:latex-compiler': %f input file name @@ -16288,7 +16293,6 @@ a HTML file." org-format-latex-header 'snippet))) (latex-compiler (plist-get processing-info :latex-compiler)) - (image-converter (plist-get processing-info :image-converter)) (tmpdir temporary-file-directory) (texfilebase (make-temp-name (expand-file-name "orgtex" tmpdir))) @@ -16302,7 +16306,11 @@ a HTML file." "Black")) (bg (or (plist-get options (if buffer :background :html-background)) "Transparent")) - (log-buf (get-buffer-create "*Org Preview LaTeX Output*")) + (image-converter + (or (and (string= bg "Transparent") + (plist-get processing-info :transparent-image-converter)) + (plist-get processing-info :image-converter))) + (log-buf (get-buffer-create "*Org Preview LaTeX Output*")) (resize-mini-windows nil)) ;Fix Emacs flicker when creating image. (dolist (program programs) (org-check-external-command program error-message)) -- 2.31.1 --------------9E362BD159BB8D49A2966F05--