Skip to content

MathJax v4.0.0-beta.4

Pre-release
Pre-release
Compare
Choose a tag to compare
@dpvc dpvc released this 04 Oct 16:35
· 354 commits to develop since this release

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

Output Fixes

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)