Fonts in 3?

13 views
Skip to first unread message

bor...@gmail.com

unread,
Dec 13, 2022, 12:16:24 PM12/13/22
to MathJax Users
I am using MathJax from Emacs org-mode and it is grabbing MJ from

https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

In Emacs I supposedly have configuration options to get, for example, the LaTeX Euler font -- or a few others. But it doesn't seem to work. I inspect my web page output and I see a CSS class MJX-TEX, and it's CSS breakdown is

.MJX-TEX {
   font-family: MJXZERO, MJXTEX;
}

Good. I think I can simply go into my own CSS and change something with the font family. But I wouldn't know what to. I found this code where it seems to have a long list of "font families" but I have no idea what they are or how to change the above CSS font-family tag. Any knowledge, help appreciated.

Thanks,
LB

Davide Cervone

unread,
Dec 18, 2022, 10:11:43 AM12/18/22
to mathja...@googlegroups.com
I am using MathJax from Emacs org-mode and it is grabbing MJ from 

In Emacs I supposedly have configuration options to get, for example, the LaTeX Euler font -- or a few others. But it doesn't seem to work.MathJax needs to know the font metric information for any font that it uses, and that has to be made available to MathJax in .js files that are included with MathJax.  MathJax version 3 only has data for one font, so you can't change the font used, but version 4 (now in alpha release) does have more fonts (about a dozen) and Euler is among them.  So you might be able to use version 4 for this, if you are willing to use an alpha release.

 I inspect my web page output and I see a CSS class MJX-TEX, and it's CSS breakdown is 

.MJX-TEX {
   font-family: MJXZERO, MJXTEX;
}

Good. I think I can simply go into my own CSS and change something with the font family.

The CSS is more complicated than just changing the font associated with MJXTEX, as the metric data for each character used in the font is also part of the CSS (if you look at the other rules MathJax is producing).  These are set up for the MathJax TeX font, and if you change that to some other font, the metrics will not match the new font, and the layout will not be correct.

I found this code where it seems to have a long list of "font families" but I have no idea what they are or how to change the above CSS font-family tag. 

Those lines are importing the metric data for the various math variants used in the math layout which are in turn used to generate the CSS for the characters that you use. Creating the data for a new font is a non-trivial process.  Version 4 includes that data needed for 11 fonts, and will also make the font-data creation tools available so you can create the data for other fonts.  We hope for an official v4 release in early 2023.

Davide
Reply all
Reply to author
Forward
0 new messages