latex-formulae icon indicating copy to clipboard operation
latex-formulae copied to clipboard

Added PandocFormulaOptions customization helper

Open rszczers opened this issue 5 years ago • 0 comments

I had a problem with changing the colour of rendered equations on my blog. Default ones are black and it doesn't work well with dark backgrounds. I managed to work it around by appending custom preamble to default one. Since it's relatively laborious thing to do, I've abstracted it out.

For example, suppose I want to change font colour to #c5d4db. Now, mathColour "c5d4db" returns FormulaOptions with following preamble

\usepackage{xcolor}
\definecolor{fg}{HTML}{c5d4db}
\everymath\expandafter{\the\everymath \color{fg}}
\everydisplay\expandafter{\the\everydisplay \color{fg}}

Since FormulaOptions has now Semigroup instance, we can append it to default preambles, like math or displaymath. With customize we can now easily add new features, e.g.

defaultPandocFormulaOptions `customize` mathColour "c5d4db"

Hope I'm not missing anything and somebody will find it useful.

rszczers avatar May 21 '19 13:05 rszczers