Component-based approach
Overview
If you prefer a more component-based approach, we have authored Svelte Math.
Demo
Static Math
With props
Inline:
Display:
With slots
Reactive variables
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 ).
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
If interpolation is desired, then
Loading...
will enable us to represent
Remember to escape backslashes when typing commands in a JavaScript string!