How to Write Math Equations in Markdown (LaTeX)

Published Oct 13, 2021  ∙  Updated Aug 21, 2022

There’s no native support for LaTeX in Markdown, but there are two nice solutions to write math equations in Markdown.

Using HTML Entities and Symbols

We can use HTML entities and UTF-8 Mathematical Operators in Markdown to write math equations without any external dependencies.

hθ(x) = θo x + θ1x

However, this approach is fairly limited and can be quite complicated just to get a simple math equation on the page.

Using LaTeX in CodeCogs

This equation editor called CodeCogs is quite amazing.

It’s a very friendly interface to write out equations in LaTeX markup.

Once we’ve typed in an equation, we can do the following:

  1. Click Export
  2. Select svg and HTML
  3. Paste the img tag into our Markdown.

This equation is from a previous article: Should I Participate in an Employee Stock Purchase Plan (ESPP)?