LaTeX (KaTeX)
The <LaTeX> primitive renders a LaTeX math expression at a given position using KaTeX. It embeds the rendered HTML inside an SVG <foreignObject>, so it works alongside all other Elucim primitives.
| Prop | Type | Default | Description |
|---|---|---|---|
expression | string | — | LaTeX expression to render (e.g. "\\frac{1}{2}") |
x | number | 0 | X position in pixels |
y | number | 0 | Y position in pixels |
fontSize | number | 20 | Font size in pixels |
color | string | 'currentColor' | Text color |
width | number | 300 | Width of the foreignObject container |
height | number | 100 | Height of the foreignObject container |
align | string | 'center' | Text alignment ('left', 'center', 'right') |
Code Example
Section titled “Code Example”elements: { energy: { id: 'energy', type: 'latex', props: { type: 'latex', expression: 'E = mc^2', x: 250, y: 100, fontSize: 36, color: '$accent' }, }, integral: { id: 'integral', type: 'latex', props: { type: 'latex', expression: '\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}', x: 250, y: 200, fontSize: 28, color: '$secondary' }, },}