to_html
symbolica.community.tensor Function
to_html(expression: Expression, show_dimensions: Optional[bool] = None, *, settings: Optional[DisplaySettings] = None, notation_source: Optional[str] = None) -> str Render the tensor as an HTML fragment.
Parameters
expressionExpressionSymbolica tensor syntax or scalar algebra to display. For a TensorExpression or component Tensor, prefer its formatting methods.
show_dimensionsbool, optionalOverride settings.show_dimensions for this call. None retains the selected settings, whose default omits dimensions.
settingsDisplaySettings, optionalTensor notation and display choices. Defaults to DisplaySettings().
notation_sourcestr, optionalUnsupported for HTML and notebook output; raises ValueError. Use to_typst_project() or to_svg() for custom Typst notation.
Returns
str
Self-contained output fragment for an HTML-capable notebook or page.
Notes
Mathematical rendering uses direct MathML and requires no Typst compiler. The complete expression is exported; oversized output raises an error. Pass the returned string to the notebook's HTML display facility.
# 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 to_html
output = to_html(expression)View generated signature source: docs/api/python/spynso3.pyi:11028