Idenso · latest
On this page

formatted

symbolica.community.tensor Function

formatted(expression: Expression, show_dimensions: Optional[bool] = None, *, settings: Optional[DisplaySettings] = None, notation_source: Optional[str] = None) -> FormattedOutput

Create a lazy rich display value for a notebook.

Parameters

expression Expression

Symbolica tensor syntax or scalar algebra to display. For a TensorExpression or component Tensor, prefer its formatting methods.

show_dimensions bool, optional

Override settings.show_dimensions for this call. None retains the selected settings, whose default omits dimensions.

settings DisplaySettings, optional

Tensor notation and display choices. Defaults to DisplaySettings().

notation_source str, optional

Unsupported for HTML and notebook output; raises ValueError. Use to_typst_project() or to_svg() for custom Typst notation.

Returns

FormattedOutput

Each requested backend renders the complete expression once and caches it.

Notes

Settings are captured here; custom printers run on the first request for each backend. Create a new formatted value after changing printers.

# Errors

Returns ValueError for Typst notation or incomplete MathML. Registered Python printer exceptions are logged and decline the override, allowing native fallback.

Examples

from symbolica import S
expression = S("x") + 1
from symbolica.community.tensor import formatted
output = formatted(expression)