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#
Raw WebAssembly: Default context
toLatex(input_expression: Expression): stringCalling forms and variants
Raw WebAssembly: Explicit context: Context.toLatex
toLatex(input_expression: Expression): stringRaw WebAssembly: Expression method: Expression.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Circle2d method: Circle2d.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Matrix method: Matrix.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Point2d method: Point2d.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Polygon2d method: Polygon2d.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Segment2d method: Segment2d.toLatex
toLatex(): stringVariant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.toLatex
toLatex(): stringRender an expression as LaTeX. Matrices and geometry objects have their own
to_latex methods.
to_latex_with_options#
Raw WebAssembly: Default context
toLatexWithOptions(
input_expression: Expression,
exponential_style: string,
natural_logarithm_style: string,
multiletter_symbol_style: string,
): stringCalling forms
Raw WebAssembly: Explicit context: Context.toLatexWithOptions
toLatexWithOptions(
input_expression: Expression,
exponential_style: string,
natural_logarithm_style: string,
multiletter_symbol_style: string,
): stringRaw WebAssembly: Expression method: Expression.toLatexWithOptions
toLatexWithOptions(
exponential_style: string,
natural_logarithm_style: string,
multiletter_symbol_style: string,
): 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#
Raw WebAssembly: Expression method
serializeObject(): stringCalling forms and variants
Variant for this object — Raw WebAssembly: Circle2d method: Circle2d.serializeObject
serializeObject(): stringVariant for this object — Raw WebAssembly: Matrix method: Matrix.serializeObject
serializeObject(): stringVariant for this object — Raw WebAssembly: Point2d method: Point2d.serializeObject
serializeObject(): stringVariant for this object — Raw WebAssembly: Polygon2d method: Polygon2d.serializeObject
serializeObject(): stringVariant for this object — Raw WebAssembly: Segment2d method: Segment2d.serializeObject
serializeObject(): stringVariant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.serializeObject
serializeObject(): 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#
Not exposed by the WASM / JavaScript bindings. Available as Context.parse_serialized_object in Python, UniffiSession.parseSerializedObject in Kotlin, UniffiSession.parseSerializedObject in Swift, api::serialization::Session::parse_serialized_object in Rust.
Inverse of serialize_object; returns the matching surface class.
Example#
This family is not part of the recommended JavaScript facade in this release. Call it through the generated symi.raw layer, whose entries are listed with their wasm-bindgen signatures above, and read Migration for the ownership rules that apply there.
Additional API#
parseSerializedObject#
Raw WebAssembly: Default context
parseSerializedObject(text: string): anyInverse of serialize_object; returns the matching surface class.