MathJax v4.0.0-beta.7
Pre-releaseThis release is primarily a bug-fix release. In particular, the redesign of the way speech is computed and attached to MathJax’s output that was part of the beta.6 release introduced a performance degradation that needed to be addressed. The main purpose of the beta.7 release is to fix that performance problem. In addition, there are also fixes to allow table columns to shrink when their contents have line-breaks, and to allow in-line breaking to work properly in Safari. The computations for the bounding boxes of the layouts in the bussproofs
TeX package have been improved. A security issue involving the potential for users being able to insert CSS styles into MathJax equations was identified by the GitHub security team, and is addressed here. The all-packages
extension and corresponding AllPackages.ts
file and the tex-full
component that used them have been removed. Finally, font extension can now be generic extensions so that they work with any base font, and the bbm
, bboldx
, and dsfonts
packages have been rebuilt to be generic font extensions.
Performance Update
The changes made to the speech computations in v4.0.0-beta.6 caused a performance degradation that causes pages to typeset visibly slower than earlier versions. In particular, the lazy-typesetting extension was noticeably affected. In order to address this, MathJax v4.0.0-beta.7 puts off doing the speech computation until after the visual mathematics has been displayed, which restores the original performance. To do this, the speech is computed and attached a few equations at a time, with slight delays in between in order to allow the browser to perform screen updates and scrolling for other user interaction. There are new configuration parameters that control the timing of this operation:
MathJax = {
options: {
speechTiming: {
asynchronous: true, // true to allow screen updates while adding speech, false to not
initial: 100, // initial delay (in milliseconds) until starting to add speech
threshold: 250, // time (in milliseconds) to process speech before letting screen update
intermediate: 10 // delay (in milliseconds) after processing speech reaches the threshold
}
}
};
When the options.speechTiming.asynchronous
value is true, speech will be added a little at a time. The options.speechTiming.initial
value is the delay (in milliseconds) to wait before starting to add speech, the threshold
value indicates how long MathJax should work on speech before allowing the screen to update again, and intermediate
is how long to wait after that before starting to compute speech again.
If options.speechTiming.asynchronous
value is false, then speech is added to the expressions immediately when they are typeset. This can be useful for node applications that run on the server, and don't need to wait for screen updates (as there is no screen to update).
Removal of AllPackages
The AllPackages.ts
file was intended as a means of loading most of the TeX extensions up front so that you did not need to worry about asynchronous loading of extensions via the autoload
package. But now that MathJax's output is also asynchronous, using AllPackages
is no longer sufficient to allow for synchronous processing. As more extensions have been created, they have not all been added to AllPackages.ts
, and as the library of extensions, both core and third-party, grows, it is impractical to keep all of them in one package. So in this release, these files have been removed. For those using MathJax in node applications, you can use
import {source} from 'mathjax-full/components/src/source.js';
const AllPackages = Object.keys(source).filter((name) => name.substring(0,6) === '[tex]/').sort();
to get a list of the main TeX packages. For use on the web, you could use
<script type="importmap">
{
"imports": {
"#source/source.cjs": "https://cdn.jsdelivr.net/npm/mathjax-full@4.0.0-beta.7/components/mjs/source-lab.js"
}
}
</script>
<script type="module">
import {source} from 'https://cdn.jsdelivr.net/npm/mathjax-full@4.0.0-beta.7/components/mjs/source.js';
const load = Object.keys(source).filter((name) => name.substring(0,6) === '[tex]/').sort();
const packages = ['base'].concat(load.map((name) => name.substring(6)));
window.MathJax = {
loader: {load},
tex: {packages}
};
</script>
to load all the extensions. Add any other configuration options that you need to the window.MathJax
variable.
List of Bug Fixes in this Release
-
Better validation of style values (#1121)
-
Create explorer regions only when needed (#1119)
-
Fix inline breaking in Safari. (mathjax/MathJax#3252) (#1117)
-
Compute proper left and right adjustments for tables in
bussproof
TeX extension. (mathjax/MathJax#3251) (#1115) -
Fix bounding box computation for some embellished operators. (mathjax/MathJax#3250) (#1114)
-
Remove the
AllPackages
file, theall-packages
TeX extension and thetex-full
component (#1110) -
Update the asyncLoad implementations to be more consistent, and update tests. (#1109)
-
Improve speech performance, especially for lazy typesetting (#1107)
-
Improve performance by detaching speech computation (#1103)
-
Allow columns to shrink during line breaking. (mathjax/MathJax#3235) (#1102)
-
Fix regression from #1069 (mathjax/MathJax#3233, mathjax/MathJax#3234) (#1101)
-
Refactors the treatment of namespaces for methods of TeX packages (#1097)
-
Refactors and simplifies macro mappings (#1096)
-
Update handling of math accents to round-trip through SRE (#1093)
-
Use XML serialization not HTML serialization for SVG images. (mathjax/MathJax#3226) (#1090)
-
Fix handling of unknown characters in SVG output. (mathjax/MathJax#3224) (#1089)