From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wGp8JvGtpWBV4AAAgWs5BA (envelope-from ) for ; Thu, 20 May 2021 02:31:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6M4hIvGtpWCLBgAAbx9fmQ (envelope-from ) for ; Thu, 20 May 2021 00:31:45 +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 763D1120DD for ; Thu, 20 May 2021 02:31:44 +0200 (CEST) Received: from localhost ([::1]:59286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljWbG-0006zp-GT for larch@yhetil.org; Wed, 19 May 2021 20:31:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljWa6-0006zE-MN for emacs-orgmode@gnu.org; Wed, 19 May 2021 20:30:30 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:41785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljWa4-0008RQ-Rr for emacs-orgmode@gnu.org; Wed, 19 May 2021 20:30:30 -0400 Received: by mail-lf1-x131.google.com with SMTP id v8so16778793lft.8 for ; Wed, 19 May 2021 17:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1cINZVTBeytAQdX3fQkRjqaLynAFymkLNTN5za8qQbg=; b=lAYl4W2tjIXLzOSL1s78ddyR9O4dupj31Vj3QxjtXUKaZhf11Tx9qd+3Snallv0/1M Fe2lUQX7L2P+XyAav9Kf14dmb6RigLc7zNIDTgMuBZz2ZCcYDm89aswnQIvXaAJZULBj h/iTt4DHjkWf84UtdYH2VC3r4T3V0rrfAvNOnvmdAid1j25gfwPJpEC7YJardMQrcrpA VEB27BIs3QhMM2NozlRNIzo0/u6PH07xfL+33OSC50rEgBIM15hLJ88YiJYJeYOwtVn0 z2fSLGVyvL3uOiBMhtPBJWeJmdMy2FocXEfUvAVAGgGr+i+eCDaSJazlO2Mk4HYnU3nO AS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1cINZVTBeytAQdX3fQkRjqaLynAFymkLNTN5za8qQbg=; b=autJ16mCWEra/y8lOFG6ogU75m5ZR+97hzOA9xWUG8st7V279Qcpn+tfDozwxaU64V VaR+mxgPh37iBkScCWXkazwrIb9at7m3et4+sX2b6d+uC11cntGo1q6Vk9okl6PUbRVK OuR7SaM218qhvQGpBEC8WQJsMvdBY2ZiIbgyg1ZrmqwIoJ6cpx7wh5dCgTZYqP5H5LYW qNTBTGbMOX1f4WYSBa09sKp2Ff8SkII/Vk8CacbEh2P4mEhe3rHurLSkjRoY3a8RD8UB hIEuOYU8+pNeLjcLTH6Tu5TJzESA9WfK8N6Tu+ddfe+Dq3q1BlsvCD8Kv0OE+cZEufjo M6ew== X-Gm-Message-State: AOAM532M9ymJ0+GY6lV74ypM90wtz4C7swmnaghnUwozQX7o/gr/Qjsa qH/eRd7Tv+NnQ869g3DiKJNsEbnfKrsX2M24+swrt/Ie08c= X-Google-Smtp-Source: ABdhPJy0vSBBDe0dT2tA/izqJ1Dui80PvhvtgYDP28ZpONRyJtob9oZJrzUPbYXcmzkWd7dWylBc7XY1sJM0E17fj/Q= X-Received: by 2002:ac2:50c2:: with SMTP id h2mr1377243lfm.499.1621470626768; Wed, 19 May 2021 17:30:26 -0700 (PDT) MIME-Version: 1.0 References: <24643289-d817-7eed-91cd-4c9f26edc206@posteo.eu> In-Reply-To: <24643289-d817-7eed-91cd-4c9f26edc206@posteo.eu> From: Roshan Shariff Date: Wed, 19 May 2021 18:30:15 -0600 Message-ID: Subject: Re: Bug: Can't set background color of latex fragment To: sebastien.miquel@posteo.eu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=roshan.shariff@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: , Cc: emacs-orgmode 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=1621470705; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=1cINZVTBeytAQdX3fQkRjqaLynAFymkLNTN5za8qQbg=; b=Ii8xgFQZhwpzxPz0p7iPYto3VO5SH53shikbC37mFkbFqvbRvcNN8JwHFVKm4/pHQ2+C3B PHQispDDt6Ilj3bsrzPpOIgwz2qvRHbBoI6VleEpH374WMxIjNqeUg4Zi3zniHZEXzoY9j HmO1ERgIfABmcWi0mcDe5JUwCPSpX9IjUiE3SyetUGB6xbeYBQuePARlkBW+ZLDH3ENKjx vz8qRhcnZtECESRS1tScNg1nLjJKdTQVDaoUDK7toizG+nvQEs0UJSOp8sBP+L4ujPnDD2 B39txk+iOxUwxmb66i8b2ABHCRNI445IH1+kFnoj0PRYZzdIAKtN9skgrm5ypw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621470705; a=rsa-sha256; cv=none; b=ogxyIt84NbiykuswtRP8NDcq8Ujo9+e27y2x+1ndf4ee7trXvPxlLjwQKhvt1WNCuYvPgC Pi33UA7aA7goCJgb4LpB1O9cFki2JsGc97MjMAF7Btpr5XkUrYY0a2Mc7LyzyE5AXwdg6h ia/y8mG36NZx0JHtvtGKktC13NPaRkLSV9c7Zmo/pA+y81DfhLXDHQKyT2szgHF64olvK2 jthx+pZqAhtpH3HcIuaDP7bCOaNfMaXmllRR3MIoozuhHubQLzuRyCjk9IltMUGRD/6mKL lCYFk/hLRc+I3FYr8g+FSY1WUlWie3Siz/HAvm0djlMVju0odW1ShoG0cpq5BA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=lAYl4W2t; dmarc=pass (policy=none) header.from=gmail.com; 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=gmail.com header.s=20161025 header.b=lAYl4W2t; dmarc=pass (policy=none) header.from=gmail.com; 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: 763D1120DD X-Spam-Score: -3.14 X-Migadu-Scanner: scn1.migadu.com X-TUID: cmNO05nbH+Wz Hi S=C3=A9bastien, I originally made my patch because otherwise adding '(:background "Transparent") to org-format-latex-options always resulted in a white background (\pagecolor{white} would be forcefully added to the generated LaTeX). Then I found that dvipng still produced a white background even without a \pagecolor{...} directive, so I added the -bg Transparent option. This is unlike dvisvgm, which produces an opaque background when \pagecolor{...} is present and a transparent background otherwise. I didn't realize that dvipng -bg Transparent would completely ignore the \pagecolor{...} command even if it was present. Perhaps the best solution that allows the background color to be customized with dvipng is to remove "-bg Transparent" from the default dvipng command line. For people who need transparency, perhaps another "dvipng (transparent)" option can be created, or they can use dvisvgm. This is useful for HTML export, for example. That said, I haven't had any issues with Emacs rendering transparent PNGs (version 27.2 on Linux and macOS). It uses the background color of whichever face is applied to LaTeX fragments (which seems to be org-block, along with font-latex-verbatim-face for inline formulae). I personally find it convenient to customize these faces as needed. Regards, Roshan On Wed, May 19, 2021 at 12:30 AM S=C3=A9bastien Miquel wrote: > > Hi Roshan, > > Roshan Shariff writes: > > I can confirm this bug with dvipng --- with the "-bg Transparent" > option, dvipng ignores the background color from the input tex file, > whereas without that option it always produces an opaque background. > There's currently no way to dynamically change command line > parameters, so I'm not sure how to solve this problem while supporting > both use cases. > > > I asked about this behaviour on the dvipng mailing list, and the > maintainer doesn't consider it a bug, see > https://lists.nongnu.org/archive/html/dvipng/2021-05/msg00002.html. > > Can you explain the use for a `Transparent` background ? Transparent > images are poorly supported in emacs, all it does is render it with > the background color of the default face -- which may not be the > expected result. > > Regards, > > -- > S=C3=A9bastien Miquel > > > On Wed, Apr 7, 2021 at 1:38 PM S=C3=A9bastien Miquel > wrote: > > To reproduce with `emacs -Q` : > - Open an org buffer > - Call ~(setq org-format-latex-options '(:foreground default > :background "Black" :matchers ("$")))~ > - Call =3DC-c C-x C-l=3D (org-latex-preview) on a latex fragment such a= s > $abc$ > > This bug was introduced by the commit 2f9e1569f which adds the option > `-bg Transparent` to the arguments of `dvipng`. According to its > manual, this option should be ignored if a background is already set, > but it doesn't seem to be. Perhaps org should set it differently. > > -- > S=C3=A9bastien Miquel > > >