How to insert LaTeX code to HTML?
How to insert LaTeX
To insert LaTeX code into HTML it is necessary to load MathJax.js script in the header section:
<script async src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
Then it is necessary to wrap your LaTeX code into \ [ . . . \ ] delimiters for outstanding equation, or \ ( . . . \ ) for inline equation. It is possible to use $ $ . . . $ $ delimiters as well, but it is not recomended
Example of LaTeX
This is a full HTML code of writing LaTeX code inside HTML as outstanding equation and as inline equation.
<!DOCTYPE html>
<html>
<head>
<!-- Load MathJax -->
<script async src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<p>And here is an example of a outstanding equation:
\[\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}\]</p>
<p>And here is an example of a inline equation:
\(\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}\)</p>
</body>
</html>
This code will produce:

Outline and Inline equations written in LaTeX and inserted into HTML code with MathJax.
Original image: 518 x 143
Published: 2023-05-05 00:02:40
Updated: 2023-05-08 08:33:31