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.
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.
| Use | Markdown | When 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
The quadratic formula gives $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.
Preparing rendered result…
Keep inline math short. A reader should be able to continue the sentence after it without losing the grammar.
Display example
$$
E = mc^2
$$
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
| Result | Write | Example |
|---|---|---|
| Superscript | x^2 | $x^2$ |
| Subscript | a_n | $a_n$ |
| Grouped exponent | x^{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$ |
For a geometric series with ratio $r$, where $|r| < 1$:
$$
\sum_{n=0}^{\infty} ar^n = \frac{a}{1-r}
$$
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.
$$
\begin{aligned}
f(x) &= x^2 + 2x + 1 \\
+ &= (x + 1)^2
\end{aligned}
$$
Preparing rendered result…
Piecewise definition
$$
f(x) =
\begin{cases}
x^2, & x \ge 0 \\
+-x, & x < 0
\end{cases}
$$
Preparing rendered result…
Matrix and vector
$$
A = \begin{bmatrix}
1 & 2 \\
+3 & 4
\end{bmatrix}
\qquad
\vec{v} = \begin{bmatrix} x \\ y \end{bmatrix}
$$
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 →