From c50767fd277e82ee50db319443b2716f988fc0a7 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 6 Dec 2021 15:33:02 -0800 Subject: [PATCH] Backport PR #13372: use full-alpha transparency on dvipng rendered LaTeX --- IPython/lib/latextools.py | 23 ++++++++++++++++++++--- IPython/utils/timing.py | 1 - 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/IPython/lib/latextools.py b/IPython/lib/latextools.py index cbcc7d9639e..f976f2edb13 100644 --- a/IPython/lib/latextools.py +++ b/IPython/lib/latextools.py @@ -151,9 +151,26 @@ def latex_to_png_dvipng(s, wrap, color='Black', scale=1.0): resolution = round(150*scale) subprocess.check_call( - ["dvipng", "-T", "tight", "-D", str(resolution), "-z", "9", - "-bg", "transparent", "-o", outfile, dvifile, "-fg", color], - cwd=workdir, stdout=devnull, stderr=devnull) + [ + "dvipng", + "-T", + "tight", + "-D", + str(resolution), + "-z", + "9", + "-bg", + "Transparent", + "-o", + outfile, + dvifile, + "-fg", + color, + ], + cwd=workdir, + stdout=devnull, + stderr=devnull, + ) with open(outfile, "rb") as f: return f.read() diff --git a/IPython/utils/timing.py b/IPython/utils/timing.py index 32741acdd9c..92f6883c4af 100644 --- a/IPython/utils/timing.py +++ b/IPython/utils/timing.py @@ -62,7 +62,6 @@ def clock2(): Similar to clock(), but return a tuple of user/system times.""" return resource.getrusage(resource.RUSAGE_SELF)[:2] - else: # There is no distinction of user/system time under windows, so we just use # time.perff_counter() for everything...