mathjax/MathJax-src
 Watch   
 Star   
 Fork   
25 days ago
MathJax-src

MathJax v4.1.2

This is mainly a bug fix release that resolves a number of issues from v4.1.1.

The one change that may affect current content is that some of the font-sizing macros like \large and \tiny were setting the wrong sizes, and have been corrected. In particular, the sizes for \tiny and \Tiny were reversed, while the size for \large and the other larger sizes were all off by one size (\large was using the size that should have been for \Large, \Large was using the size of \LARGE, etc.), and \small was too small. These have all been fixed to use the correct sizes. Existing content that use these macros will now use the correct sizing values, and that may affect the results of those expressions. For this reason, we have added a new fontsizev3 TeX package that puts back the incorrect sizing values used in v3 and earlier versions of v4. If you include

window.MathJax = {
  loader: {load: ['[tex]/fontsizev3']},
  tex: {packages: {'[+]': ['fontsizev3']}},
};

in your configuration, you will keep the original sizes. In addition to these size corrections, the missing \SMALL, \Small, and \footnotesize were added, as was a non-standard \HUGE to correspond with the size available (incorrectly) as \Huge in the past.


The issues resolved in v4.1.2 include:

  • Have the www.mathjax.org link from the About MathJax dialog open in a new tab. (#1463)

  • Properly handle margin-left and margin-right specified on MathML elements. (#1456)

  • Fix incorrect layout for bussproofs in CHTML mode for Safari. (mathjax/MathJax#3547)

  • Properly handle trailing spaces for \def. (mathjax/MathJax#3550) (#1455)

  • Fix problem with sre.style being ignored. (#1453)

  • Update font-size macros to correct LaTeX values and make fontsizev3 package for backward compatibility. (#1449)

  • Fix CSS for zero-width combining characters in normal variant so it doesn't impact other variants. (#1445)

  • Fix several issues with multi-character stretchy assemblies. (mathjax/MathJax#3528, mathjax/MathJax#3531) (#1441)

  • Fix problem with \vert becoming stretchy after enrichment. (mathjax/MathJax#3530) (#1440)

  • Fix isEmpty() to work with partially complete msubsup elements with empty bases. (mathjax/MathJax#3532) (#1439)

  • Fix erroneous definition for --mjx-bg1-color. (#1438)

  • Fix several issues with speech generation. (mathjax/MathJax#3551, mathjax/MathJax#3527)

  • Improved semantic recognition of multiple prefix/postfix operators and their handling during speech generation.

  • Improved enrichment for added operators to better minimise the number of mrow elements added during enrichment.

  • Cleanup for relation sign voicing (mainly in English) leading to more concise speech.

2026-02-20 05:54:11
MathJax-src

MathJax v4.1.1

This is mainly a bug fix release that resolves a number of issues from v4.1.0. The key fixes include:

  • In v4.1.0 we introduced movable and sizable dialog boxes (e.g., for "About MathJax" or "Show Math As..." dialogs), but the CSS for the positioning was incorrect and could cause the page to scroll to the top or to position the dialog outside the of the visible portion of the page when a dialog is opened. That CSS is fixed in this version.

  • Version 4.1.0 introduced a dark-mode color scheme for MathJax when the system dark-mode is selected by the user. This caused two issue:

    • If the page doesn't itself have dark-mode coloring, then selecting an expression for exploration could cause the background and foreground colors to not have enough contrast.
    • When a dialog was opened, the link colors for the rest of the page could be altered accidentally.

    In order to resolve the first of these issues, v4.1.1 includes a new ui/no-dark-mode extension that can be added to the loader.load array in your page's Mathjax configuration; this will prevent the dark-mode color scheme from being used for the explorer and dialog boxes (thought he MathJax contextual menu will still use dark mode colors).

    The second issue is resolved in 4.1.1 by adding proper prefixes to the CSS for the links used in dark-mode dialogs.

  • The expression explorer in v4 can be started by clicking on a term in an expression. If the expression includes HTML elements like text input areas, checkboxes, drop-down menus, etc., this feature interfered with the user's ability to interact with those items. Version 4.1.1 allows clicks and keystrokes to pass through to those HTML elements, and allows the user to tab to focusable elements within the expression. When exploring an expression that contains focusable elements, pressing the enter or tab key will focus the first item focusable within the currently selected sub-expression.

    A similar issue was that mouse clicks were being stopped but the explorer, so were not bubbling up to elements containing math expressions. For example, a <button> or <label> tag would not receive mouse clicks if they were on math contained within the tag. Version 4.1.1 now passes mouse events on to the containing elements.

  • V4.1.1 contains a number of improvements to accessibility and speech output. For full details see SRE release notes for beta.4 and beta.5. In summary

    • Clearer semantic distinction of fences with reduced omissions in clearspeak and explicit handling of floor and ceiling functions (English only for the moment).
    • Improved handling of stacked expressions with better speech output for above and below expressions, as well as explicit output of empty bases, where appropriate, and collapsing of scripts where they are visually indistinguishable.
    • Unwrapping of singleton lines into their contained expressions. A single line makes sense if tagged or in the context of a matrix or case statement but not on its own.
    • Label prefixes for clearspeak are now spoken according to the actual multi-line preference.
    • Distinguishe between simple empty elements and phantom elements that lead to spaces. (This could be improved in the future.)
    • Fix issues with missing phantom elements in mfenced elements.
    • Improves semantic treatment of empty script elements.
  • Speech was not being properly added to in-line expression that include potential line breaks (for automatic in-line breaking) in SVG output. This is fixed in v4.1.1.

Additional fixes and the details for the various changes are described in the links below.


User Interface Changes

  • Fix position for dialogs. (mathjax/MathJax#3480) (#1403)

  • Restrict anchor color changes to dialogs. (#1414)

  • Update color for self-voicing explorer (#1416)

  • Fix speech for SVG inline expressions with line breaks. (mathjax/MathJax#3511) (#1425)

  • Handle clicking and tabbing to focusable HTML elements within expressions. (mathjax/MathJax#3493) (#1410, #1421)

  • Have explorer properly handle the tab order menu preference. (mathjax/MathJax#3493) (#1411)

  • Implement a no-dark-mode component. (mathjax/MathJax#3502) (#1422)

  • Fix speech attachment for SVG inline expressions with line breaks. (mathjax/MathJax#3511) (#1425)

  • Make sure output renderer settings are transferred when the menu selects a new renderer. (#1435)

Output

  • Fix operator spacing regression from #1367. (mathjax/MathJax#3498) (#1417)

  • Use proper scaling for vertical shift of bevelled fractions. (mathjax/MathJax#3506) (#1419)

  • Make sure \surd is symmetric vertically. (mathjax/MathJax#3468) (#1409)

  • Make sure columns get new width if contents stretch more than original width. (mathjax/MathJax#3423) (#1427)

  • Make sure | has stretchy=false when needed. (mathjax/MathJax#3515) (#1426)

  • Better testing for empty mathop (so as to not add invisible function application). (#1428)

  • Use proper scaling for vertical shift of bevelled fractions. (mathjax/MathJax#3506) (#1419)

  • Fix inline line-breaking issues with SVG output. (mathjax/MathJax#3526) (#1436)

Miscellaneous

  • Update windows paths to include file:// in node applications and fix tests. (mathjax/MathJax#3481) (#1404, #1418)

  • Add version number to default font URLs on jsdelivr. (#1423)

  • Use serializeXML() rather than outerHTML() in README example code. (#1405)

  • Simplify component copy configuration blocks. (#1406)

  • Update components compilation to use pnpm. (#1413)

  • Update handling of CSS border parts like border-color and add tests for that. (mathjax/MathJax#3490) (#1408)

2025-12-16 03:03:19
MathJax-src

MathJax v4.1.0

This release adds a number of new or improved features to MathJax, and fixes several issues in version 4.0.0. The new features are described in the sections below, and the changes and issues they resolve are linked in the lists in the last section.




Compatibility Updates

Some of the features in v4.0 used modern CSS that is not available in order browsers. Several updates in v4.1 address those issues by using older CSS techniques to accommodate more legacy browser versions.

In addition, v4.0 uses the modern Object.hasOwn() call rather than obj.hasOwnProperty(). The support for this only goes back a few years, and was a source of problems in older browsers. Version 4.1 uses a polyfill to overcome this deficiency in browsers that don't support Object.hasOwn(). A new MathJax.startup.polyfillHasOwn configuration option controls whether MathJax should use its polyfill when Object.hasOwn() isn't available natively. Use

MathJax = {
  startup: {
    polyfillHasOwn: false,
  }
};

to disable the use of the polyfill.

The v4.0 build tools used to compile and package MathJax get confused by the use of Windows file paths. Version 4.1 has updated the tools to work in Windows, so you can compile and and bundle MathJax from the Windows command or power shell.

Updates to the User Interface

There are a number of user-interface improvements in this release. Notable among these is new support for a dark-mode color scheme. This should take effect automatically when the user changes the system settings to dark mode.

Another significant improvement is updated handling of dialog boxes, like the MathJax explorer help dialog. These now use the browser's dialog element, so they should float over top of the rest of the page (v4.0 failed to set the z-index properly for dialogs, and they could fall behind other page elements in that version). Furthermore, the dialogs now can be sized and repositioned, either by dragging with he mouse, or using arrow keys. Dialog boxes now have a (?) icon at the upper left that opens a new dialog that explains how to size and position the dialogs using the mouse or keyboard.

The explorer help icon (small at the upper right-hand corner of an expression) is now positioned better so that it is not clipped when wide expressions scroll or truncate, and for displayed expressions without tags, the icon is now close to the expression rather than at the right-hand edge of the expression's container. Some page authors have requested the ability to remove the help icon altogether, so a new option MathJax.options.enableExplorerHelp has been added to control that setting it to false prevents the help icon from appearing.

In earlier versions of MathJax, you could not tab to links within expressions, and although they were focusable, they appeared within DOM nodes that were marked as hidden from screen readers, which was a problematic arrangement. In v4.1, you can tab to the links within an expression; however, due to technical limitations, these links do not appear in the list of links for the page.

In the expression explorer in v4.0, there were some situations where the highlighted terms did not include everything that was part of the spoken text. This has been fixed in v4.1, so highlighting should more accurately reflect the spoken expression. There were also a number of issues with explorer magnification of tagged expressions that are resolved in v4.1.

The speech for tagged expressions is improved in v4.1, in particular in how parentheses or other limiters around equation numbers are spoken. In order to support this, the tagformat TeX extension has been updated to allow the tagformat.tag and tagformat.ref configuration options to specify an array of three items, such as ['(', tag, ')'] rather than '(' + tag + ')' as in the past in order to separate the delimiter's from the tag itself. For backward compatibility, tagformat will separate out parentheses, braces and brakes automatically if the tag format is given as a single string.

Although the speech rule engine used by MathJax can produce Braille representations of the typeset expressions, support for tactile Braille output devices varies across screen readers, browsers, and operating systems. This has caused problems with Braille output devices in v4., which uses the aria-braillelabel attribute to specify an expression's Braille representation, since not all screen readers handle that attribute properly. Version 4.1 works around some of these limitations, and includes a new contextual menu item "Combine with Speech" in the Braille submenu that tells MathJax to include the Braille along with the speech in the aria-label attribute. This allows some screen readers to pass the Braille on to a Braille output device while still speaking the expression's text. In particular, NVDA users in Windows should select this option, while JAWS uses should not.

Prior to v4.0, MathJax by default used MathML that was visually hidden but available to screen readers that understand MathML and had it's onward speech-rule-engine generated text as an option that could be turned on. In v4.0, that was reversed, and the generated speech is on by default, with the hidden MathML as an option. Some readers prefer the hidden MathML, but to enable it you needed to turn it on and turn off speech and Braille, which took several menu selections to accomplish. In v4.1, selecting the hidden MathML turns off speech and Braille automatically, while selecting ether speech or Braille will turn off the hidden MathML, making it easier to switch between these two techniques. Note, however, that turning off speech and Braille will disable MathJax's expression explorer, and you must rely on the browser/screen-reader's ability to explore the hidden MathML expression instead.

Updates to Speech Generation

Labels are now spoken correctly at the top level and can be fully navigated at the end of a line or row. Also the speech for fenced labels now follow the rules selected by the speech preferences, the same as for other fenced expression. Likewise, prefix expression like column, row, line, case, etc., now follow the ClearSpeak preference settings.

SSML marking is now consistently being used throughout all speech rules across all rule sets and locales. Previously, only most of ClearSpeak and some of the English MathSpeak rules were marked up in SSML. Now it is rolled out across all locales, which leads to better synchronised highlighting in the MathJax self-voicing component. For example, for the formula $\{a,b,c\}$, when speaking StartSet only the opening brace will be highlighted, and similarly the closing brace for EndSet, rather than the entire expression as it was previously.

For formulas that contain hyperlinks, previously the links would only be announced when discovered during navigation, leaving the reader unaware of the fact that a formula contains one or more links. Now links are summarized at the top-level, giving the number of links that are contained in the expression, including if the entire formula is itself a link.

Other improvements include better treatment of mathematical elements that masquerade as text elements (usually for obtaining a different font), the correct recognition and speaking of European-style open intervals, in particular in ClearSpeak, as well as improved separation and alignment of indices for multi-indexed structures like tensors.

See also the lastest SRE release notes for more details.

Updates to TeX Input Processing

Some changes in v4.0 caused some left- and right-hand arrows in the mhchem extension to be swapped. Version 4.1 fixes that problem. In addition, using some explicit arrow macros like \rightleftharpoons would produce undefined macro warnings. Again, this is fixed in v4.1.

The use of numbers within \operatorname{} could lead to incorrect spacing in v4.0; e.g., \operatorname{atan2} would produce atan 2 with a space before the 2. This problem is fixed in v4.1, along with some issues with the spacing after empty operators or operators consisting of several components, like \operatorname{arg\,min}.

The processing of the CD environment now allows spacing following @, as in actual LaTeX, and the positions of labels on vertical arrows have been adjusted to better match actual LaTeX output.

The stretchy arrows produced by \xrightarrow and similar macros could stretch farther than expected in v4.0; in particular, this could occur if the arrow is the only item within a table cell in an array or alignment. In some cases, an arrow could disappear in CHTML output. Both these issues have been resolved in v4.1.

Incorrect use of braces with the \set command and similar ones from the braket extension did not always process the appropriate error message. For example. \set{ would throw an un-trapped error, while \set} would produce an empty set with no error message. These issues are resolved in v4.1.

Finally, the data-latex attributes attached to the internal MathML representation of the expressions (and carried over to the CHTML and SVG output) were sometimes incorrect. For example, a_{123} would mark the subscript using data-latex="23" rather than data-latex="123", while \begin{array} could be marked as just data-latex="{array}". The data-latex attributes should now be correct in these situations in v4.1.

Updates to CHTML and SVG Output

The CHTML output in v4.0 used modern CSS properties for clipping regions that are not supported in some older browsers. Version 4.1 replaces those with equivalent older CSS rules in order to be more compatible with those browsers. Some v4.0 CSS rules included the use of the * selector (though not at the top level), and this can degrade the performance in pages with a lot of complicated mathematical notation. These rules have been replaced by equivalent ones using explicit selectors instead.

The positioning of some combining accents, most notabley the vector arrow U+20D7 from \vec in TeX, were misplaced in v4.0 when viewed in Safari or other WebKit-based browsers. This has been resolved in v4.1.

The bounding boxes for arrays and alignments were miscalculated in v4.0 when automatic (or explicit) line breaks occur within their table cells, which could lead the the array or alignment overlapping content above or below the table. In addition, the width of columns containing stretchy horizontal character sometimes did not get computed correctly. Similarly, the size of a horizontal stretchy character that is made from a multi-character assembly might end up being too big in v4.0. These issues have been fixed in v4.1.

New Configuration Options

Several new configuration options are available in v4.1, including

  • A new fontExtensions option in the output block of the MathJax configuration allows you to specify the font extensions that you want to load. This simplifies using font extensions like mathjax-euler, which in v4.0 took some additional configuration to work properly.

  • A new fonts loader path is defined in loader.paths that points to where you want to load font extensions (like the ones used for the mhchem, dsfont, bbm, and bboldx extensions). If you are hosting your own copy of MathJax and its fonts, this allows you to route these extensions to your server with only one configuration change, rather than having to specify the location for each font individually.

  • A new polyfillHasOwn option in the startup block of the MathJax configuration controls whether MathJax will apply a polyfill for the modern Object.hasOwn() javascript function of that is missing. Modern browsers include this function already, but some older ones do not, so this allows MathJax to work in older browser versions.

  • Add new enableExplorerHelp option in the options block of the MathJax configuration determines whether the help icon at is shown at the upper right corner of the expression when it has the focus. Setting this to false disables the help icon.


List of Bug Fixes in this Release

TeX Input Changes

  • Fix some issues with data-latex handling. (mathjax/MathJax#3459) (#1385)

  • Don't let extensible arrows stretch a second time. (mathjax/MathJax#3457) (#1382)

  • Fix incorrectly swapped left and right arrows in mhchem. (#1358)

  • Only replace mhchem arrows when mhchem versions are available. (mathjax/MathJax#3452) (#1372)

  • Fix spacing issues with \operatorname. (mathjax/MathJax#3448) (#1367)

  • Don't add invisible function apply after an empty \mathop. (#1341)

  • Fix handling of malformed arguments to \set and others. (mathjax/MathJax#3447) (#1365)

  • Update the position of labels on vertical arrows to better match actual LaTeX output. (#1355)

  • Allow spaces after @ in CD environment, as in actual LaTeX. (mathjax/MathJax#3425) (#1343)

Output Changes

  • Fix a number of line-breaking problems in tables and elsewhere. (mathjax/MathJax#3416) (#1338)

  • Fix vector arrow positioning for Safari. (#1375)

  • Update clip-path CSS to handler older browsers. (#1356)

  • Remove use of * in CSS declarations. (mathjax/MathJax#3463) (#1387)

  • Use a default font size when it can't be computed directly. (mathjax/MathJax#3458) (#1380)

  • Prevent a disappearing stretchy arrow in CHTML. (mathjax/MathJax#3457) (#1381)

  • Allow stretched characters to increase column size (e.g., if it has minsize). (mathjax/MathJax#3423) (#1353)

  • Fix a problem with horizontal stretchy extenders when they are small. (mathjax/MathJax#3429) (#1347)

  • Prevent unwanted forced inline breaks in SVG semantics elements. (mathjax/MathJax#3428) (#1346)

User Interface Changes

  • Add support for dark-mode colors. (1369)

  • Update key explorer to use dialog elements for help dialogs. (mathjax/MathJax#3405) (#1357)

  • Make dialogs movable and sizable. (#1357)

  • Support tabbing to links internal to an expression. (mathjax/MathJax#3406) (#1335)

  • Fix problems with sending Braile to Braille output devices. (#1396)

  • Fix problems with magnification of tagged expressions and expressions with enclosures. (#1391)

  • Ensure highlighting of all nodes that are spoken. (#1349, #1354)

  • Better handling of speech for tagged expressions. (#1345)

  • Make selecting hidden MathML unset speech/Braille and vice-versa. (#1388)

  • Fix typo in menu that lead to an incorrect option in MacOS. (#1376)

  • Change CSS for help icon so that when scroll or truncate is used, it is not clipped. (mathjax/MathJax#3432) (#1350)

  • Remove use of aria-level attributes. (#1344)

API Updates

  • Add fontExtensions configuration option. (mathjax/MathJax#3410) (#1337)

  • Add a fonts loader path and have fonts use that for accessing their data. (#1373)

  • Provide Object.hasOwn polyfill and configuration option. (#1351)

  • Update node-main so that it works in bun as well as node. (mathjax/MathJax#3476) (#1397)

  • Add missing preLoaded() call for input/mml when a11y tools are used. (#1377)

  • Prevent circular dependency for tex extensions that load font extensions. (#1366)

  • Fix problem with Styles handling of margin. (mathjax/MathJax#3443) (#1362)

  • Better sanitization of styles. (#1348)

  • Add option to disable the explorer help dialog. (mathjax/MathJax#3422) (#1340)

  • Add missing help menu option. (#1336)

Build Tools Updates

  • Fix build path handling to work with Windows. (#1361)

  • Use node to call makeAll in the package scripts. (#1339)

2025-08-05 03:12:55
MathJax-src

MathJax v4.0.0

This is the long-awaited 4.0.0 release of MathJax, which has been several years in the making. Among the many new features in this release are:

  • Extended font support (11 new fonts)
  • A new default font with much greater character coverage.
  • Line-breaking support (for in-line as well as displayed equations)
  • An updated expression explorer that is now on by default.
  • Separation of speech generation into a webworker thread for better performance.
  • Support for HTML embedded in TeX and MathML expressions.
  • Availability as ES6 modules as well as CommonJS modules.
  • New TeX extensions, including the begingroup extension from v2 (with more features), and several font-related extensions.
  • Inclusion of the textmacros extension in all combined component files.
  • Updated mathtools package to include the changes from 2022 and 2024.
  • Improvements in the baseline alignment of text in CHTML output in WebKit-based browsers.
  • Improved stretchy delimiters in CHTML output.
  • More promise-based conversion and typesetting calls at the document level.

The MathJax documentation has been substantially updated for version 4, and now includes the missing or limited sections on using MathJax in node, including many examples and details. See the What's New in V4.0 section (more than 50 pages long) for much more information about the features described above, and in particular, check the Breaking Changes section for any changes that may affect your usage.

The MathJax web demos repository has been updated for v4.0, and reorganized for easier viewing. The demos now include a "Show Source" button that displays explanations and the important sections of the source code rather than using separate .md files, so there are fewer files to wade through, and you can compare the source code to the output more easily. There are also new examples in the documentation on using MathJax in a browser; most are listed in the Examples in a Browser section.

The MathJax node demos repository is being updated and reorganized as well, but work is still being done on that, as some of the documentation needs to be expanded (for now, you may need to read the comments in the code). The tools in this repository have been made more powerful and complete, and much of the functionality that is common across multiple tools have been moved to utility libraries that can be shared by several tools. That means the examples are no longer stand-alone files, but they are more complete in their ability to use the features of MathJax. For example, all the examples that produce CHTML or SVG output can select the font to use, or add speech labels, and so on, and because speech is now available in all those examples, there are no longer separate speech demos. The tools can now take several expressions at once to typeset, or take them from a file, or process a complete HTML page. This means there are no longer separate page-based tools, so the number of examples is reduced, but the functionality is expanded. The MathJax documentation now covers using MathJax in node application in more detail than for v3, with lots of examples; most of these are listed in the Examples in Node Applications section.

As always, you may report issues in the MathJax issue tracker for v4; this is a major update, and there are sure to be things that will need adjusting.

2025-06-21 00:15:17
MathJax-src

MathJax v4.0.0-rc.1

This PR is the culmination of months of work to improve the performance of the assistive and speech-generation tools in MathJax. These are discussed in the sections below. There are also a number of new features and bug fixes. With this release, MathJax is moving to scoped npm packages, in the @mathjax scope; see below for more details. This is the last planned pre-release of v4.0, and it is the current release candidate. If all goes well, the official v4.0 should be released in July.




Accessibility Performance Improvements

When the MathJax accessibility features were turned on by default in the 4.0.0-beta.6 release, this led to a greater performance degradation in practice than in our testing. The 4.0.0-beta.7 attempted to address that issue by putting off the speech generation until after the mathematics was displayed, but this still did not perform as well as we wanted. As a result, we have spent the last 6 months working on alternative approaches.

The method we selected is to move the speech generation into a web-worker thread, which allows the browser to remain responsive even while the speech generation is being performed. This involved a substantial refactoring of both the MathJax assistive support code, as well as the speech-generation engine that underlies that support, but our tests indicate that this is a significant improvement over the results in the beta.7 release. Because web-workers are only available in browsers, not in node applications, we had to develop a means of supporting this new approach within node. Our solution was to use the node worker-threads library, along with some shim code to give it a corresponding interface to the features we were using from web-workers in the browser. This allows the same code to be used in both browsers and node applications. Currently this requires the use of the LiteDOM in node, but we may provide support in other DOM implementations in the future.

Because node applications that include speech generation now use worker-threads behind the scenes, the node application won't exit until the MathJax worker thread is shut down, so applications may need to tell MathJax that they are finished. This is done by calling the new MathJax.done() method in applications that use MathJax components, or by calling the MathDocument's done() method for this that use direct calls to MathJax's modules.

Expression Explorer Improvements

The expression explorer in the beta.7 release does not follow the ARIA standards properly, and while it worked in some browsers and with some screen readers, it did not work well in others, and, in particular, it failed rather badly in VoiceOver on MacOS. The interaction between browsers and screen readers is complicated, and the results vary widely among the different browser/os/screen-reader combinations. We spent several months searching for a mechanism that followed the ARIA specification while still giving consistent results across that various browsers and screen readers. The main goals were to:

  • Follow the ARIA standards.
  • Work across the major browser/OS/screen-reader combinations.
  • Properly read the full expression when reading the whole page or stepping through the page sentence-by-sentence (or by other units).
  • Automatically enter "focus mode" when the expression is focused via tabbing or clicking (in those screen readers that have separate focus and browse modes).
  • Allow control over the description of the math (e.g., "math", "clickable math", or no description) used during reading and focusing.
  • A "press H for help" message should be spoken when the math is first focused (but can be turned off by a menu preference).

We tested with 13 combinations: Chrome, Firefox, and Safari on MacOS with VoiceOver; Chrome, Firefox, and Edge on Windows with NVDA and JAWS; and Chrome and Firefox on Linux (Ubuntu 24 and 22) with Orca, and believe we have achieved these goals in all cases. The new explorer should give a much smoother experience to screen-reader users in all these settings.

Using the explorer remains largely the same. The explorer was enabled by default initially in beta.6, and continues to be in this release. That means that clicking on an expression will enter the explorer, highlight the clicked term, and cause a screen reader to speak that term; navigation via arrow keys will continue from that point. In previous versions, the speech and/or braille subtitles were shown as well, but these have been turned off by default in this release, as they caused confusion for users not aware of the explorer fetures. They can be re-enabled by use of the MathJax contextual menu.

Several new functions have been added to the explorer:

  • Pressing h will open a dialog box that describes the explorer's features. When an expression is first focused, a message informing the user of this feature is announced after the expression is read, but that can be disabled using the contextual menu.
  • Clicking on an expression starts the explorer and selects the clicked character, as in the past. New in this version is that double-clicking will start the explorer on the whole expression (just as tabbing to it would).
  • In the previous version, if an expression was explored and tab is used to leave the explorer, when that expression is refocused, the selection would remain where it was when the expression was exited. In this version, tabbing to an expression always starts at the top level of the expression, not the last selected term. The reason for this is so that if the page is read, wither as a whole or by smaller chunks, the expression will be read in full rather than just the previously selected term. There is a contextual menu item that can be used to select the older behavior, however, if a user wishes to be able to restart the explorer where they left off.

Speech-Generation Improvements

Aside from moving the speech generation into a web worker or node worker thread, the speech-generation has been improved by adding more sophisticated semantic analysis for complex user defined structures, including improved disambiguation of function applications, ellipses, and unusual large operators. MathJax now also automatically includes speech generation in precise SSML markup that is used for MathJax's auto-voicing feature as well as exposed in the speech attributes. Additional locales supported are Afrikaans and Korean as well as 8-dot Euro Braille output generated from original LaTeX input formulas.

Because the speech generation has been moved to a web-worker, the speech is no longer produced by the main MathJax thread, and so the timing options that were added in v4.0.0-beta.7 have been removed. That is, the speechTiming section of the options block of the MathJax configuration is not longer necessary, and will be marked as invalid if it is used.

Input Changes

In previous versions of MathJax, the macros in text-mode material (in \text{} and similar macros) were not processed unless the textmacros extension was loaded and enabled. This version now includes the textmacros extension in all the combined components that contain the TeX input jax (i.e., all the ones starting with tex-). This means that macros inside text-mode will be processed. Because only a limited number of text-mode-macros are defined, this can lead to errors in cases where the literal macro name would be displayed in the past. For example, prior to this version \text{The \item macro is used in lists} would produce the literal string The \item macro is used in lists, but in this version, it will lead to an error message about \item being undefined. So this may be a breaking change in some pages that take advantage of the old behavior.

You can disable the textmacros extension in combined components that include it by merging

MathJax = {
  tex: {
    packages: {'[-]': ['textmacros']}
  }
};

into your MathJax configuration.

One of the last remaining extensions from version 2 that was not ported to v3 is now available in this release: the begingroup extension that allows you to create temporary macro definitions. See the v2 begingroup documentation for more details (the v4 documentation is being written, but is not yet available).

The v4 version of begingroup defines two new non-standard macros: \begingroupReset and \begingroupSandbox. The first one ends any open \begingroup macros, reming any of their temporary macros or environments. The second can be used to isolate the definitions in one section of the page from those in another, so that sites like StackExchange can use this between user posts to make sure that one user doesn't redefine things to mess up another user. The \begingroupSandbox macro can't be redefined, and its action is essentially to do \begingroupReset\begingroup. This removes any previous user definitions and makes a new group for the next user's definition. It also directs any global definitions to this new group so that a user can create global macros in their own sandbox, but they are removed at the next \begingroupSandbox call. Any macros or environments created before the first \begingroupSandbox call are shared definitions that are available in every sandbox. Once \begingroupSandbox is performed, however, there is no going back; no new shared definitions can be made.

The mathtools extension has been updated to reflect the changes to the actual LaTeX package that were made in 2022 and 2024. In particular, there are some breaking changes to \coloneq and three other colon macros, several new colon-like commands, and several new extensible arrow macros, as described below.

The \coloneq, \Coloneq, \eqcolon and \Eqcolon macros now use the 2022 and later definitions (they use = rather than -, so \coloneq produces := not :- as in the past). A new legacycolonsymbols option controls which set to use (just as in actual mathtools). This can be set in the mathools section of the tex block of your MathJax configuration, of via the \mathtoolsset macro. The new colon macros \approxcolon, \Approxcolon, \simcolon, \Simcolon, \colondash, \Colondash, \dashcolon, and \Dashcolon are now defined, and are available regardless of the setting of legacycolonsymbols.

The new extensible arrow macros are \xlongrightarrow, \xlongleftarrow, \xLongrightarrow, and \xLongleftarrow.

Support for \MakeAboxedCommand, which was missing in the past, has been added in this release. This includes a non-standard starred version that handles box commands whose contents are in math-mode rather than text-mode, like \bbox and \boxed versus \fbox and \fcolorbox.

The \vcentercolon macro was incorrectly named \centercolon in previous versions, and has been corrected here. This is a breaking change for pages that used the incorrect name, but you can always define \centercolon to be \vcentercolon if that is an issue.

The mutlinedgap configuration option has been renamed to multlined-gap to correspond better with other option names (that all use dashes), and there is a new multlined-width option has been added to give the default width for multlined environments.

For the mhchem extension, several of the arrows were not previously stretchy. This release adds a new mhchem-specific font that includes the characters needed to stretch all the arrows available in mhchem, improving its output in both CHTML and SVG output. Note, however, that these fonts match the mathjax-newcm font set, and are used no matter what font is selected, so the arrows may not match other arrows used in the font if you are using one other than mathjax-newcm.

The digits options in the tex configuration block has been changed to numberPattern, and a new initialDigit pattern is available to specify what initial characters signal the start of a number. These make it easier to customize what constitutes a number for languages that use alternative characters, like Persian or Arabic. The digits option continues to be available for now, but will be removed in a future release.

There is also a new initialLetter pattern that is used to trigger multi-letter identifiers. This make using accented characters or other non-Latin characters for multi-letter identifiers easier to configure.

Output Changes

This version of MathJax includes a new font, mathjax-newcm, based on the New Computer Modern fonts, and this is now the default font for MathJax v4. Its look is largely the same as the previous default, mathjax-modern, but mathjax-newcm is slightly darker, and has greater character coverage. We hope this addresses the concerns that some expressed about the lightness of the mathjax-modern font.

An important improvement has been made to the way the CommonHTML (CHTML) output handle stretchy delimiters. In the past, the CHTML output would use CSS transforms to stretch the extender to the needed size. This lead to alignment issues between the extenders and the end pieces in some browsers, and in some cases, thin extenders disappeared entirely. In this version of MathJax, the extenders are made from repeated copies of the extender piece, slightly overlapping, and clipped to the proper size. This makes for cleaner and more reliable assemblies for stretched characters, both vertically and horizontally, and should eliminate the rendering problems seen in the past.

The MathJax layout uses a font that has larger depth below the baseline than most standard fonts. When the MathJax character are selected using drag selection, this leads to the selection bounding box being larger than expected. With this release, the CHTML output now uses clip paths to restrict the bounding boxes, making for more accurate selection backgrounds, and preventing unwanted vertical scroll bars in some displayed equations.

MathJax Scoped Packages

With this release, MathJax is moving to scoped packages for the source and font npm packages. The mathjax-full package is now @mathjax/scr, and the font packages are @mathjax/mathjax-stix2-font, @mathjax/mathjax-fira-font, and so on. Future extensions and other packages will be in the @mathjax scope as well. The only exception is that the mathjax package will remain un-scoped. Since that use of MathJax in browsers is primarily through the mathjax package, that means the URL for loading MathJax will remain the same, with only the version number needing to be changed. That is, you can use

https://cdn.jsdelivr.net/npm/mathjax@4.0.0-rc.1/tex-mml-chtml.js

to load this release candidate version of MathJax. But to obtain the source version to include in a node project, you would use

pnpm install @mathjax/src@4.0.0-rc.1

or a similar command, or

pnpm install @mathjax/mathjax-stix2-font

to get the latest mathjax-stx2 font package.

MathJax API Additions

In previous version of MathJax, the speech generation was performed within the semantic-enrich component along with the semantic enrichment of the internal MathML representation of the mathematical expressions that it processes. In this release of MathJax, these two functions have been separated from each other, and the speech-generation functionality is performed in a new speech component. This is included in all the combined components, but can be loaded individually by including a11y/speech in the load array of the loader block of your MathJax configuration.

The section on Accessibility Performance Improvements already mentions the new MathJax.done() function that is used to shut down the web-worker or node worker-thread invalid in speech production. There is a corresponding new done() method for the MathDocument class that can be used in application that don't use the MathJax Component framework, but rather call on MathJax modules directly.

Some actions in MathJax require loading extra code from an extension, which is an asynchronous action, as the browser must wait for the file to be loaded before it can use it. In MathJax v3, such asynchronous actions were mostly associated with loading TeX extension packages, and that could be avoided by pre-loading the extensions that are needed, so that typesetting could be performed synchronously. In v4, with fonts that have much greater coverage than in v3, some font data may need to be loaded asynchronously as well, and that means that typesetting may be asynchronous even if all the needed TeX extensions are pre-loaded. As a result, the MathJax.typesetPromise() function is more likely to be needed, and MathJax.typeset() will only work if not font data needs to be loaded.

Because of this greater need to handling asynchronous file loading, several new functions have been added to the MathDocument class to provide promise-based versions of the corresponding synchronous calls. These include convertPromise(), renderPromise(), and rerenderPromise(), which wrap the convert(), render(), and rerender() methods in the needed mathjax.handleRetriesFor() call and return its promise. This makes it easier to perform these actions when font data or TeX extensions need to be loaded than having to use handlerRetriesFor() yourself.

In the previous beta versions of v4, the promise-based functions like MathJax.typesetPromise() and MathJax.tex2mmlPromise() use MathJax.startup.promise to serialize the typesetting actions, preventing them from occurring concurrently (in version 3, you were expected to do that yourself). In this version, these functions now use the new promise-based functions from the MathDocument class. Because MathJax.startup.promise is part of the MathJax Components framework, and MathDocuments can be used outside that framework, the new MathDocument promise-based calls use their own private promise instead, and the MathJax.startup.promise reverts back to it original purpose of representing when he initial typeset operation has completed.

You nay wish to use the new MathDocument promise to synchronize other code with MathJax's typesetting operations, however, without having to keep track of the promises returned by the three new promise-based functions. For this reason, MathJax provides a new whenReady() method of the MathDocument class. It takes a function as its argument, and performs that action when its internal promise is resolved; that is, when any previous promise-based typesetting actions complete. You can think of whenReady() as queuing your action to be performed whenever MathJax has finished anything that has been queued previously.

The function you pass to whenReady() can return a promise (if it starts any asynchronous actions of its own, for example), in which case that promise must be fulfilled before any further whenReady() actions will be performed. For example

const doc = mathjax.document('', {});
doc.whenReady(() => console.log('A'));
doc.whenReady(() => {
  return new Promise((ok, fail) => {
    setTimeout(() => {
      console.log('B');
      ok();
    }, 1000);
  });
});
doc.whenReady(() => console.log('C'));

would print A to the developer console, then a second later print B followed by C..

The MathJax code base has undergone a major cleanup effort for this release, using eslint and prettier to format the code consistently, and new life-cycle scripts to perform these actions have been added to the package.json file. Other modernizations, like moving from String.substr() to String.substring() were also performed.

Finally, MathJax's test suite has been expanded to include more than 3,000 tests. We have full coverage for the TeX input jax and the ts/util directories, but more tests need to be written for other sections of the code base. This is an ongoing project that will take time to complete.

Breaking Changes in this Release

The Input Improvements section already discusses some potentially breaking changes for some pages, including the fact that the the textmacros extension is now included in all combined components, the update to the mathtools extension to include the changes in the corresponding LaTeX package from 2022 and 2024, and the change from digits to numberPattern for configuring the pattern used to identify a number in TeX input.

The MathJax Scoped Packages section describes MathJax's change to using scoped npm package names, and in particular, moving from mathjax-full to @mathjax/src.

Changes for Speech Generation

The API Changes section above describes the separation of the semantic enrichment from the speech generation and the introduction of a new speech component. Because the speech is now generated within a web worker or node worker thread, the speech-generation code is no longer in the main MathJax components, but is in a separate file that is run in the worker. That means there is no more access to speech generation directly within MathJax (it is only available in the worker). In particular, the ts/a11y/sre.ts file now only include the semantic-enrichment methods of the speech-rule engine, so Sre.toSpeech() is no longer available. In a node application, you can load this function directly from the speech-rule engine's API, however. Here is an example command-line script that takes a TeX expression and returns its speech string using this approach:

//
//  Load the modules needed for MathJax
//
import {mathjax} from '@mathjax/src/js/mathjax.js';
import {TeX} from '@mathjax/src/js/input/tex.js';
import {liteAdaptor} from '@mathjax/src/js/adaptors/liteAdaptor.js';
import {RegisterHTMLHandler} from '@mathjax/src/js/handlers/html.js';
import {SerializedMmlVisitor} from '@mathjax/src/js/core/MmlTree/SerializedMmlVisitor.js';
import {STATE} from '@mathjax/src/js/core/MathItem.js';

//
// Import the speech-rule-engine
//
import '@mathjax/src/components/require.mjs';
import {setupEngine, engineReady, toSpeech} from 'speech-rule-engine/js/common/system.js';

//
// Import the needed TeX packages
//
import '@mathjax/src/js/input/tex/base/BaseConfiguration.js';
import '@mathjax/src/js/input/tex/ams/AmsConfiguration.js';
import '@mathjax/src/js/input/tex/newcommand/NewcommandConfiguration.js';
import '@mathjax/src/js/input/tex/noundefined/NoundefinedConfiguration.js';

//
// The em and ex sizes and container width to use during the conversion
//
const EM = 16;          // size of an em in pixels
const EX = 8;           // size of an ex in pixels
const WIDTH = 80 * EM;  // width of container for linebreaking

//
// Create DOM adaptor and register it for HTML documents
//
const adaptor = liteAdaptor({fontSize: EM});
RegisterHTMLHandler(adaptor);

//
// Create input jax and a (blank) document using it
//
const tex = new TeX({
  packages: ['base', 'ams', 'newcommand', 'noundefined'],
  formatError(jax, err) {console.error(err.message); process.exit(1)},
  //
  // Other TeX configuration goes here
  //
});
const html = mathjax.document('', {
  InputJax: tex,
  //
  // Other document options go here
  //
});

//
//  Create a MathML serializer
//
const visitor = new SerializedMmlVisitor();
const toMathML = (node => visitor.visitTree(node, html));

//
// Convert the math from the command line
//
const mml = html.convert(process.argv[2] || '', {
  display: true,
  em: EM,
  ex: EX,
  containerWidth: WIDTH,
  end: STATE.CONVERT         // stop after conversion to MathML
});

//
// Set up the speech engine to use English
//
const locale = process.argv[3] || 'en';
const modality = locale === 'nemeth' || locale === 'euro' ? 'braille' : 'speech';
await setupEngine({locale, modality}).then(() => engineReady());

//
// Produce the speech for the converted MathML
//
console.log(toSpeech(toMathML(mml)));

With the speech generation being performed in a worker, the process is now inherently asynchronous, as the communication between the main thread and the worker thread is mediated by promises. That means that speech generation can't be done synchronously, and you must use the promise-based functions for handling typeset and conversion operations that involve speech.

The speech-generation process now applies the speech attributes to the DOM nodes themselves, rather than to the internal MathML structure, so serialized versions of the internal MathML will not include the speech, as they did in the past.

Because of the changes in how speech is being generated, the speechTiming section of the options block of the MathJax configuration is no longer supported, and will cause an error if it is used in your configuration.

Name Changes

Some name changes have occurred within the code to help clarify the purpose of some objects or methods. In particular, the Loader.preLoad() method has been renamed Loader.preLoaded() in order to make it clear that this does not itself load the given components, but that your code has done that and you are telling MathJax that they have already been loaded.

Another change involves the objects used to handle CSS styles. MathJax has two object classes that deal with CSS definitions, one that specifies CSS styles via object literals (essentially JSON structures), and one that parses a CSS string into an object structure that acts like a DOM element's style attribute. Moreover both modules declared a StyleList type, and these were not compatible. That caused both confusion and complicated their use together in the same module, so the names have for these types and objects have been changed in this release in order to make it clearer which is which.

To accomplish this, the ts/util/CssStyles.js file was renamed to ts/util/StyleJson.js, and with that, StyleList is changed to StyleJson, StyleData to StyleJsonData, and CssStyles to StyleJsonSheet. This more accurately describes what this object does (it is the one that takes JSON data), while the ts/util/Style.js file implements (a subset of) the DOM object style attribute.

Finally, the latest.js file has been removed, as jsdelivr.net and other CDNs handle providing the latest version automatically, and with more granularity than this file did.


List of Major Updates

The major fixes and changes in this release fall into the following categories.

Input Updates

  • Report failure of \require rather than throw an error. (#1255)
  • Handle non-breaking spaces correctly in \text{}. (mathjax/MathJax#3353) (#1240)
  • Allow \eval with no argument in physics package. (mathjax/MathJax#3346) (#1232, #1234)
  • Add texClass REL when combining mo nodes so they round-trip through SRE properly. (#1228)
  • Fix incorrect character for \char`\x (was incorrectly set to \char'\x). (#1225)
  • Error for colors that include semicolons. (#1223)
  • Update mathools to include changes in the LaTeX package from 2022. (#1213)
  • Add \MakeAboxedCommand to mathtools extension. (#1213)
  • Implement begingroup package. (#1182)
  • Map \perp to U+27C2 rather than U+22A5. (issue mathjax/MathJax#3322) (#1181)
  • Allow better configuration for patterns for numbers and identifiers. (#1178)
  • Add textmacros to the input/tex components. (#1172)
  • Update newcommand to handle delimiters vs macros better. (#1165)
  • Make over- and under-lines not be accents, so they operate as in actual TeX. (#1162)
  • Make over/under braces and matrices be full size, as in actual TeX. (mathjax/MathJax#3300) (#1146)
  • Have \let look up macros first then delimiters, and removes \\ delimiter. (#1145)
  • Add a template substitution count to avoid infinite loop. (#1142) (#1144)
  • Fix incorrect handling of user-defined environments introduced in #856. (#1137) (#1139)
  • Fixes the Dutch longdiv issue. (#1136)

Output Updates

  • Fix script spacing when MathML spacing is used. (mathjax/MathJax#1224) (#1259)
  • Fix cssText creation to handle border-radius and similar values. (mathjax/MathJax#3365) (#1252)
  • Adjust assisitve-mml output to prevent it from shifting outside the expression bounding box. (#1244)
  • Fix position of mmultiline scripts in WebKit when <none> is used. (#1244)
  • Don't allow inline breaks at negative spaces. (#1233)
  • Update default spacing for mo elements that aren't in the operator dictionary. (mathjax/MathJax#3288) (#1224)
  • Change order of root and radicand in mroot output. (mathjax/MathJax#3335) (#1222)
  • Fix position adjustment for scaled SVG items with ids. (#1221)
  • Add stretchy characters needed by mhchem. (#1174)
  • Remove use of css transforms for handling stretchy assemblies in CHTML output. (#1173)
  • Handle clipping of characters in CHTML better and avoid vertical scroll bars for overflow="scroll". (#1171)
  • Change default font to mathjax-newcm. (#1140)

Interface Changes

  • Add menu item to control what tabbing will focus on. (#1258)
  • Add defaultOptionError function for easier configuration. (#1256)
  • Add MathJax.whenReady() function. (#1244)
  • Add core promise-based typeset and convert functions. (#1231)
  • The getMetricsFor() method now includes the display property. (#1229)
  • Add ability to filter SRE and LaTeX attributes from SVG image. (#1184)
  • Include a11y in default settings, and fix a number of problems with changing menu values. (mathjax/MathJax#3310) (#1169)

Miscellaneous

  • Move highlighter module from SRE to MathJax. (#1250)
  • Change to using @mathjax/src rather than mathjax-full. (#1243)
  • Implement new explorer paradigm. (#1241)
  • Print webpack failure messages in build tools. (#1239)
  • Fix lookbehind assertions that are not widely supported in browser. (#1238)
  • Map components/js to components/cjs for require() or components/mjs for import. (#1227)
  • Updates for running workers in node. (#1219)
  • Rename StyleList to StyleJson, etc. (#1180)
  • Rename Loader.preLoad() to Loader.preLoaded() to make it clear that this doesn't do any loading itself. (#1177)
  • Move to scoped packages for fonts, and use woff2 format. (#1168)
  • Remove latest.js as jsdelivr can do this automatically. (#1157)
  • Improve merging of math lists (mathjax/MathJax#3301). (#1143)
2024-07-26 05:02:49
MathJax-src

MathJax v4.0.0-beta.7

This 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 (mathjax/MathJax-src#1121)

  • Create explorer regions only when needed (mathjax/MathJax-src#1119)

  • Fix inline breaking in Safari. (mathjax/MathJax#3252) (mathjax/MathJax-src#1117)

  • Compute proper left and right adjustments for tables in bussproof TeX extension. (mathjax/MathJax#3251) (mathjax/MathJax-src#1115)

  • Fix bounding box computation for some embellished operators. (mathjax/MathJax#3250) (mathjax/MathJax-src#1114)

  • Remove the AllPackages file, the all-packages TeX extension and the tex-full component (mathjax/MathJax-src#1110)

  • Update the asyncLoad implementations to be more consistent, and update tests. (mathjax/MathJax-src#1109)

  • Improve speech performance, especially for lazy typesetting (mathjax/MathJax-src#1107)

  • Improve performance by detaching speech computation (mathjax/MathJax-src#1103)

  • Allow columns to shrink during line breaking. (mathjax/MathJax#3235) (mathjax/MathJax-src#1102)

  • Fix regression from #1069 (mathjax/MathJax#3233, mathjax/MathJax#3234) (mathjax/MathJax-src#1101)

  • Refactors the treatment of namespaces for methods of TeX packages (mathjax/MathJax-src#1097)

  • Refactors and simplifies macro mappings (mathjax/MathJax-src#1096)

  • Update handling of math accents to round-trip through SRE (mathjax/MathJax-src#1093)

  • Use XML serialization not HTML serialization for SVG images. (mathjax/MathJax#3226) (mathjax/MathJax-src#1090)

  • Fix handling of unknown characters in SVG output. (mathjax/MathJax#3224) (mathjax/MathJax-src#1089)

2024-05-01 03:04:44
MathJax-src

MathJax v4.0.0-beta.6

This release includes a significant rewrite of the expression explorer and an update to the speech-rule engine (SRE) that underlies MathJax's assistive support. Accompanying this is a reorganization of the MathJax contextual menu that moves the assistive options to a more prominent position for easier access and better control. This release also includes several new font-based TeX packages (and the fonts to accompany them) that provide alternative double-struck character styles. In addition, we have moved from npm to pnpm as the package manager for the MathJax source repository. Finally, there are also a number of bug fixes since the beta.4 release.

We anticipate one more beta release before the official 4.0.0 release.

Explorer Updates

The MathJax expression explorer has been updated to seamlessly fit in with an accessible browsing experience. In particular, there is no longer a need to switch on accessibility support in the contextual menu (which can still be used to explicitly disable that support, as described in the next section). Once a formula is focused, exploration can immediately start by using the arrow keys. (For a full list of keyboard commands see here.) This allows you to dive into the details of the formula, including highlighting sub-expressions, and, if selected, magnification. Moreover, the explorer can now also be started by left-clicking elements within in the formula itself. That is, you can click on any character within the expression to start the explorer at that point in the expression. Communication with screen readers (if any is used) is achieved via aria-label and aria-braille-label elements instead of the live region as utilized previously. Alternatively, automatic voicing and synchronized highlighting can be used directly without a screen reader by switching on those options in the contextual menu.

Menu Updates

The MathJax contextual menu has been reorganized to make the accessibility features more easy to use. The top-level menu now includes an "Accessibility" section with four submenus — "Speech", "Braille", "Explorer", and "Options" — rather than an accessibility submenu as in previous versions. The Speech menu allows you to enable/disable speech generation and its associated visual output, and to turn on or off auto voicing. It also provides control over the speech rule-set to use, the verbosity of the set in use, and the language to use for the speech. Similarly, the Braille menu allows you to enable/disable Braille generation and display, as well as to select the type of Braille to generate.

The explorer controls for magnification and highlighting have been moved to the Explorer menu, and other accessibility options have been moved from the Math Settings and old Accessibility submenus to the Options menu. A new "Semantic Enrichment" option controls whether the accessibility features are available or not (unchecking disables speech and Braille generation and the explorer).

New TeX packages

This release of MathJax includes three new TeX packages that provide alternative double-struck (i.e., blackboard bold) character sets: dsfont, bbm, and bboldx. New font extensions for the mathjax-modern font are now available for these packages, and the font extensions are loaded automatically when the TeX package is loaded. Currently, these fonts are available only in combination with the mathjax-modern font, but in the next release, they will be able to be applied to any of the available fonts.

The dsfont package defines a macro \mathds that provides access to its double-struck characters. There is a configuration option that controls whether the sans-serif version of these fonts is used, or the roman versions:

MathJax = {
  tex: {
    dsfont: {
      sans: true   // default is false
    }
  }
}

The bbm package defines macros \mathbbm, \mathmmbss, and \mathbbmtt to generate its double-struck characters, as well as a \mathversion macro that can be used to select the version of the double-struck fonts to use (this is a global setting). Here, \mathversion{bold} selects the bold versions of the double-struck characters, while any argument other than bold will select the normal versions of the fonts.

The bboldx package redefines \mathbb to use the bboldx double-struck characters, and adds \mathbfbb to access their bold-face versions, plus \imathbb, \jmathbb, \imathbfbb, and \jmathbfbb for dotless i and j characters in these fonts. In addition, there are macros for upper- and lower-case Greek letters, e.g., \bbGamma, \bfbbsigma, etc., and text-based versions of these for use in \text{}, e.g., \txtbbGamma. The bold delimiters \bbLparen, \bbRparen, \bbLbrack, \bbRbrack, \bbLangle, \bbRangle, and the bfbb versions of these, are defined, but do not yet work with \left and \right. That will be addressed in the next release.

Move from npm to pnpm

With this release, MathJax is switching to pnpm as our package manager rather than npm. This speeds up installation and improves script handling. Although you can still use npm, some of the scripts in package.json call pnpm, so you will need to have pnpm installed to use those scripts. Fortunately, this only affects those who are compiling and packaging MathJax, so unless you are working with the MathJax source files, you should not be affected by this change. If you are only using MathJax in web pages via a CDN, for example, you will not need to worry about pnpm (or npm).

To install pnpm you can use

npm install -g pnpm

The following sections indicate the bug fixes in this release:

TeX Input Fixes

  • Add dsfont, bbm, and bboldx TeX extensions (#1055, #1056, #1057, #1063, #1064, #1065, #1074, #1075, #1076)

  • Make textcomp package register with textmacros automatically. (#1073)

  • Fix problems with data-latex attribute generation (mathjax/MathJax#3184) (#1028, #1060)

  • Allow unknown characters to use the operator table to determine class and node type. (mathjax/MathJax#3203) (#1070)

  • Handle primes in munderover as in msubsup. (mathjax/MathJax#3202) (#1069)

  • Make \symbf and \symsf handle Greek italics as in LaTeX. (#1061)

  • Add missing commands to textmacros package (#1071)

  • Make stretchy paired delimiters in the mathtools package not be class INNER. (mathjax/MathJax#3183) (#1059)

  • Fix \require to properly handle retries in dependencies. (mathjax/MathJax#3170) (#1050)

  • Move \divsymbol to physics package and add \divisionsymbol. (mathjax/MathJax#3173) (#1049)

  • Allow (embellished) operators in \underset, \overset, and \underoverset to specify accent="true" (#894)

  • Fix processing of \U{...} where two occurrences in \text{} would fail. (#1048)

  • Update handling of braket bars so that the enclosing braket can be more accurately found. (mathjax/MathJax#3164) (#1041)

  • Fix problem with \let using attributes of {} when they should be null (#1030)

  • Have \unicode check for illegal font name. (mathjax/MathJax#3129) (#1019)

Output Fixes

  • Add xmlns attribute for global cache svg element. (mathjax/MathJax-demos-node#58) (#1045)

  • Fix issues with line breaks and spacing in SVG output. (mathjax/MathJax#3166) (#1043)

  • Make sure math items have their metrics set before lazy typesetting. (mathjax/MathJax#3167) (#1042)

  • Don't descend into items that aren't broken when looking for the line-break node. (mathjax/MathJax#3135) (#1024)

  • Fix font extension handling of extra variants, and handle those variants in enrichment. (#1033)

  • Update CHTML longdiv output to not require clip-path. (#1025)

  • Better measuring of text that is in a native font rather than MathJax fonts (#1014)

User Interface Updates

  • Update accessibility menu items (#1068, #1082)

  • Update expression explorer (#987, #1035, #1040, #1053, #1058, #1078, #1079)

  • Fix problem with spurious white pixels from unused explorer regions (mathjax/MathJax#3001) (#1072)

  • Fix rendering of embedded HTML to work with scaling and mathsize changes. (mathjax/MathJax#3116) (#1012)

  • Add ability to not show latex attributes, and reorganize settings menu (#1017)

API Fixes

  • Proper handling of typesetPromise() in defaultPageReady(). (mathjax/MathJax#3130) (#1018)

  • Move from npm to pnpm (#1021, #1023, #1077)

  • Add missing Text.splitText() method to linkedom. (mathjax/MathJax#3134) (#1036)

  • Update LiteParser's serializeXML() method. (mathjax/MathJax-demos-node#58) (#1046)

  • Fix menu to not re-render if no typesetting has occurred. (mathjax/MathJax#3167) (#1044)

  • Fix keyvalOptions to process braces and backslashes better (#1031)

  • Update TeX input's keyvalOptions, and add GetBrackets() option to match brackets. (#1037)

  • Add ability to do typechecking and conversion on the values of key-value options (#1032)

  • Clear process bits for findMath() and attach-speech(), and remove safe bit that isn't needed. (#1034)

  • Refactor input/tex/ParseUtil.ts to remove namespace (#1022)

  • Add cssText() method to DOMadaptor and handle dynamic rules in HTML output. (#1027)

  • Make const enum DIRECTION into a regular object. (mathjax/MathJax#3114) (#1026)

  • Fix default option list to {} in constructors for output jax. (mathjax/MathJax#3128) (#1016)

  • Fix make-cjs-components script to work without mjs files being built first (#1013)

2024-04-26 05:51:03
MathJax-src

MathJax v4.0.0-beta.5

This release has a packaging problem that affects its use in node application. It should work for web use, but you should not use it for in node. We are preparing a beta.6 release that should resolve the issues.

2023-10-05 00:34:50
MathJax-src

MathJax v4.0.0-beta.4

This is mainly a bug-fix release to resolve some errors reported with the recent beta.3 release. A summary of some of the most significant fixes are below, followed by a categorized list of the fixes with links to the original issues that reported them, and to the pull requests that fixed the problem. See those links for additional details on those issue.

Change Summary

  • The move to ESM modules and compiling to ES6 rather than ES5 lead to an issue with the webpacked versions of some component files that would cause errors when they are loaded. This has been resolved in this release. The source of the problem was due to the use of a custom Symbol class in MathJax's TeX input jax that conflicts with the native javascript Symbol object. This was not an issue in previous versions of MathJax, but due to differences between how webpack handles CommonJS and ESM modules, it now causes problems with some TeX extension packages that use the Symbol class. This has lead us to rename the custom Symbol class to Token, and rename the Symbol.ts and SymbolMap.ts files to Token.ts and TokenMap.ts. This is a potential breaking change to those who have created their own TeX extension packages that load one of these files.

  • There was an issue in v3 where MathJax would throw an error setting getter-only property "Package" during its configuration processing (particularly when there was no explicit MathJax configuration in the page), and the move to ESM modules exacerbated that problem. The issue has been resolved here.

  • The beta.3 version had an error where the equation, equation*, displaymath, and math LaTeX environments would produce an error about incorrectly nested environments, regardless of their content. That has been fixed.

  • The \text{} macro would produce an error message when the textmacros package is used in beta.3. This has been resolved.

  • Inline line breaks could occur in incorrect locations, sometimes producing blank lines the shouldn't be there. These extraneous breakpoints have been removed, so line breaking should work better for in-line mathematics.

  • The TeX input jax now attaches data-latex attributes to the MathML elements that it produces, indicating the TeX command from which the element originated. This information can be used by the assistive tools to produce Braille output of the original LaTeX, for example. Since data attributes are transferred to the CHTML and SVG output nodes, this information is available in MathJax's output in the page, not just the internal MathML notation.

  • Because the MathML specification indicates that any mtext element is "space-like", and since an operator in an mrow whose only other elements are space-like is considered to be an "embellished operator" that should be treated as an unbreakable unit, this can lead to unexpected results. When the operator is used for line breaking, the line break must occur before or after the embellished operator as a whole. That is, {\text{A} + \text{B}} produces <mrow><mtext>A</mtext><mo>+</mo><mtext>B</mtext></mrow>, making the <mo>+</mo> an embellished operator; if a linebreak is to occur at this +, it will be done before the A or after the B, not at the + itself. This is not what is usually intended for this LaTeX expression. Although the MathML specification is not clear about why mtext elements are space-like, it is likely because these are sometimes used to insert explicit spaces into the expression via space characters, but any mtext is considered space-like regardless of its content, leading to awkward situations like the one described above.

    In this release, MathJax has parted from the specification in making an mtext element be space-like only if its contents consists only of space characters or is empty and it doesn't have a mathbackground or style attribute. Similarly, an mspace element is considered space-like only if it does not have an explicit linebreak, height, depth, mathbackground or style attribute. With these changes, TeX expressions will not generate unexpected embellished operators that will affect their line breaking.


The categorized list of changes are in the subsections below:

TeX Input Fixes

  • Use proper spacing for initial relations in right-aligned columns of alignment tables. (mathjax/MathJax#3089) (#996)

  • Make sure \operatorname keeps TeX class OP after enrichment. (mathjax/MathJax#3084) (#989)

  • Remove incorrect frame from multline environment. (mathjax/MathJax#3083) (#988)

  • Fix bug with \text{} when textmacros package is used. (mathjax/MathJax#3082) (#983)

  • Fix error message with \vdotswithin{} from the mathtools package when it is used outside of a table. (mathjax/MathJax#3078) (#981)

  • Fix incorrect flagging of nested environments. (mathjax/MathJax#3070) (#975)

Output Fixes

  • Don't include extra line-break positions after an explicit break. (#1003)

  • Propery handle placement of scripts on \vcenter, \vbox, and \vtop. (mathjax/MathJax#3091) (#1000)

  • Fix spacing before \vcenter, \vtop, \vbox. (mathjax/MathJax#3085) (#990)

  • Fix placement of super- and subscripts when superscript has large depth. (mathjax/MathJax#3097) (#999)

  • Remove errant mjx-linestrut from SVG output. (mathjax/MathJax#3087) (#991)

Miscellaneous

  • Include default font configuration so that it will be loaded when input/chtml or input/svg is loaded in node-main. (#992)

  • Update check for spacelike MathML nodes to be more sensible. (mathjax/MathJax#3098) (#1002)

  • Prevent setting a property that has a getter during configuration processing. (mathjax/MathJax#3098) (#1001)

  • Set TeX class OP for multi-letter mo elements, as in v2. (mathjax/MathJax#3095) (#998)

  • Improve build tools for use with third-party extensions. (mathjax/MathJax#3086) (#997)

  • Prevent file system paths from being included in extensions and bundles. (#993)

  • Remove install script from package.json that is only needed for development. (#985)

  • Change Symbol to Token to avoid conflict with native Symbol in webpacked files. (mathjax/MathJax#3072) (#982)

New Features

  • Add support for *{n}{...} in array environment preamble. (mathjax/MathJax#3090) (#995)

  • Add data-latex attributes to MathML nodes from TeX input jax. (#986)

  • Add LaTeX Braille support to assistive tools. (#1004)

2023-07-20 02:04:01
MathJax-src

MathJax v4.0.0-beta.3

This release fixes a problem with determining the path used by MathJax in the webpacked node-main.js file, which is what is loaded when you require("mathjax-full") or import "mathjax-full". In addition, the commit that is tagged 4.0.0-beta.2 corresponding to the beta.2 release had the version number incorrectly set to 4.0.0-beta.1 in the MathJax object, though the npm package had it set correctly.

See the 4.0.0-beta.2 release notes for details about the changes in the v4.0-beta release, but (of course) use 4.0.0-beta.3 in place of 4.0.0-beta.2 in the URLs for accessing this version.