Tex

Tex typesets math in a Box. It uses RaTeX and supports KaTeX syntax.

Loading Ebi…
let equation = <Tex font_size={24pt} x_align={Align.Center} y_align={Align.Center}>
    \mathbf{A} = \begin{pmatrix} x^2 & \alpha \\ \beta & \frac{1}{2} \end{pmatrix}
</Tex>
equation.write(duration=750ms)
equation.select(part=r"\\alpha", color=Color("blue2"), duration=350ms)
wait(350ms)
equation.edit(r"\\sqrt{y_1}", part=r"\\alpha", duration=900ms)
wait(650ms)

Use a literal markup body for multiline math. In Ebi strings, prefix the string with r to preserve braces and write two backslashes for each LaTeX backslash, as in Tex(r"\\sum_{i=1}^n i"). Ebi uses display style by default. Single dollar signs or \(…\) select inline style. Use display=false to set inline style explicitly. font_size sets the math size, color sets the formula's ink, and fill sets the Box background. Box options such as padding and alignment apply to the whole formula.

Set font to "math" (the default), "serif", "sans-serif", or "monospace". font_weight selects the closest bundled weight, with 400 for regular and 700 for bold. These settings apply to unstyled math glyphs. Uncovered symbols use their standard math face, and the bundled monospace face has one weight. Use commands such as \mathcal{F} and \mathbb{R} to style individual symbols.

Use .select(part=...) to highlight a math fragment and .select() to clear the highlight. Give .edit(...) a new formula to replace all of it, or add part= to replace one fragment. occurrence=2 targets the second matching fragment in source order. Select a complete fragment, such as x^2, \alpha, or \frac{1}{2}. Edits keep unchanged fragments together as the equation reflows. Delimiters resize with the formula, and replacement ink fades in after the old ink fades out. An edit clears the selection.