Focused guide

Mathematics in Markdown

Use readable Markdown for the explanation and LaTeX for the notation. The result stays portable as source text while rendering equations where the reader needs them.

MarkIOY Team · August 11, 2026 · 10 min read

Write equations in source view. MarkIOY Web renders common LaTeX mathematics with KaTeX. Keep the surrounding explanation in visual view, and return to source when an expression needs precise structure.

The two delimiters

Most Markdown renderers that support mathematics use a dollar sign pair. Use one pair for a short expression inside a sentence; put a display equation on its own lines with two dollar signs. The expression itself is LaTeX math syntax.

UseMarkdownWhen to choose it
Inline math$a^2 + b^2 = c^2$A symbol or short relation in running text
Display math$$ ... $$An equation that deserves its own line

Inline example

Markdown sourceTry in Web editor
The quadratic formula gives $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.
Rendered result

Preparing rendered result…

Keep inline math short. A reader should be able to continue the sentence after it without losing the grammar.

Display example

Markdown sourceTry in Web editor
$$
E = mc^2
$$
Rendered result

Preparing rendered result…

Leave a blank line before and after a display equation. This is clearer in raw Markdown and avoids edge cases in renderers that require the delimiters to be on their own lines.

Common LaTeX building blocks

ResultWriteExample
Superscriptx^2$x^2$
Subscripta_n$a_n$
Grouped exponentx^{n+1}$x^{n+1}$
Fraction\frac{a}{b}$\frac{a}{b}$
Square root\sqrt{x}$\sqrt{x}$
Greek letter\alpha$\alpha + \beta$
Operators\sum, \int, \lim$\sum_{i=1}^{n} i$
Markdown sourceTry in Web editor
For a geometric series with ratio $r$, where $|r| < 1$:

$$
\sum_{n=0}^{\infty} ar^n = \frac{a}{1-r}
$$
Rendered result

Preparing rendered result…

Use braces whenever a superscript or subscript contains more than one character. x^10 means “x to the first power, then 0”; x^{10} means “x to the tenth power.”

Complex equations: alignment, cases, and matrices

For multi-line derivations, use an aligned environment inside a display block. Align related terms on &; use \\ to begin the next row.

Markdown sourceTry in Web editor
$$
\begin{aligned}
f(x) &= x^2 + 2x + 1 \\
+     &= (x + 1)^2
\end{aligned}
$$
Rendered result

Preparing rendered result…

Piecewise definition

Markdown sourceTry in Web editor
$$
f(x) =
\begin{cases}
x^2, & x \ge 0 \\
+-x,  & x < 0
\end{cases}
$$
Rendered result

Preparing rendered result…

Matrix and vector

Markdown sourceTry in Web editor
$$
A = \begin{bmatrix}
1 & 2 \\
+3 & 4
\end{bmatrix}
\qquad
\vec{v} = \begin{bmatrix} x \\ y \end{bmatrix}
$$
Rendered result

Preparing rendered result…

These environments are easy to damage when editing visually because their meaning depends on exact characters. Treat them like code: write them in source mode, render, then make one small correction at a time.

Compatibility and best practices

Confirm the renderer before choosing syntax

Dollar delimiters are common, but not universal. GitHub Markdown, static-site generators, note apps, and chat tools each enable mathematics differently. Some require an extension; some use \( ... \) and \[ ... \] instead. Preview in the destination, not only in the authoring tool.

Keep prose outside the formula

Explain what every displayed equation is for immediately before or after it. A formula without variables, units, assumptions, or a conclusion is difficult for collaborators and AI systems to interpret correctly.

Use semantic LaTeX, not visual spacing tricks

Prefer \frac, \sum, and \text{where} to manually aligned spaces. Semantic structure is more robust across screen sizes and easier to revise.

Escape Markdown only when necessary

Keep formulas out of link labels and emphasis markers. If literal dollar signs appear in normal text, escape them as \$. Put an equation in its own display block rather than trying to nest it in a complicated list, table, or quote.

Make equations accessible

Use descriptive sentences, define symbols nearby, and do not encode the only explanation in an image. If you export a document, inspect the output: a formula that looks correct in a browser may not be selectable or readable in another format.

Write the explanation, then the equation

Open a local Markdown file in MarkIOY, switch to source for the LaTeX, and keep a readable visual document alongside it.

Open MarkIOY Web →