README

#symprint

CAIMEOX/symbit/symprint is the public import path for this package.

String and LaTeX printers for symbolic expressions. Use this package when you need stable pretty-printed text or configurable LaTeX rendering.

#When To Use This Package

  • Import CAIMEOX/symbit/symprint directly when your code depends on this package's subsystem-specific types or algorithms.
  • Prefer this package over the root facade when you want the focused API surface listed below rather than a convenience wrapper.

#Key Public Entry Points

  • latex
  • latex_settings
  • latex_with_settings
  • pretty_string
  • LatexSettings

#Example

///|
test "symprint renders plain text and latex" {
let x = @symcore.Expr::Symbol("x")
let expr = @symcore.add([x, @symcore.int(1)])
inspect(pretty_string(expr), content="x + 1")
inspect(latex(expr), content="x + 1")
}

  • CAIMEOX/symbit
  • CAIMEOX/symbit/symcore

#
LatexSettings

pub struct LatexSettings {
mode : String
full_prec : Bool
fold_frac_powers : Bool
fold_func_brackets : Bool
fold_short_frac : Bool
inv_trig_style : String
itex : Bool
ln_notation : Bool
long_frac_ratio : Int?
mul_symbol : String?
mul_symbol_latex : String
mul_symbol_latex_numbers : String
root_notation : Bool
imaginary_unit : String
imaginary_unit_latex : String
diff_operator : String
diff_operator_latex : String
parenthesize_super : Bool
symbol_names : Map[String, String]
}

Public configuration record for the LaTeX printer.

  • Does: Stores printer options shared by latex and latex_with_settings.
  • Input: Usually built with latex_settings(...).
  • Returns: A record carrying mode, fraction, trig, multiplication, root, imaginary-unit, differential-operator, and symbol-name options.
  • Limits: This config only affects the LaTeX printer; it does not change pretty_string or structural Debug output.

Current Limits:
  • symprint currently exposes plain-text and LaTeX front doors only.
  • some advanced expression families still fall back to generic function-style notation.

#
latex

fn latex(expr :
Expr
, mode? : String, full_prec? : Bool, fold_frac_powers? : Bool, fold_func_brackets? : Bool, fold_short_frac? : Bool?, inv_trig_style? : String, itex? : Bool, ln_notation? : Bool, long_frac_ratio? : Int?, mul_symbol? : String?, root_notation? : Bool, imaginary_unit? : String, diff_operator? : String, parenthesize_super? : Bool, symbol_names? : Map[String, String]) -> String

Render an expression as LaTeX with convenience keyword arguments.

  • Does: Prints LaTeX directly from an expression and printer options.
  • Input: A @symcore.Expr plus optional printer settings.
  • Returns: A String.
  • Limits: Unknown mode strings fall back to the bare LaTeX body rather than raising an error.

test "symprint latex renders with inline mode and custom multiplication" {
let x = @symcore.Expr::Symbol("x")
let expr = @symcore.mul([@symcore.int(2), @symcore.pow(x, @symcore.int(2))])
inspect(
latex(expr, mode="inline", mul_symbol=Some("times")),
content="$2 \\times x^{2}$",
)
}

#
latex_settings

fn latex_settings(mode? : String, full_prec? : Bool, fold_frac_powers? : Bool, fold_func_brackets? : Bool, fold_short_frac? : Bool?, inv_trig_style? : String, itex? : Bool, ln_notation? : Bool, long_frac_ratio? : Int?, mul_symbol? : String?, root_notation? : Bool, imaginary_unit? : String, diff_operator? : String, parenthesize_super? : Bool, symbol_names? : Map[String, String]) -> LatexSettings

Build a reusable LatexSettings record.

  • Does: Collects LaTeX printer keyword options into a single settings value.
  • Input: Optional keyword arguments such as mode, mul_symbol, inv_trig_style, imaginary_unit, and symbol_names.
  • Returns: A LatexSettings record.
  • Limits: String-valued knobs are permissive; unrecognized values are carried through or fall back to generic rendering instead of being rejected.

#
latex_with_settings

fn latex_with_settings(expr :
Expr
, settings : LatexSettings) -> String

Render an expression as LaTeX using an explicit settings record.

  • Does: Prints LaTeX from an expression and a prepared LatexSettings.
  • Input: A @symcore.Expr and a LatexSettings.
  • Returns: A String.
  • Limits: It shares the same rendering coverage and fallback behavior as latex.

#
pretty_string

fn pretty_string(expr :
Expr
) -> String

Render an expression into the default human-readable pretty string form.

  • Does: Prints an expression using the standard readable textual printer.
  • Input: A @symcore.Expr.
  • Returns: A String.
  • Limits: The output is readable text, not a lossless serialization format.