// Copyright (c) 2009-2022 The MathJax Consortium // SPDX-License-Identifier: Apache-2.0 // Source: ts/input/tex/base/{BaseMethods,BaseItems}.ts.
package tex import // HFill records ArrayItem.Size without emitting an MML node. SetFont changes // the same environment, so its continuation retains the preceding node count. type arrayCellState struct { fills []int offset int equation *equationRowState multline bool numCases bool shove string rules *arrayRules } func isHFill( string) bool { return == "hfill" || == "hfil" || == "hfilll" } func unsupportedHFill( string) error { return texError("UnsupportedHFill", "Unsupported use of %s", "\\"+) } const arrayCellAlignment = "arrayCellAlignment" func ( *arrayCellState) ( *mml.Node, int) *mml.Node { if == nil || len(.fills) == 0 { return } := "" if .fills[0] == 0 { = "right" } if .fills[len(.fills)-1] == { if != "" { = "center" } else { = "left" } } if != "" { .SetProperty(arrayCellAlignment, ) } return } func arrayCellNode( *mml.Node) *mml.Node { := node("mtd", ) if , := .Property(arrayCellAlignment); { .Attributes.Set("columnalign", ) } return } func ( *parser) ( string, ...*arrayRules) (*mml.Node, error) { := &arrayCellState{} if len() != 0 { .rules = [0] } return .parseStringWithEnvironment(, .ensureStackGlobal(), nil, , .environmentOwner) }