Skip to content

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.

0.00s / 2.97s · F0
PropTypeDefaultDescription
expressionstringLaTeX expression to render (e.g. "\\frac{1}{2}")
xnumber0X position in pixels
ynumber0Y position in pixels
fontSizenumber20Font size in pixels
colorstring'currentColor'Text color
widthnumber300Width of the foreignObject container
heightnumber100Height of the foreignObject container
alignstring'center'Text alignment ('left', 'center', 'right')
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' },
},
}