to_svg
symbolica.community.tensor Function
to_svg(expression: Expression, show_dimensions: Optional[bool] = None, *, settings: Optional[DisplaySettings] = None, notation_source: Optional[str] = None) -> str Render static mathematical tensor notation to SVG.
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, optionalCustom Typst notation source used by the rich renderer. This is Typst code, not a filename; omit it for the supplied tensor notation.
Returns
str
SVG markup suitable for embedding or saving to a file.
Notes
SVG export uses the optional Python package typst (typst-py). Pass the returned markup to the notebook's SVG display facility.
# Errors
Returns ImportError if optional typst-py is unavailable, or RuntimeError if compilation fails. 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_svg
output = to_svg(expression)View generated signature source: docs/api/python/spynso3.pyi:11070