diff --git a/src/TexVC/MMLmappings/BaseParsing.php b/src/TexVC/MMLmappings/BaseParsing.php index aa7752d62..8386bbd43 100644 --- a/src/TexVC/MMLmappings/BaseParsing.php +++ b/src/TexVC/MMLmappings/BaseParsing.php @@ -164,7 +164,9 @@ class BaseParsing { // this goes for name =="aligned" ... tcs: 358 420 421 $mrow = new MMLmrow(); // tbd how are the table args composed ? - $tableArgs = [ "columnalign" => "right", + + $direction = ( $name == "aligned" ) ? "left" : "right"; + $tableArgs = [ "columnalign" => $direction, "columnspacing" => "", "displaystyle" => "true", "rowspacing" => "3pt" ]; $mtable = new MMLmtable( "", $tableArgs ); $mtr = new MMLmtr(); diff --git a/tests/phpunit/unit/TexVC/MMLRenderTest.php b/tests/phpunit/unit/TexVC/MMLRenderTest.php index e5357521b..ad5fcfe11 100644 --- a/tests/phpunit/unit/TexVC/MMLRenderTest.php +++ b/tests/phpunit/unit/TexVC/MMLRenderTest.php @@ -15,6 +15,13 @@ use MediaWikiUnitTestCase; */ class MMLRenderTest extends MediaWikiUnitTestCase { + public function testAlignLeft() { + $input = " \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \\end{align} "; + $mathMLtexVC = $this->generateMML( $input ); + $this->assertStringContainsString( "columnalign=\"left\"", $mathMLtexVC ); + $this->assertStringContainsString( "mtable", $mathMLtexVC ); + } + public function testLeftRightAttributes() { $input = "\\left( \\right) \\left[ \\right]"; $mathMLtexVC = $this->generateMML( $input );