Skip to content

Commit 06586c2

Browse files
authored
Merge pull request #1101 from mathjax/issue3233
Fix regression from #1069 (mathjax/MathJax#3233, mathjax/MathJax#3234)
2 parents 18e582c + 0845074 commit 06586c2

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

ts/core/MmlTree/MmlNodes/mo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class MmlMo extends AbstractMmlTokenNode {
154154
'\u2015', // overline and underline
155155
'\u2190\u2192\u2194', // arrows
156156
'\u23DC\u23DD', // over and under parens
157+
'\u23DE\u23DF', // over and under braces
157158
']$'
158159
].join(''));
159160

ts/input/tex/base/BaseItems.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,11 @@ export class PrimeItem extends BaseItem {
208208
*/
209209
public checkItem(item: StackItem): CheckType {
210210
let [top0, top1] = this.Peek(2);
211-
const isSup = NodeUtil.isType(top0, 'msubsup') && !NodeUtil.getChildAt(top0, (top0 as MmlMsubsup).sup);
212-
const isOver = NodeUtil.isType(top0, 'munderover') && !NodeUtil.getChildAt(top0, (top0 as MmlMunderover).over);
211+
const isSup = NodeUtil.isType(top0, 'msubsup') &&
212+
!NodeUtil.getChildAt(top0, (top0 as MmlMsubsup).sup);
213+
const isOver = NodeUtil.isType(top0, 'munderover') &&
214+
!NodeUtil.getChildAt(top0, (top0 as MmlMunderover).over) &&
215+
!NodeUtil.getProperty(top0, 'subsupOK');
213216
if (!isSup && !isOver) {
214217
// @test Prime, Double Prime
215218
const node = this.create('node', top0.getProperty('movesupsub') ? 'mover' : 'msup', [top0, top1]);

ts/input/tex/base/BaseMappings.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,13 @@ new sm.CommandMap('macros', {
510510
tan: 'NamedFn',
511511
tanh: 'NamedFn',
512512

513-
limits: ['Limits', 1],
514-
nolimits: ['Limits', 0],
513+
limits: ['Limits', true],
514+
nolimits: ['Limits', false],
515515

516516
overline: ['UnderOver', '2015'],
517517
underline: ['UnderOver', '2015'],
518-
overbrace: ['UnderOver', '23DE', 1],
519-
underbrace: ['UnderOver', '23DF', 1],
518+
overbrace: ['UnderOver', '23DE', true],
519+
underbrace: ['UnderOver', '23DF', true],
520520
overparen: ['UnderOver', '23DC'],
521521
underparen: ['UnderOver', '23DD'],
522522
overrightarrow: ['UnderOver', '2192'],
@@ -650,10 +650,10 @@ new sm.CommandMap('macros', {
650650
breve: ['Accent', '02D8'], // or 0306
651651
check: ['Accent', '02C7'], // or 030C
652652
hat: ['Accent', '005E'], // or 0302 or 02C6
653-
vec: ['Accent', '2192'], // or 20D7
653+
vec: ['Accent', '2192', false], // or 20D7
654654
dot: ['Accent', '02D9'], // or 0307
655-
widetilde: ['Accent', '007E', 1], // or 0303 or 02DC
656-
widehat: ['Accent', '005E', 1], // or 0302 or 02C6
655+
widetilde: ['Accent', '007E', true], // or 0303 or 02DC
656+
widehat: ['Accent', '005E', true], // or 0302 or 02C6
657657

658658
matrix: 'Matrix',
659659
array: 'Matrix',

ts/input/tex/base/BaseMethods.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ const BaseMethods: {[key: string]: ParseMethod} = {
282282
base = parser.create('token', 'mi');
283283
}
284284
if ((NodeUtil.isType(base, 'msubsup') && !NodeUtil.isType(base, 'msup') &&
285-
NodeUtil.getChildAt(base, (base as MmlMsubsup).sup)) ||
286-
(NodeUtil.isType(base, 'munderover') && !NodeUtil.isType(base, 'mover') &&
287-
NodeUtil.getChildAt(base, (base as MmlMunderover).over))) {
285+
NodeUtil.getChildAt(base, (base as MmlMsubsup).sup)) ||
286+
(NodeUtil.isType(base, 'munderover') && !NodeUtil.isType(base, 'mover') &&
287+
NodeUtil.getChildAt(base, (base as MmlMunderover).over) &&
288+
!NodeUtil.getProperty(base, 'subsupOK'))) {
288289
// @test Double Prime Error
289290
throw new TexError('DoubleExponentPrime',
290291
'Prime causes double exponent: use braces to clarify');
@@ -496,10 +497,10 @@ const BaseMethods: {[key: string]: ParseMethod} = {
496497
/**
497498
* Handle a limits command for math operators.
498499
* @param {TexParser} parser The calling parser.
499-
* @param {string} name The macro name.
500-
* @param {string} limits The limits arguments.
500+
* @param {string} _name The macro name.
501+
* @param {boolean} limits True for \limits, false for \nolimits.
501502
*/
502-
Limits(parser: TexParser, _name: string, limits: string) {
503+
Limits(parser: TexParser, _name: string, limits: boolean) {
503504
// @test Limits
504505
let op = parser.stack.Prev(true);
505506
// Get the texclass for the core operator.
@@ -645,13 +646,17 @@ const BaseMethods: {[key: string]: ParseMethod} = {
645646
* @param {TexParser} parser The calling parser.
646647
* @param {string} name The macro name.
647648
* @param {string} accent The accent.
648-
* @param {boolean} stretchy True if accent is stretchy.
649+
* @param {boolean} stretchy True if accent is stretchy, false if mathaccent should be false.
649650
*/
650651
Accent(parser: TexParser, name: string, accent: string, stretchy: boolean) {
651652
// @test Vector
652653
const c = parser.ParseArg(name);
653654
// @test Vector Font
654-
const def = {...ParseUtil.getFontDef(parser), accent: true, mathaccent: true};
655+
const def = {
656+
...ParseUtil.getFontDef(parser),
657+
accent: true,
658+
mathaccent: stretchy === undefined ? true : stretchy
659+
};
655660
const entity = NodeUtil.createEntity(accent);
656661
const moNode = parser.create('token', 'mo', def, entity);
657662
const mml = moNode;

0 commit comments

Comments
 (0)