Ignore length specifications after linebreaks

In LaTeX line breaks in matrix elements
have an optional argument that controls
the vertical spacing between the current
and the next line. For example,

{\begin{aligned}a\\[6pt] b\end{aligned}}

generates a 6pt space.

This was never implemented and ignored by
mathoid.
The native MathML implementation is unaware
of the optional argument and just prints it
to the next line.

* This commit ignores the input on the grammar
side.

Bug: T375295
Change-Id: I08996129beca9ad852d23f28d7136c982707aea1
This commit is contained in:
physikerwelt 2024-09-20 23:43:10 +02:00
parent 5489d8d693
commit ff1536d1f9
No known key found for this signature in database
GPG key ID: FCC793EFFA5FB13C
3 changed files with 884 additions and 426 deletions

File diff suppressed because it is too large Load diff

View file

@ -384,8 +384,33 @@ FUN_AR1opt
NEXT_CELL
= "&" _
LATEX_LENGTH
= LATEX_SIGN? LATEX_NUMBER LATEX_UNIT
LATEX_SIGN
= [+-]
LATEX_NUMBER
= literal_mn+ "."? literal_mn*
/ "." literal_mn+
LATEX_UNIT
= "pt"
/ "cm"
/ "mm"
/ "in"
/ "em"
/ "ex"
/ "bp"
/ "pc"
/ "dd"
/ "cc"
/ "sp"
/ "nd"
/ "nc"
NEXT_ROW
= "\\\\" _
= "\\\\" ("[" LATEX_LENGTH "]")? _
BEGIN
= "\\begin" _

View file

@ -124,6 +124,20 @@ class ApiTest extends MediaWikiUnitTestCase {
'mhchem_required' => true,
'status' => 'C'
],
[
'in' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
'ams_required' => true,
],
[
'in' => '{\\begin{aligned}a\\\\[6pt] b\\end{aligned}}',
'output' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
'ams_required' => true,
],
[
'in' => '{\\begin{aligned}a\\\\[-3.4mm] b\\end{aligned}}',
'output' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
'ams_required' => true,
],
];
foreach ( $testCases as $case ) {
yield $case['in'] => [ $case ];