AlbertUnruhUtils.visual.tex module

class AlbertUnruhUtils.visual.tex.TeX(tex: str, *, file: Union[PathLike, Path, str] = 'tex.png', format: str = 'png', color: Union[Iterable[float], str] = '#fe4b03')

Bases: object

Parameters
  • tex (str) – The input which should be displayed.

  • file (_PathLike) – Sets the default value for file.

  • format (str) – Sets the default value for format.

  • color (Union[Iterable[float], str]) – Sets the default value for color.

classmethod from_python_code(function: Callable, *, file: Union[PathLike, Path, str] = 'tex.png', format: str = 'png', color: Union[Iterable[float], str] = '#fe4b03') TeX

This function is not implemented yet with following reason: This feature is coming soon. Feel free to push it and open a PR on GitHub (https://github.com/AlbertUnruh/AlbertUnruhUtils.py).

Creates TeX from a function.

Parameters
  • function (Callable) – The Function which should be converted to TeX.

  • file (_PathLike) – Sets the default value for file.

  • format (str) – Sets the default value for format.

  • color (Union[Iterable[float], str]) – Sets the default value for color.

Return type

TeX

Raises

NotImplementedError – This feature is coming soon. Feel free to push it and open a PR on GitHub (https://github.com/AlbertUnruh/AlbertUnruhUtils.py).

property tex: str
property default_color: Union[Iterable[float], str]
property default_file: Path
property default_format: str
create_image(*, format: Optional[str] = None, color: Optional[Union[Iterable[float], str]] = None) Image

Creates the TeX-image.

Parameters
  • format (str, optional) – If None the default for format ‘ll be used.

  • color (_Color, optional) – If None the default for color ‘ll be used.

Returns

The TeX-image.

Return type

Image.Image

save_to_file(file: Optional[Union[PathLike, Path, str]] = None, /, format: Optional[str] = None, color: Optional[Union[Iterable[float], str]] = None) Path

Saves the TeX-image to a file.

Parameters
  • file (_PathLike, optional) – If None the default for file ‘ll be used.

  • format (str, optional) – If None the default for format ‘ll be used.

  • color (_Color, optional) – If None the default for color ‘ll be used.

Returns

The path to the saved TeX-image.

Return type

Path