MathJax and KaTeX are display engines for complex mathematic formulas, and Notebooks supports both in combination with Markdown. The simplest option to use MathJax or KaTeX is by selecting one of Notebooks‘ pre-installed document themes which include all the necessary scripts (Scientific+MathJax and Scientific+Katex).

Alternatively you can add the required scripts at the bottom of your favorite document style sheet (right after the </style> tag), or you simply add these lines at the top of a Markdown document.

For MathJax, use

<script>
MathJax = {
    tex: {
        inlineMath: [ ['$','$'], ['\\(','\\)'] ],
        displayMath: [ ['$$','$$'], ['\\[','\\]'] ],
        processEscapes: true
    }
};
</script>        

The definitions of inlineMath and displayMath control the way you enter your mathematical expressions. Our default implementations include single parentheses as well, which is very convenient but may also produce unexpected results. If you don’t want the single parentheses, you can use the definition above.

For KaTeX, use the following, again in your favorite document theme or in the header/footer of a Markdown document, as documented at katex.org:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"
    onload="renderMathInElement(document.body);"></script>
Use Mathematic Expressions in Documents (MathJax or KaTeX)