Skip to content

Commit

Permalink
Merge pull request #729 from mathjax/issue2709
Browse files Browse the repository at this point in the history
Fix setting of movablelimits to false for \overset and similar macros.  (mathjax/MathJax#2709)
  • Loading branch information
dpvc authored Jun 15, 2021
2 parents 049035e + f32b96f commit f0f3f76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
18 changes: 13 additions & 5 deletions ts/input/tex/ParseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,7 @@ namespace ParseUtil {
*/
export function underOver(parser: TexParser, base: MmlNode, script: MmlNode, pos: string, stack: boolean): MmlNode {
// @test Overline
const symbol = NodeUtil.getForm(base);
if ((symbol && symbol[3] && symbol[3]['movablelimits']) || NodeUtil.getProperty(base, 'movablelimits')) {
// @test Overline Sum
NodeUtil.setProperties(base, {'movablelimits': false});
}
ParseUtil.checkMovableLimits(base);
if (NodeUtil.isType(base, 'munderover') && NodeUtil.isEmbellished(base)) {
// @test Overline Limits
NodeUtil.setProperties(NodeUtil.getCoreMO(base), {lspace: 0, rspace: 0});
Expand All @@ -397,6 +393,18 @@ namespace ParseUtil {
return node;
}

/**
* Set movablelimits to false if necessary.
* @param {MmlNode} base The base node being tested.
*/
export function checkMovableLimits(base: MmlNode) {
const symbol = (NodeUtil.isType(base, 'mo') ? NodeUtil.getForm(base) : null);
if (NodeUtil.getProperty(base, 'movablelimits') || (symbol && symbol[3] && symbol[3].movablelimits)) {
// @test Overline Sum
NodeUtil.setProperties(base, {movablelimits: false});
}
}

/**
* Trim spaces from a string.
* @param {string} text The string to clean.
Expand Down
13 changes: 3 additions & 10 deletions ts/input/tex/base/BaseMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,7 @@ BaseMethods.Overset = function(parser: TexParser, name: string) {
// @test Overset
const top = parser.ParseArg(name);
const base = parser.ParseArg(name);
if (NodeUtil.getAttribute(base, 'movablelimits') || NodeUtil.getProperty(base, 'movablelimits')) {
NodeUtil.setProperties(base, {'movablelimits': false});
}
ParseUtil.checkMovableLimits(base);
const node = parser.create('node', 'mover', [base, top]);
parser.Push(node);
};
Expand All @@ -642,10 +640,7 @@ BaseMethods.Underset = function(parser: TexParser, name: string) {
// @test Underset
const bot = parser.ParseArg(name);
const base = parser.ParseArg(name);
if (NodeUtil.isType(base, 'mo') || NodeUtil.getProperty(base, 'movablelimits')) {
// @test Overline Sum
NodeUtil.setProperties(base, {'movablelimits': false});
}
ParseUtil.checkMovableLimits(base);
const node = parser.create('node', 'munder', [base, bot]);
parser.Push(node);
};
Expand All @@ -660,9 +655,7 @@ BaseMethods.Overunderset = function(parser: TexParser, name: string) {
const top = parser.ParseArg(name);
const bot = parser.ParseArg(name);
const base = parser.ParseArg(name);
if (NodeUtil.isType(base, 'mo') || NodeUtil.getProperty(base, 'movablelimits')) {
NodeUtil.setProperties(base, {'movablelimits': false});
}
ParseUtil.checkMovableLimits(base);
const node = parser.create('node', 'munderover', [base, bot, top]);
parser.Push(node);
};
Expand Down

0 comments on commit f0f3f76

Please sign in to comment.