// Copyright (c) 2009-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// Source: ts/input/tex/base/BaseMethods.ts, MoveRoot.package teximport ()var rootIntegerPattern = regexp.MustCompile(`-?[0-9]+`)var rootIntegerPrefix = regexp.MustCompile(`^[+-]?[0-9]+`)// These handlers push ArrayItem subclasses, whose lexical environment does// not inherit the enclosing index's inRoot flag. Equation and wrapper// environments continue to inherit it normally.func rootIndexArrayEnvironment( string) bool { , , := lookupMJSourceEntry(mjSourceEnvironmentMap, )if ! {returnfalse } := .Valueif , := .(mjSourceList); && len() != 0 { = [0] }switch {case"Array", "AlignedArray", "EqnArray", "AmsEqnArray", "AlignAt", "XalignAt", "FlalignArray","Multline", "MtMultlined", "MtMatrix", "MtSmallMatrix", "Cases", "NumCases", "CD":returntrue }returnfalse}func ( *parser) ( string) error {if !.inRoot {returntexError("MisplacedMoveRoot", "\\%s can appear only within a root", ) } := .ensureStackGlobal() := &.upRootif == "leftroot" { = &.leftRoot }if * != "" {returntexError("MultipleMoveRoot", "Multiple use of \\%s", ) } , , := .readArgument(, false)if != nil {return }// The original validity check is intentionally unanchored, while // parseInt reads only a signed decimal prefix after JavaScript whitespace.if !rootIntegerPattern.MatchString() {returntexError("IntegerArg", "The argument to \\%s must be an integer", ) } := math.NaN()if := rootIntegerPrefix.FindString(strings.TrimLeftFunc(, internalTextSpace)); != "" { , _ = strconv.ParseFloat(, 64) } := jscompat.NumberString(/15) + "em"if !strings.HasPrefix(, "-") { = "+" + } * = returnnil}
The pages are generated with Goldsv0.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.