Fix liminf and limsup spacing

* and injlim projlim spacing

Bug: T350491
Change-Id: I7e4491fbdd461a4583f5418ba1924c647bb2df94
This commit is contained in:
Stegmujo 2023-11-03 11:15:54 +00:00
parent ac1d7a9a7b
commit 7b03a170db
No known key found for this signature in database
GPG key ID: BB616B7CC84186BE
4 changed files with 15 additions and 5 deletions

View file

@ -30,8 +30,8 @@ class AMSMappings {
"notag" => 'HandleNoTag', "notag" => 'HandleNoTag',
"eqref" => [ 'HandleRef', true ], "eqref" => [ 'HandleRef', true ],
"substack" => [ 'macro', '\\begin{subarray}{c}#1\\end{subarray}', 1 ], "substack" => [ 'macro', '\\begin{subarray}{c}#1\\end{subarray}', 1 ],
"injlim" => [ 'namedOp', 'inj lim' ], "injlim" => [ 'namedOp', 'inj lim' ],
"projlim" => [ 'namedOp', 'proj lim' ], "projlim" => [ 'namedOp', 'proj lim' ],
"varliminf" => [ 'macro', '\\mathop{\\underline{\\mmlToken{mi}{lim}}}' ], "varliminf" => [ 'macro', '\\mathop{\\underline{\\mmlToken{mi}{lim}}}' ],
"varlimsup" => [ 'macro', '\\mathop{\\overline{\\mmlToken{mi}{lim}}}' ], "varlimsup" => [ 'macro', '\\mathop{\\overline{\\mmlToken{mi}{lim}}}' ],
// replaced underrightarrow here not supported // replaced underrightarrow here not supported

View file

@ -420,8 +420,8 @@ class BaseMappings {
"ker" => 'namedFn', "ker" => 'namedFn',
"lg" => 'namedFn', "lg" => 'namedFn',
"lim" => 'namedOp', "lim" => 'namedOp',
"liminf" => [ 'namedOp', 'lim inf' ], "liminf" => [ 'namedOp', 'lim inf' ],
"limsup" => [ 'namedOp', 'lim sup' ], "limsup" => [ 'namedOp', 'lim sup' ],
"ln" => 'namedFn', "ln" => 'namedFn',
"log" => 'namedFn', "log" => 'namedFn',
"max" => 'namedOp', "max" => 'namedOp',

View file

@ -638,9 +638,10 @@ class BaseParsing {
$applyFct = MMLParsingUtil::renderApplyFunction(); $applyFct = MMLParsingUtil::renderApplyFunction();
} }
} }
if ( $node instanceof Literal ) { if ( $node instanceof Literal ) {
$mi = new MMLmi( "", $passedArgs ); $mi = new MMLmi( "", $passedArgs );
return $mi->encapsulateRaw( $name ) . $applyFct; return $mi->encapsulateRaw( $id ?? $name ) . $applyFct;
} }
$mrow = new MMLmrow( TexClass::ORD, [] ); $mrow = new MMLmrow( TexClass::ORD, [] );
$msub = new MMLmsub( "", $passedArgs ); $msub = new MMLmsub( "", $passedArgs );

View file

@ -15,6 +15,15 @@ use MediaWikiUnitTestCase;
* @covers \MediaWiki\Extension\Math\TexVC\TexVC * @covers \MediaWiki\Extension\Math\TexVC\TexVC
*/ */
class MMLRenderTest extends MediaWikiUnitTestCase { class MMLRenderTest extends MediaWikiUnitTestCase {
public function testLimOperatorSpacing() {
$input = "\liminf v, \limsup w \injlim x \projlim y";
$mathMLtexVC = $this->generateMML( $input );
$this->assertStringContainsString( "lim inf", $mathMLtexVC );
$this->assertStringContainsString( "lim sup", $mathMLtexVC );
$this->assertStringContainsString( "inj lim", $mathMLtexVC );
$this->assertStringContainsString( "proj lim", $mathMLtexVC );
}
public function testTrimNull() { public function testTrimNull() {
$input = "\\bigl( \\begin{smallmatrix}a&b\\\\ c&d\\end{smallmatrix} \\bigr)"; $input = "\\bigl( \\begin{smallmatrix}a&b\\\\ c&d\\end{smallmatrix} \\bigr)";
$mathMLtexVC = $this->generateMML( $input ); $mathMLtexVC = $this->generateMML( $input );