Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

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): string
Calling forms and variants

Raw WebAssembly: Explicit context: Context.toLatex

toLatex(input_expression: Expression): string

Raw WebAssembly: Expression method: Expression.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Circle2d method: Circle2d.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Matrix method: Matrix.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Point2d method: Point2d.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Polygon2d method: Polygon2d.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Segment2d method: Segment2d.toLatex

toLatex(): string

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.toLatex

toLatex(): string

Render 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,
): string
Calling forms

Raw WebAssembly: Explicit context: Context.toLatexWithOptions

toLatexWithOptions(
    input_expression: Expression,
    exponential_style: string,
    natural_logarithm_style: string,
    multiletter_symbol_style: string,
): string

Raw WebAssembly: Expression method: Expression.toLatexWithOptions

toLatexWithOptions(
    exponential_style: string,
    natural_logarithm_style: string,
    multiletter_symbol_style: string,
): string

Render 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(): string
Calling forms and variants

Variant for this object — Raw WebAssembly: Circle2d method: Circle2d.serializeObject

serializeObject(): string

Variant for this object — Raw WebAssembly: Matrix method: Matrix.serializeObject

serializeObject(): string

Variant for this object — Raw WebAssembly: Point2d method: Point2d.serializeObject

serializeObject(): string

Variant for this object — Raw WebAssembly: Polygon2d method: Polygon2d.serializeObject

serializeObject(): string

Variant for this object — Raw WebAssembly: Segment2d method: Segment2d.serializeObject

serializeObject(): string

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.serializeObject

serializeObject(): string

Serialize 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): any

Inverse of serialize_object; returns the matching surface class.

Calling forms

Raw WebAssembly: Explicit context: Context.parseSerializedObject

parseSerializedObject(text: string): any

Symi documentation · WASM / JavaScript