Source File
array_initial_operators.go
Belonging Package
github.com/d2lang/mathjax-go/internal/tex
// Copyright (c) 2009-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// Source: ts/input/tex/ParseUtil.ts fixInitialMO; base/BaseItems.ts// EqnArrayItem.EndEntry and ams/AmsItems.ts MultlineItem.EndEntry.package teximport// fixInitialMO preserves operator spacing at an alignment boundary. Source// skips mspace and empty TeXAtoms, then inspects the first remaining node.// Every embellished operator qualifies, as does a relation TeXAtom.func fixInitialMO( []*mml.Node) []*mml.Node {for , := range {if == nil || .Kind == "mspace" {continue}if .Kind == "TeXAtom" && (len(.Children) == 0 || len(.Children[0].Children) == 0) {continue}if .Flags.Embellished || (.Kind == "TeXAtom" && .TeXClass == mml.TeXClassRel) {return append([]*mml.Node{node("mi")}, ...)}break}return}// EqnArray applies the repair to every entry after the first in each row.// Multline applies it to each entry after the first row. Call before adding// label cells or layout padding that was not present at EndEntry.func fixInitialArrayOperators( *mml.Node, , int) {if len(.Children) <= {return}for , := range .Children[:] {if len(.Children) <= {continue}for , := range .Children[:] {if len(.Children) == 0 {continue}:= .Children[0].SetChildren(fixInitialMO(.Children))}}}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |