Markdown Explorer Blog

Write LaTeX Math with KaTeX Preview

2 min read

Write LaTeX Math with KaTeX Preview

Markdown Explorer supports LaTeX-style math syntax and renders the result with KaTeX in Preview. This is useful for technical documentation, research notes, and explanations that need formulas beside ordinary Markdown.

Inline math

Use single dollar delimiters for a formula inside a sentence:

The relationship is $E = mc^2$, where $c$ is the speed of light.

Inline math remains part of the paragraph in Preview.

Display math

Use double dollar delimiters when the formula should have its own line:

$$ \int_0^\infty e^{-x}\,dx = 1 $$

Display math is easier to read for a derivation, matrix, or equation that needs visual emphasis.

A documentation example

## Compound growth For a principal $P$, rate $r$, and $n$ periods: $$ A = P(1 + r)^n $$ With $P = 1000$, $r = 0.05$, and $n = 3$, the result is approximately $1157.63$.

Keep the source pane open beside Preview while editing. A missing brace or delimiter becomes easier to spot when the rendered result does not update as expected.

Practical tips

KaTeX supports a large, practical subset of LaTeX math, but it is not a full LaTeX document engine. Document classes, packages, and page-layout commands do not belong in Markdown math blocks.

For another rich preview format, see Mermaid diagrams in the editor.

© 2026 Markdown Explorer