CommonHTML Output Processor Options
The options below control the operation of the CommonHTML output
processor that is run when you include
'output/chtml' in the load array of the loader
block of your MathJax configuration, or if you load a combined
component that includes the CommonHTML output jax. They are listed
with their default values. To set any of these options, include a
chtml section in your MathJax global object.
In addition to the options listed below, you can also include any of
the options from the output block listed in the
Output Processor Options section.
The Configuration Block
MathJax = {
chtml: {
matchFontHeight: true, // True to scale the math to match the ex-height of the surrounding font
fontURL: URL, // The URL where the fonts are found
dynamicPrefix: URL, // The URL where dynamic ranges of the font data are located
adaptiveCSS: true, // true means only produce CSS that is used in the processed equations
}
};
Option Descriptions
- matchFontHeight: true
This setting controls whether MathJax will scale the mathematics so that the ex-height of the math fonts matches the ex-height of the surrounding fonts. This makes the math match the surroundings better, but if the surrounding font does not have its ex-height set properly (and not all fonts do), it can cause the math to not match the surrounding text.
While a
truevalue will make the lower-case letters match the surrounding fonts, the upper case letters may not match (that would require the font height and ex-height to have the same ratio in the surrounding text as in the math fonts, which is unlikely).
- fontURL: URL
This is the URL to the location where the MathJax fonts are stored. The
URLis set up by the default font to point to its CDN location. For themathjax-newcmfont, theURLwould be set tohttps://cdn.jsdelivr.net/npm/@mathjax/mathjax-newcm-font/chtml/woff2, for example.While v3 included the fonts as part of the MathJax distribution, in v4, the fonts are in separate npm packages. Each font sets up its own location when it is loaded, and the default is to take the fonts from
cdn.jsdelivr.net. If you are serving your own copy of MathJax, you may want to include your own copy of the fonts, and so may need to set this value accordingly.
- dynamicPrefix: URL
This is the location where MathJax should look for font data that has to be loaded dynamically. The
URLis set up by the default font to point to its CDN location. For themathjax-newcmfont, theURLwould be set to[mathjax-newcm]/chtml/dynamic, for example, with the[mathjax-newcm]path being set to the CDN location.Version 3 included all the font data in one file, but in v4, where the fonts include much greater character coverage, the fonts are broken into several smaller pieces that are loaded only when needed.
- adaptiveCSS: true
This setting controls how the CommonHTML output jax handles the CSS styles that it generates. When true, this means that only the CSS needed for the math that has been processed on the page so far is generated. When false, the CSS needed for all elements and all characters in the MathJax font are generated. This is an extremely large amount of CSS, and that can have an effect on the performance of your page, so it is best to leave this as
true. You can reset the information about what CSS is needed by using the commandMathJax.startup.document.output.clearCache();
to clear the font cache.
The remaining options are described in the Options Common to All Output Processors section.