MathJax v4.0.0-beta.4
Pre-releaseThis 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 javascriptSymbol
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 theSymbol
class. This has lead us to rename the customSymbol
class toToken
, and rename theSymbol.ts
andSymbolMap.ts
files toToken.ts
andTokenMap.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
, andmath
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 thetextmacros
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. Sincedata
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 anmrow
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 theA
or after theB
, not at the+
itself. This is not what is usually intended for this LaTeX expression. Although the MathML specification is not clear about whymtext
elements are space-like, it is likely because these are sometimes used to insert explicit spaces into the expression via space characters, but anymtext
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 amathbackground
orstyle
attribute. Similarly, anmspace
element is considered space-like only if it does not have an explicitlinebreak
,height
,depth
,mathbackground
orstyle
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{}
whentextmacros
package is used. (mathjax/MathJax#3082) (#983) -
Fix error message with
\vdotswithin{}
from themathtools
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
orinput/svg
is loaded innode-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 frompackage.json
that is only needed for development. (#985) -
Change
Symbol
toToken
to avoid conflict with nativeSymbol
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)