Markdown syntax

How to Write Math in Markdown
LaTeX equations with $ and $$

You want to write math in Markdown, an inline symbol like a variable, or a full equation like an integral. Standard Markdown has no math syntax of its own, but nearly every tool that does support math uses the same convention: LaTeX wrapped in dollar signs.

Here is the syntax, the one dollar-sign gotcha that trips people up, and how it renders.

Inline and block math

Wrap LaTeX in one dollar sign on each side for inline math, inside a sentence:

The mass-energy formula is $E = mc^2$.

Wrap it in two dollar signs for a block: a centered equation on its own lines.

$$
\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}
$$

The part between the dollar signs is LaTeX math, rendered by a library like KaTeX. It is an extension, not standard Markdown, so it works in tools that support it (Obsidian, many editors, some GitHub views) and shows as plain text in ones that do not.

The dollar-sign gotcha: money vs math

The obvious risk with using $ for math is money. If a tool treated every dollar sign as math, the sentence "it cost $5 or $10" would turn the middle into a formula. To prevent that, the rules for inline math are strict:

  • The opening $ must sit right against non-whitespace inside the formula (no space just inside the dollars).
  • The closing $ cannot be immediately followed by a digit, so a price is left alone.

So $E=mc^2$ renders as math, while a sentence about a 5 dollar or 10 dollar price stays as plain text. If your math is not rendering, check that there is no stray space just inside the dollars.

How it renders in NoteLoom

NoteLoom renders both $...$ and $$...$$ with KaTeX. The nice part for editing: in the edit view, when your cursor is on the line with a formula it shows the raw LaTeX so you can change it, and when you move the cursor away it renders back to the formula. The reading view just shows the rendered math.

What it covers is math-mode LaTeX: Greek letters, fractions, integrals, sums, matrices, and most symbols. It is not a full LaTeX document engine, it renders the math, and your file stays plain .md with the LaTeX readable inside it.

FAQ

How do you write math in Markdown?
Standard Markdown has no math of its own, but most tools that support it use LaTeX wrapped in dollar signs: one dollar on each side for inline math, and two on each side for a block equation. A math library such as KaTeX turns the LaTeX into the rendered formula.
Is math part of standard Markdown?
No, it is an extension. The dollar-sign LaTeX convention is widely supported, in Obsidian, many editors, and some GitHub contexts, but a plain CommonMark renderer with no math support just shows the dollar signs and LaTeX as text.
Why did a price turn into math, or why will my math not render?
The dollar-sign rules are deliberately strict so that money is not mistaken for a formula. The dollar has to sit right against non-whitespace inside the formula, and a closing dollar cannot come immediately before a digit. So an inline formula renders, while a sentence like "it cost 5 or 10 dollars" written with dollar signs stays as plain text.
What is the difference between one dollar sign and two?
One dollar on each side is inline math that sits in the flow of a sentence. Two on each side makes a block: a centered equation on its own lines, with space above and below.
Does NoteLoom render LaTeX math?
Yes, with KaTeX. In the edit view, when your cursor is on the line with a formula it shows the LaTeX source so you can fix it, and when you move away it renders. The reading view shows the rendered formula.
Can I use full LaTeX?
It is math-mode LaTeX rendered by KaTeX, which covers the common things: Greek letters, fractions, integrals, sums, matrices, and most symbols. It is not a full LaTeX document engine, it renders the math, not a whole LaTeX paper.

See your equations render as you type

Open NoteLoom in Chrome / Edge / Arc, open a .md file, and write LaTeX in dollar signs while the live and reading views render it with KaTeX, saved straight back to the file. No install and no account.

Open NoteLoom and try it