Component-based approach

Overview

If you prefer a more component-based approach, we have authored Svelte Math.

Demo

Static Math

With props

Inline: A=πr2
Display: A=πr2

With slots

Reactive variables

213

Source code

Loading...

Installation

Loading...

Include the Temml fonts and css.

Props vs slots

The slots approach usually look cleaner, but will often lead to errors for expressions with curly braces (which is relatively common in LATEX).

When we use the expression \frac{a}{b} within a slot, Svelte will try to look for a variable named a and b and will throw an error if it can’t find them.

Using props instead allow us to write "\\frac{a}{b}" to represent ab. If interpolation is desired, then

Loading...

will enable us to represent 2b.

Remember to escape backslashes when typing LATEX commands in a JavaScript string!