Skip to content

Conversation

@bnavigator
Copy link
Contributor

From man dvipng (version 1.17):

       -bg color_spec
           Choose background color for the images. This option will be ignored if there is a background color \special in the DVI. The color spec should be in TeX
           color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. You can also specify 'Transparent' or 'transparent' which will give you a transparent background with the
           normal background as a fallback color. A capitalized 'Transparent' will give a full-alpha transparency, while an all-lowercase 'transparent' will give a
           simple fully transparent background with non-transparent antialiased pixels. The latter would be suitable for viewers who cannot cope with a true alpha
           channel.  GIF images do not support full alpha transparency, so in case of GIF output, both variants will use the latter behaviour.

Comparison on a QtConsole with solarized-dark theme (with spyder-ide/qtconsole#512):

In [1]: from control import rss

In [2]: randomstatespace = rss(3,2,1)

In [3]: randomstatespace._repr_latex_()
Out[3]: '\\[\n\\left(\n\\begin{array}{rllrllrll|rll}\n-1.&\\hspace{-1em}79&\\hspace{-1em}\\phantom{\\cdot}&-0.&\\hspace{-1em}279&\\hspace{-1em}\\phantom{\\cdot}&-1.&\\hspace{-1em}77&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}223&\\hspace{-1em}\\phantom{\\cdot}\\\\\n-0.&\\hspace{-1em}652&\\hspace{-1em}\\phantom{\\cdot}&-1.&\\hspace{-1em}51&\\hspace{-1em}\\phantom{\\cdot}&-1.&\\hspace{-1em}36&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}128&\\hspace{-1em}\\phantom{\\cdot}\\\\\n0.&\\hspace{-1em}835&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}181&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}711&\\hspace{-1em}\\phantom{\\cdot}&-0.&\\hspace{-1em}495&\\hspace{-1em}\\phantom{\\cdot}\\\\\n\\hline\n-0.&\\hspace{-1em}00268&\\hspace{-1em}\\phantom{\\cdot}&-0.&\\hspace{-1em}855&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}0902&\\hspace{-1em}\\phantom{\\cdot}&-0.&\\hspace{-1em}852&\\hspace{-1em}\\phantom{\\cdot}\\\\\n-0.&\\hspace{-1em}762&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}0347&\\hspace{-1em}\\phantom{\\cdot}&0.&\\hspace{-1em}472&\\hspace{-1em}\\phantom{\\cdot}&1.&\\hspace{-1em}34&\\hspace{-1em}\\phantom{\\cdot}\\\\\n\\end{array}\\right)\n\\]'
before after
image image

@Carreau Carreau force-pushed the latex-png-bg-transparency branch from 3508eed to eab708f Compare December 6, 2021 18:36
@Carreau Carreau merged commit 74f70ce into ipython:master Dec 6, 2021
meeseeksmachine pushed a commit to meeseeksmachine/ipython that referenced this pull request Dec 6, 2021
Carreau added a commit that referenced this pull request Dec 7, 2021
…372-on-7.x

Backport PR #13372 on branch 7.x (use full-alpha transparency on dvipng rendered LaTeX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants