Black Lives Matter. Please consider donating to Black Girls Code today.

Latex (MathJax) Font options


I am looking to publish some plots which includes LaTeX characters in legends, axis titles etc…

I notice that the fonts used by the default Mathjax config in the generated HTML is STIX-Web, while I was hoping to change this to Latin-Modern.

Currently, for HTML plots, I do this by editing the HTML file in a separate script to change the font string. But, I have no clue how to manage this while exporting as PDF. I know its a minor quirk of mine, but could anyone let me know if there is a way around this.


UPDATE: I managed a workaround for now for the font changes in the PDF files. This was by manually ediiting inject.js in plotly-graph component of the orca package to include MathJax’s font config options.

Also as a word of note, the STIX-Web default is a good idea to cover a wider set of characters, but this workaround is for those folks who are looking for consistency while publishing. FYI, MathJax only supports upto a certain amount of fonts.