Allow unknown characters to use operator table to determine class and node type. (mathjax/MathJax#3203) #1070
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MathJax's handling of characters that aren't mapped to special functions (like
^
and_
), or that match the variable or number patterns, is controlled by theRANGES
andOPTABLE
in theOperatorDictionary.ts
file. When an unmapped character is encountered, theRANGES
array is searched for a block in which the unknown character is found, and that gives the TeX class and MathML node type to use for the character.These blocks are just a rough breakdown of the unicode ranges into groups that should be treated similarly, but it is not perfect, and some characters are mischaracterized by it. Two such are U+00D7 (×) and U+00F7 (÷), which are found in a block of Latin letters, which MathJax marks as TeX class ORD using an
mi
node. These two should be treated as operators, but they have not been singled out from among the Latin letters, so get the wrong MathML node type.One solution would be to make the
RANGES
table more granular, but another is to note that U+00D7 and U+00F7 are present in the operator dictionary, so Mathjax could use that to find the TeX class and wrap it in anmo
. The latter is implemented here. That means that any character that is in the operator dictionary will be put into anmo
automatically, rather than use theRANGES
table. That makes it easier to customize the operators recognized by MathJax without having to adjust theRANGES
table.Resolves issue mathjax/MathJax#3203.