Skip to main content

ImageTeX

ClassSource

ImageTeX(
equation: str,
template: str | TeXTemplate = "default",
font_size: int | str | ImageFontAbsSize | ImageFontSize = ImageFontSize.h2,
pad_size: int = 0,
color: str | tuple[float, ...] = "#FFFFFF",
)

A layer of TeX equation that can be rendered as an image.

The image will be rendered every time when it is accessed.

Arguments​

Requires​

NameTypeRequired
Description
equationstr

The LaTeX equation to be rendered.

Do not add $ or $$ symbol to the equation.

templatestr | TeXTemplate

The LaTeX template used for rendering the equation. If using str, will treat this value as the template name.

The available templates can be found in improc.variables.tex_templates.

font_sizeint | str | ImageFontAbsSize | ImageFontSizeThe dynamic font size of the rendered text.
pad_sizeintThe size used for padding on all sides of the text.
colorstr | tuple[float, ...]The text color.

Methods​

copy​

v_1: Self = self.copy()

Get a copy of this instance.

Returns​

NameType
Description
v_1SelfThe copied text image.

Properties​

equation​

equation: str = self.equation

The LaTeX equation. Equivalent to self.text.


height​

height: int = self.height

The height of the text image.


img​

img: Image = self.img

Render the text as an image, and get the pixel-based image.


size​

size: tuple[int, int] = self.size

The (width, height) shape of the text image.


width​

width: int = self.width

The width of the text image.