-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unicode multiplication sign not a binary operator #3203
Comments
MathJax doesn't go out of its way to try to handle unicode input, so this is one of those cases where things aren't working as one would like. For characters that aren't specifically defined as having a meaning in MathJax (like and the operator dictionary ( The In your case, the times symbol is U+00D7, and that ends up falling within [0x00C0, 0x024F, TEXCLASS.ORD, 'mi'], // Latin-1 Supplement, Latin Extended-A, Latin Extended-B which is mostly ranges of Latin letters, but does include a few symbols, like U+00D7 and U+00F7, which are not separated out. This means these two will get class ORD and be placed in an It would be possible to refine the So an alternative to adjusting the A MathJax configuration for v3 that does that is the following: MathJax = {
startup: {
ready() {
const OperatorDictionary = MathJax._.core.MmlTree.OperatorDictionary;
const {getRange, OPTABLE} = OperatorDictionary;
OperatorDictionary.getRange = function (text) {
const def = OPTABLE.infix[text] || OPTABLE.prefix[text] || OPTABLE.postfix[text];
return (def ? [0, 0, def[2], 'mo'] : getRange(text));
}
MathJax.startup.defaultReady();
}
}
} This will be added in v4 (I am making a PR for it), but the code above will not work with v4. For v4 (now out in beta), you could use MathJax = {
startup: {
ready() {
const {RANGES} = MathJax._.core.MmlTree.OperatorDictionary;
const {TEXCLASS} = MathJax._.core.MmlTree.MmlNode;
RANGES.splice(
2, 1,
[0x00C0, 0x00D6, TEXCLASS.ORD, 'mi'],
[0x00D7, 0x00D7, TEXCLASS.BIN, 'mo'],
[0x00D8, 0x024F, TEXCLASS.ORD, 'mi']
);
MathJax.startup.defaultReady();
}
}
} To special case U+00D7 into an |
Awesome, thanks for the explanation. And thanks for including the v4 workaround as well! (i just started using it a couple days ago) |
…determine TeX class and MathML node type. (mathjax/MathJax#3203)
Allow unknown characters to use operator table to determine class and node type. (mathjax/MathJax#3203)
The symbol${a × b} \neq {a \mathbin{×} b}$ . The fix used here is
×
is not properly rendered:a × b
↦a \mathbin{×} b
.Obviously this isn't a huge problem, but it's not ideal either—I've run across some other examples of symbols which should obviously be
mathbin
ormathrel
but whose Unicode character is not classed correctly by MathJax.In the meantime, can someone help with these questions:
The text was updated successfully, but these errors were encountered: