Math in Markdown

Ordinary HTML does not have any facility for displaying mathematics, so neither does standard Markdown. However, it is relatively easy to include well-formated mathematics in your HTML document by including a javascript math interpreter called MathJax in your document.

This requires you to do two things:

Set Up MathJax

Include the following text somewhere in your Markdown document. MathJax recommends to placing it in the HTML header, but it can also appear in the body of the document.

<script type="text/javascript" async 
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML">
</script>

For comprehensive documentation see the MathJax website - there are many configuration options.

Math Coding Styles

There are three main styles for coding mathematics for HTML display:

For Markdown documents, you will probably use TeX-style code. It is widely use and understood, although not always the easiest to read.

MathML is very tedious for a human to read or write.

And AsciiMath, while appealingly simple, uses backticks as math delimiters by default. Ordinarily these are used to format inline code in a Markdown document - distinguishing code from math is therefore harder. Another drawback to AsciiMath is that it does not encode as wide a variety of math typography as TeX.

TeX/LaTeX

There are two variations on writing math in TeX, the default style, and another more common style.

The default delimiters for TeX-style mathematics are a combination backslash-parentheses, backslash-square brackets, or double-dollar signs.

The other common style, which requires some additional set up in your document, uses dollars signs, $ and $$ as math delimiters.

See an example of each:

MathML

For a more extended MathML example, see

AsciiMath

For a more extended AsciiMath example, see