Greeting, MJ Community!
I've started to use MJ v4.0 in documents, which have Latin Modern Sans serif font family.
Therefore, I set the MJ font to mathjax-modern fonts (A version of Latin-Modern), but MJ uses the "Roman variant". I've read in the supported commands page that \textsf and \mathsf will do the job, but it's not an effective way to do that manually.
Is there an elegant way to render all characters to Sans Serif in all formulas, while I use mathjax-modern fonts? I tried the following code, which i've found in this group chat, and it worked perfectly for TeX fonts,:
https://groups.google.com/g/mathjax-users/c/sTP-zoQD6kU/m/qFnnBe0SBAAJ
CODE:
ready() {
const CommonWrapper = MathJax._.output.common.Wrapper.CommonWrapper;
const getVariant = CommonWrapper.prototype.getVariant;
const remap = {
normal: 'sans-serif',
italic: 'sans-serif-italic',
bold: 'bold-sans-serif',
'bold-italic': 'sans-serif-bold-italic',
'-tex-mathit': 'sans-serif-italic'
};
CommonWrapper.BOLDVARIANTS.bold.normal = 'bold-sans-serif';
CommonWrapper.BOLDVARIANTS.bold.italic = 'sans-serif-bold-italic';
CommonWrapper.BOLDVARIANTS.normal.bold = 'sans-serif';
CommonWrapper.BOLDVARIANTS.normal['bold-italic'] = 'sans-serif-italic';
CommonWrapper.ITALICVARIANTS.italic.normal = 'sans-serif-italic';
CommonWrapper.ITALICVARIANTS.italic.bold = 'sans-serif-bold-italic';
CommonWrapper.ITALICVARIANTS.normal.italic = 'sans-serif';
CommonWrapper.ITALICVARIANTS.normal['bold-italic'] = 'bold-sans-serif';
CommonWrapper.prototype.getVariant = function () {
getVariant.call(this);
this.variant = remap[this.variant] || this.variant;
};
MathJax.startup.defaultReady();
}
I've already tried mathjax-fira (A version of the Fira and Fira-Math fonts (a sans-serif font)), but i prefer the latin modern.
Kind regards:
Balint