EN
HTML - MathJax example
10 points
In this article, we would like to show how to use MathJax library directly with HTML.

The main advantage of this approach is, we are able to use math syntax directly in HTML couse code - it is not necessary to use JavaScript.
Practicale example:
xxxxxxxxxx
1
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
6
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
7
</head>
8
<body>
9
<p>
10
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
11
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
12
</p>
13
</body>
14
</html>
Note: the example comes from this webpage.
Copy one of the below codes to the example to see how it works.
Code | Preview |
\(y-y_0=m(x-x_0)\) | ![]() |
\(\cos^2θ+\sin^2θ=1\) | ![]() |
\(∑_{i=0}^n i={n(n+1) \over 2}\) | ![]() |
\(f'(x)=\lim_{h→0}{f(x+h)-f(x) \over h}\) | ![]() |
\(d(x, y) = \max(|x_1-y_1|, |x_2-y_2|)\) | ![]() |