Getting Started

Let’s add an editable mathfield to a web page.

1. Load the MathLive library from a CDN with a <script> tag.

<script defer src="//"></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>

LaTeX is a plain text markup language for structured documents. Most LaTeX commands start with a \, for example \sqrt, \frac and \sin. Read more about the available commands

Try it out

In the code playground below, change line 3 of the HTML to another LaTeX expression.
For example f(x) = \sin(x).

The code playground here and in the rest of the documentation are live: when you modify the HTML or JavaScript code the output will update to reflect your changes. Press Reset to bring back the playground to its original state.

<script src="//"></script> <math-field> x=\frac{-b\pm \sqrt{b^2-4ac}}{2a} </math-field>

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.