[MTMathListBuilder] enhanced \begin{cases} environment support

No Need to use the & character at line end. The previous notation is still supported.
This commit is contained in:
Nicolas Guillot
2025-09-30 10:03:17 +02:00
parent 5530f3910f
commit 225948c725
2 changed files with 123 additions and 6 deletions

View File

@@ -898,19 +898,21 @@ public class MTMathAtomFactory {
return table
} else if env == "cases" {
if table.numColumns != 2 {
let message = "cases environment can only have 2 columns"
if table.numColumns != 1 && table.numColumns != 2 {
let message = "cases environment can have 1 or 2 columns"
if error == nil {
error = NSError(domain: MTParseError, code: MTParseErrors.invalidNumColumns.rawValue, userInfo: [NSLocalizedDescriptionKey:message])
}
return nil
}
table.interRowAdditionalSpacing = 0
table.interColumnSpacing = 18
table.set(alignment: .left, forColumn: 0)
table.set(alignment: .left, forColumn: 1)
if table.numColumns == 2 {
table.set(alignment: .left, forColumn: 1)
}
let style = MTMathStyle(style: .text)
for i in 0..<table.cells.count {