Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Mar 6, 2024

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 the RANGES and OPTABLE in the OperatorDictionary.ts file. When an unmapped character is encountered, the RANGES 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 an mo. The latter is implemented here. That means that any character that is in the operator dictionary will be put into an mo automatically, rather than use the RANGES table. That makes it easier to customize the operators recognized by MathJax without having to adjust the RANGES table.

Resolves issue mathjax/MathJax#3203.

@dpvc dpvc requested a review from zorkow March 6, 2024 21:48
@dpvc dpvc added this to the v4.0 milestone Mar 6, 2024
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@dpvc dpvc merged commit ea39afb into develop Mar 16, 2024
@dpvc dpvc deleted the issue3203 branch March 16, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants