-
-
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
\color in \Set #3164
Comments
…re accurately found. (mathjax/MathJax#3164)
Thanks for the report. This turns out to be due to an internal issue where MathJax's TeX parser doesn't properly handle the MathJax = {
loader: {load: ['[tex]/braket']},
tex: {packages: {'[+]': ['braket', 'my-braket']}},
startup: {
ready() {
const Stack = MathJax._.input.tex.Stack.default;
const {Configuration} = MathJax._.input.tex.Configuration;
const {CommandMap, MacroMap} = MathJax._.input.tex.TokenMap;
const BraketMethods = MathJax._.input.tex.braket.BraketMethods.default;
const {TEXCLASS} = MathJax._.core.MmlTree.MmlNode;
Stack.prototype.height = function () {return this.stack.length};
const MyBraketMethods = {
Braket(parser, name, open, close, stretchy, barmax, space = false) {
BraketMethods.Braket(parser, name, open, close, stretchy, barmax, space);
parser.stack.Top().env.braketItem = parser.stack.height() - 1;
},
Bar(parser, name) {
let c = name === '|' ? '|' : '\u2016';
const n = parser.stack.height() - parser.stack.env.braketItem;
const top = parser.stack.Top(n);
if (!top || !top.isKind('braket') || top.getProperty('barcount') >= top.getProperty('barmax')) {
return false;
}
if (c === '|' && parser.GetNext() === '|') {
parser.i++;
c = '\u2016';
}
if (!top.getProperty('stretchy')) {
let node = parser.create('token', 'mo', {stretchy: false, 'data-braketbar': true, texClass: TEXCLASS.ORD}, c);
parser.Push(node);
return;
}
let close = parser.itemFactory.create('close').setProperty('braketbar', true);
parser.Push(close);
top.barNodes.push(
parser.create('node', 'TeXAtom', [], {texClass: TEXCLASS.CLOSE}),
parser.create('token', 'mo', {stretchy: true, 'data-braketbar': true, texClass: TEXCLASS.BIN}, c),
parser.create('node', 'TeXAtom', [], {texClass: TEXCLASS.OPEN})
);
top.setProperty('barcount', top.getProperty('barcount') + 1);
}
};
new CommandMap('my-braket-macros', {
braket: ['Braket', '\u27E8', '\u27E9', false, Infinity],
'set': ['Braket', '{', '}', false, 1],
Braket: ['Braket', '\u27E8', '\u27E9', true, Infinity],
Set: ['Braket', '{', '}', true, 1, true],
'|': 'Bar'
}, MyBraketMethods);
new MacroMap('my-braket-characters', {
'|': 'Bar'
}, MyBraketMethods);
Configuration.create(
'my-braket', {
handler: {
character: ['my-braket-characters'],
macro: ['my-braket-macros']
},
priority: 1 // must come before base configuration
}
);
MathJax.startup.defaultReady();
}
}
}; for your configuration to work around the issue. Unfortunately, I could not work out a smaller patch, but this should do the trick, if you need it before the next release. |
Update handling of braket bars so that the enclosing braket can be more accurately found. (mathjax/MathJax#3164)
Issue Summary
is rendered differently in
LaTeX only applies color to the first part.
Technical details:
The text was updated successfully, but these errors were encountered: