-
-
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
Some symbols are not rendered #3272
Comments
First, you have filed this issue in the wrong place. As the issue template indicates, this issue tracker is only for structural problems with the source code repository, not for general MathJax issues, which should be filed here. Don't just erase the information given in the issue template and ignore it. I am transferring this issue to the proper issue tracker. |
Not every LaTeX command is implemented in MathJax, and none of these is. You can find a list of the commands that are available in the documentation. You don't indicate which version of MathJax you are using, so I've pointed to the v3 documentation. For For For These three could be added to your MathJax configuration as described in the documentation. The MathJax = {
tex: {
packages: {'[+]': ['longdiv']}
},
startup: {
ready() {
const {Configuration} = MathJax._.input.tex.Configuration;
const {CommandMap} = MathJax._.input.tex.TokenMap;
const TexError = MathJax._.input.tex.TexError.default;
const TexParser = MathJax._.input.tex.TexParser.default;
new CommandMap('longdiv', {
longdiv: 'LongDiv'
}, {
LongDiv(parser, name) {
const num = parser.GetArgument(name);
const den = parser.GetArgument(name);
if (!num.match(/^\d+$/) || !den.match(/^\d+/)) {
throw new TexError('LONGDIV:NumDen', 'Numerator and denominator of %1 must be positive integers', name);
}
const n = parseInt(num);
const d = parseInt(den);
const q = Math.floor(n / d);
let m = n;
const tex = [
'\\begin{array}[t]{r}',
`${q} \\kern.2em \\\\[-3px]`,
`${d}\\kern.1em \\enclose{longdiv}{\\kern.075em ${n}} \\\\[-4px]`
];
const digits = String(q).split('');
while (digits.length) {
const digit = parseInt(digits.shift() + digits.join('').replace(/./g, '0'));
if (digit === 0) continue;
const p = d * digit;
m -= p;
tex.push(
`\\underline{\\kern .2em ${p}\\Space{.2em}{0em}{.125em}} \\\\[-3px]`,
`${m}\\Space{.2em}{0em}{.125em} \\\\[-4px]`
);
}
tex.push('\\end{array}');
parser.Push(new TexParser(tex.join('\n'), parser.stack.env, parser.configuration).mml());
}
});
Configuration.create('longdiv', {
handler: {
macro: ['longdiv']
}
});
MathJax.startup.defaultReady();
}
}
}; If you are using v3, this should also work there, with one change: |
Issue: Below mentioned 4 math commands are not recognized by mathjax and they are not rendered.
The text was updated successfully, but these errors were encountered: