Skip to content

Commit 4318ee0

Browse files
authored
Merge pull request #1341 from mathjax/fix/function-apply
Don't add invisible funciton apply after an empty mathop
2 parents 2a531d2 + 9882a85 commit 4318ee0

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

testsuite/tests/input/tex/Base.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12198,6 +12198,33 @@ describe('Character Class Changes', () => {
1219812198

1219912199
/********************************************************************************/
1220012200

12201+
it('Mathop Apply', () => {
12202+
toXmlMatch(
12203+
tex2mml('\\mathop{F} x'),
12204+
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\mathop{F} x" display="block">
12205+
<mrow data-mjx-texclass="OP" data-latex="\\mathop{F}">
12206+
<mi data-latex="F">F</mi>
12207+
</mrow>
12208+
<mo data-mjx-texclass="NONE">&#x2061;</mo>
12209+
<mi data-latex="x">x</mi>
12210+
</math>`
12211+
);
12212+
});
12213+
12214+
/********************************************************************************/
12215+
12216+
it('Mathop No Apply', () => {
12217+
toXmlMatch(
12218+
tex2mml('\\mathop{} x'),
12219+
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\mathop{} x" display="block">
12220+
<mrow data-mjx-texclass="OP" data-latex="\\mathop{}"></mrow>
12221+
<mi data-latex="x">x</mi>
12222+
</math>`
12223+
);
12224+
});
12225+
12226+
/********************************************************************************/
12227+
1220112228
it('Mathrel', () => {
1220212229
toXmlMatch(
1220312230
tex2mml('\\mathrel{R}'),

ts/input/tex/base/BaseItems.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,13 @@ export class FnItem extends BaseItem {
787787
return [[top, item], true];
788788
}
789789
}
790+
// @test Mathop Apply, Mathop No Apply
791+
if (
792+
top.isKind('TeXAtom') &&
793+
top.childNodes[0]?.childNodes?.length === 0
794+
) {
795+
return [[top, item], true];
796+
}
790797
// @test Named Function, Named Function Arg
791798
const node = this.create(
792799
'token',

0 commit comments

Comments
 (0)