mathaddons / tex-math-here

Use TeX to take math here, there, or just about anywhere that images are supported.
GNU General Public License v3.0
2 stars 0 forks source link

Allow for setting the background #10

Open panbroggi opened 2 years ago

panbroggi commented 2 years ago

It would be a great addition to have the possibility of adding a background to produced images. When inserting formulas into emails, the fully transparent background makes it impossible to read formulas with dark mode enabled.

Since the output is a png image, a good choice could be to have a 50% opacity background that makes the resulting image readable even in dark mode, maybe setting a dark grey font color. Readability example here

Thank you for this neat and useful add-on!

panbroggi commented 2 years ago

To add some info, I can generate a png with the desired background using convert -density 300 file.pdf -background "rgba(255,255,255,0.5)" -flatten -colorspace RGB file.png where file.pdf is the compiled version of

%% file.tex
\documentclass{standalone}
\begin{document}
$\displaystyle
\frac{d}{dt} e^x = e^x
$
\end{document}

giving the following output file