FormatterCategory

fmt.spad line 416 [edit on github]

undocumented

altsupersub: Integer -> (Integer, List OutputForm) -> OutputBox

altsupersub(p) returns a handler such that altsupersub(p)(prec, args) formats the first argument with respect to the precedence p. The remaining arguments are formatted without parentheses and interpreted as subscript, superscript, subscript, superscript, etc. where the subscripts and superscripts are pairwise aligned. Outer parentheses are added if p < prec.

binary: ((Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

binary(h1, h2) returns a handler h such that h(prec, args) formats the first argument according to h1 and the second argument by h2. Both boxes will be horizontally concatenated. binary(h1, h2) is equal to infix("", maxPrecedence(), h1, h2)

binomial: (Integer, List OutputForm) -> OutputBox

binomial is a handler such that binomial(prec,args) formats a binomial expression of the first two arguments.

box: ((Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

box(hh) returns a handler h such that h(prec, args) formats the arguments via hh(prec, args) and then draws a box frame around the resulting box.

bracket: (String, String, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

bracket(lb, rb, hh) returns a handler h such that h(prec, args) formats its first argument according to hh and then put left and right brackets given by lb and rb around the resulting box.

coerce: % -> OutputForm

from CoercibleTo OutputForm

defaultEpilogue: String -> OutputBox

defaultEpilogue(label) returns a box that is used at the end of every format.

defaultPrologue: String -> OutputBox

defaultPrologue(label) returns a box that is used at the beginning of every format.

formatConstant: String -> (Integer, List OutputForm) -> OutputBox

formatConstant(op) is a handler to format constant operators.

formatExpression: (OutputForm, Integer) -> OutputBox

formatExpression(o, p) returns an OutputBox that represent the expression o in the respective format when considered in a context with outer precedence p. This function is the main dispatcher function. It first checks whether o is an integer or a string and treats these cases. Then, if the number n of arguments is less than 3, it tries to find a handler for the top-level operator of o. If none is found, it checks for a handler of an n-ary operator. If no handler is found, the operator is treated as a function symbol and formatted as such.

formatExpression: Integer -> (Integer, List OutputForm) -> OutputBox

formatExpression(p) returns a handler h that h(prec, args) returns formatExpression(first args, p). This handler is used to change the precedence context in which the argument is formatted.

formatExpression: OutputForm -> OutputBox

formatExpression(o) returns formatExpression(o, minPrecedence()).

formatFloat: String -> OutputBox

formatFloat(s) formats a floating point number from it string representation in OutputForm.

formatFunction: (OutputBox, List OutputBox) -> OutputBox

formatFunction(b, args) is supposed to create a box for "b(args)”, i.e. format the list of arguments given by args an put it into a format that represents a function application.

formatFunctionSymbol: String -> OutputBox

formatFunctionSymbol(s) formats an otherwise unknown function symbol.

formatInteger: Integer -> OutputBox

formatInteger(n) formats an integer.

formatString: String -> OutputBox

formatString(s) formats a string.

formatSymbol: String -> OutputBox

formatSymbol(s) formats a symbol.

fraction: (Integer, (Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

Format a fraction. fraction(p, h1, h2) returns a handler h such that h(prec, args) formats the first argument by h1 and the second argument by h2. Outer parentheses are added if p < prec.

function: (String, Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

function(s, p, hh) is meant to typeset function applications. It defaults to prefix(s,p,bracket(“(“,”)”,hh)).

infix: (String, Integer, (Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

infix(op, p, h1, h2) returns a handler h such that h(prec, args) formats the first argument by h1 and the second argument by h2. Both boxes will be horizontally concatenated with box op in the middle. Outer parentheses are added if p < prec.

integral: Integer -> (Integer, List OutputForm) -> OutputBox

integral(p) returns a handler h such that h(prec, args) formats the expression as an integral with integral sign and respective limits. Outer parentheses are added if p < prec.

matrix: (String, String) -> (Integer, List OutputForm) -> OutputBox

matrix(left, right) returns a handler that typesets a matrix with parentheses given by left and right where rows are formatted using h.

maxPrecedence: () -> Integer

maxPrecedence() returns the maximal precedence value,

minPrecedence: () -> Integer

minPrecedence() returns the minimal precedence value.

nary: (String, Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

nary(s, p, hh) returns a handler h such that h(prec, args) formats each argument according to hh. All resulting boxes will be horizontally concatenated with box s inbetween. Outer parentheses are added if p < prec.

naryPlus: (String, String, Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

nary(plus, minus, p, hh) returns a handler h such that h(prec, args) formats each argument according to hh. All resulting boxes will be horizontally concatenated with box minus or box plus inbetween depending on whether the respective argument starts with a unary minus or not. Outer parentheses are added if p < prec. This is a special handler that treats the case that a sum is represented as a nary expression that contains unary subexpressions that are unary minus expressions. This handler transforms something like (+ a (- b)) into a - b.

nothing: () -> (Integer, List OutputForm) -> OutputBox

nothing() returns a handler h such that h(prec, args) returns an empty box. This corresponds to NOTHING in OutputForm.

nthRoot: (Integer, (Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

Format square roots and nth roots. nthRoot(p, h1, h2) returns a handler h such that h(prec, args) formats the first argument according to h1. If there is no second argument, then the nth root is a square root and formatted accordingly. Otherwise the second argument is formatted by h2. Outer parentheses are added if p < prec.

numberOfPrimes: OutputForm -> Integer

numberOfPrimes(e) counts the number of commas in e and returns it. If s does not only contain commas, but has a parenthesis at the beginning and the end of the string, then the part between the parentheses is interpreted as a roman numeral and translated into an integer. For any other format the function returns -1.

operatorHandlers: () -> OperatorHandlers((Integer, List OutputForm) -> OutputBox)

operatorHandlers() returns an internal data structure that is used for the selection of respective handlers.

overbar: (Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

overbar(p, hh) returns a handler h such that h(prec, args) formats arguments via hh(p, args) and then draws a bar over the resulting box. Outer parentheses are added if p < prec.

parenthesize: (String, String, OutputBox) -> OutputBox

parenthesize(lb, rb, bx) returns the box bx with left and right brackets (lb and rb) around it.

parenthesizeIf: (Boolean, OutputBox) -> OutputBox

parenthesizeIf(paren?, bx) returns parentheses (of appropriate size if paren? is true. Otherwise, bx is returned.

pile: ((Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

pile() returns a handler h such that h(prec, args) formats args according to hh and then puts them on top of each other left adjusted. The baseline corresponds to the baseline of the first argument.

power: (Integer, (Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

power(op, p, h1, h2) returns a handler h such that h(prec, args) formats args.1 and args.2 according to h1 and h2, respectively. Outer parentheses are added if p < prec.

precedence: (Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

precedence(p, hh) returns a handler h such that h(prec, args) returns hh(p, args). This handler can be used to change the context in which an expression is formatted.

prefix: (String, Integer, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

prefix(s, p, hh) returns a handler h such that h(prec, args) formats args according to hh and then prefixes this box by box s. Outer parentheses are added if p < prec.

prime: Integer -> (Integer, List OutputForm) -> OutputBox

prime(p) returns a handler that treats the typesetting of primes. Note that differentiate(a, 3) gives the following s-expression in OutputForm: (PRIME a “,,,”) whereas differentiate(a+b, 4) gives: (PRIME (+ a b) (PAREN “iv”)). the precedence p1. Outer parentheses are added if p < prec. See also the auxiliary function numberOfPrimes.

product: Integer -> (Integer, List OutputForm) -> OutputBox

product(p) returns a handler h such that h(prec, args) formats a product with product sign and respective limits. Outer parentheses are added if p < prec.

scripts: Integer -> (Integer, List OutputForm) -> OutputBox

Formats super- and subscripts also presuper and presub. scripts(p) returns a handler h such that h(prec, args) formats the first argument with respect to the precedence p. The other arguments are interpreted as subscript, superscript, presuperscript, and presubscript (in this order). Outer parentheses are added if p < prec.

slash: (Integer, (Integer, List OutputForm) -> OutputBox, (Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

Format a fraction linearly. slash(p, h1, h2) returns a handler h such that h(prec, args) formats the first argument according to h1 and the second argument by h2. Outer parentheses are added if p < prec.

subscript: Integer -> (Integer, List OutputForm) -> OutputBox

subscript(p) returns a handler such that subscript(p)(prec, args) formats the first argument with respect to the precedence p. The other arguments are formatted without parentheses and interpreted as subscripts separated by commas. Outer parentheses are added if p < prec.

sum: Integer -> (Integer, List OutputForm) -> OutputBox

sum(p) returns a handler h such that h(prec, args) formats a sum expression with summation sign and respective limits. Outer parentheses are added if p < prec.

theMap: (Integer, List OutputForm) -> OutputBox

theMap is a special handler to format a function.

vconcat: ((Integer, List OutputForm) -> OutputBox) -> (Integer, List OutputForm) -> OutputBox

vconcat(hh) returns a handler h such that h(prec, args) formats args according to hh and then puts them on top of each other where the lines are centered. The baseline corresponds to the baseline of the first argument.

zag: (Integer, List OutputForm) -> OutputBox

zag is a handler such that zag(prec, args) formats one part of a continued fraction.

CoercibleTo OutputForm