Serialization and output
Serialization is a lossless interchange format for supported mathematical objects. Rendering is a presentation operation and does not change the object.
Output and serialization#
to_latex#
Explicit context
fun toLatex(target: UniffiExpression): kotlin.StringCalling forms and variants
Expression method: UniffiExpression.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiCircle2d method: UniffiCircle2d.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiMatrix method: UniffiMatrix.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiPoint2d method: UniffiPoint2d.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiPolygon2d method: UniffiPolygon2d.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiSegment2d method: UniffiSegment2d.toLatex
fun toLatex(): kotlin.StringVariant for this object — UniffiTriangle2d method: UniffiTriangle2d.toLatex
fun toLatex(): kotlin.StringRender an expression as LaTeX. Matrices and geometry objects have their own
to_latex methods.
to_latex_with_options#
Explicit context
fun toLatexWithOptions(
inputExpression: UniffiExpression,
options: UniffiLatexPresentationOptions,
): kotlin.StringCalling forms
Expression method: UniffiExpression.toLatexWithOptions
fun toLatexWithOptions(options: UniffiLatexPresentationOptions): kotlin.StringRender an expression as LaTeX with presentation flags. Each argument is a string
naming the choice for one flag; an unrecognized name falls back to that flag's
canonical default (so to_latex_with_options(e, "", "", "") equals
to_latex(e)):
exponential_style:"exp_function"(default,\exp(u)) or"e_caret"(e^{u}, the form the LaTeX parser reads back as exponentiation).natural_logarithm_style:"log"(default,\log) or"ln"(\ln).multiletter_symbol_style:"italic"(default,\mathit{name}) or"upright"(\mathrm{name}).
The defaults are fixed, content-independent canonical choices. Readability
heuristics (for example, switching a tall exponent to \exp) belong in the
caller, via the render-twice pattern: render with the default, test the result,
and re-render with the other flag value if it violates the heuristic.
serialize_object#
Explicit context
fun serializeObject(object: UniffiMathematicalObject): kotlin.StringCalling forms and variants
Expression method: UniffiExpression.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiCircle2d method: UniffiCircle2d.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiMatrix method: UniffiMatrix.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiPoint2d method: UniffiPoint2d.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiPolygon2d method: UniffiPolygon2d.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiSegment2d method: UniffiSegment2d.serializeObject
fun serializeObject(): kotlin.StringVariant for this object — UniffiTriangle2d method: UniffiTriangle2d.serializeObject
fun serializeObject(): kotlin.StringSerialize an expression, matrix, or geometry object to the stable Symi
serialization format, round-trippable via parse_serialized_object.
Notes: in WASM this is a per-object method because a single polymorphic context method cannot downcast a JsValue back to an exported Rust type.
parse_serialized_object#
Explicit context
fun parseSerializedObject(text: kotlin.String): UniffiMathematicalObjectInverse of serialize_object; returns the matching surface class.