io#
import ampform.io
Input-output functions for ampform
and sympy
objects.
Tip
This function are registered with functools.singledispatch()
and can be
extended as follows:
>>> from ampform.io import aslatex
>>> @aslatex.register(int)
... def _(obj: int) -> str:
... return "my custom rendering"
>>> aslatex(1)
'my custom rendering'
>>> aslatex(3.4 - 2j)
'3.4-2i'
- aslatex(obj, **kwargs) str [source]#
- aslatex(obj: complex, **kwargs) str
- aslatex(obj: str, **kwargs) str
- aslatex(obj: Basic, **kwargs) str
- aslatex(obj: Expr, *, terms_per_line: int = 0, **kwargs) str
- aslatex(obj: Mapping, *, terms_per_line: int = 0, **kwargs) str
- aslatex(obj: Iterable, **kwargs) str
Render objects as a LaTeX
str
.The resulting
str
can for instance be given toIPython.display.Math
.New in version 0.14.1.
- Parameters:
terms_per_line –
If set to a non-zero, positive number,
sp.Expr
objects on the right-hand-side with multiple terms are split over multiple lines. The terms are split at the addition.New in version 0.15.2.