Let’s add an editable mathfield to a web page.
1. Load the MathLive library from a CDN with a
<script defer src="//unpkg.com/mathlive/dist/mathlive.min.js"></script>
2. Add a
<math-field> tag. The content of the this tag is the initial value
of the mathfield, as a LaTeX expression.
<math-field>f(x) = x + 1</math-field>
Try it out
In the code playground below, change line 3 of the HTML to another LaTeX expression.
f(x) = \sin(x).
Note that the HTML quirks mode is not supported. This means that the host page
must use the strict mode, indicated by a
<!DOCTYPE html> directive at the top
of the page.