gjtorikian / mathematical

Convert mathematical equations to SVGs, PNGs, or MathML. A general wrapper to Lasem and mtex2MML.
https://gjtorikian.github.io/mathematical/
MIT License
166 stars 31 forks source link

Can you use colors? #97

Closed in3rsha closed 4 years ago

in3rsha commented 4 years ago

Hello there, thanks for the excellent gem.

This is a question rather than an issue: Is it possible to set the color of math symbols when using this gem? For example, this works perfectly well:

string_with_math = "$$x^8 + x^4 + x^3 + x + 1$$"

But I'm looking to do something like this:

string_with_math = "$$x^8 + {\color{red}x^4} + x^3 + x + 1$$"

Is this possible?

gjtorikian commented 4 years ago

Yes! See this doc for a list of everything supported: https://github.com/gjtorikian/mtex2MML/blob/master/SUPPORTED.md#colors

in3rsha commented 4 years ago

Ah yes, thank you. I was using double quotes " and it was treating the backslash as an escape character. Using single quotes ' for the string did the trick.

Sorry for the basic question. Thanks for the help.