mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.21k stars 1.16k forks source link

Is there a way to collect the "MathJax TeX" font as a single otf? #2994

Open BrandonStudio opened 1 year ago

BrandonStudio commented 1 year ago

I'd like to use this beautiful math font in Microsoft Word an elsewhere. Is there a way to generate a single otf file (e.g. MathJax TeX.otf) so that I can install on my computer and use it anywhere? And do I have the right to do this?

dpvc commented 1 year ago

The MathJax fonts are not set up for that kind of usage. They have non-standard metrics that make it easier for MathJax to do its layout. I'm not sure what the requirements are for a font to be able to be used in Word as a math font, but it would likely need to have an OpenType Math table, for one thing, and the MathJax fonts don't have that. They also don't have entries in the Math Alphanumeric unicode block, which would likely be needed as well. While one could potentially make a font that has the needed layout, it is not an automatic thing and would take some care, and some expertise in font manipulation tools.

BrandonStudio commented 1 year ago

@dpvc if I use Latin Modern Math as base and just replace some characters in it, do you have any suggestion?

dpvc commented 1 year ago

The weight of the characters in Latin Modern is not the same as in the MathJax TeX fonts, so they would not look good together.

MathJax version 4 will be using fonts based on Latin Modern as the default font rather than the original MathJax TeX fonts, and they will have much greater character coverage, so perhaps those will work better for you. But MathJax breaks its fonts into smaller pieces so that they can be downloaded faster and only ships the pieces that are needed. So you would probably want to combine some of them into a larger font. If you do

npm install mathjax-modern-font@1.0.0-beta.1

in an empty directory, then you should find the WOFF font files in node_modules/mathjax-modern-font/es5/chtml/woff. These were created from the various latin-modern files from a TeX distribution, recombining them into the chunks that MathJax needs internally.