MDash
By Mohammad AniniLast Reviewed October 6, 2026

Math and KaTeX

MDash typesets math using KaTeX and supports a broad set of LaTeX-style commands. The Markdown Guide covers the surrounding prose and block syntax.

Use Insert Equation in the toolbar to choose a template, switch between inline and display math, edit LaTeX source, and check the live KaTeX preview. Place the cursor inside an existing equation before opening the modal to update or convert it.

Table of Contents

Inline Math

Wrap in single dollar signs:

Markdown Source

Pythagoras: $a^2 + b^2 = c^2$.

Rendered Result

Pythagoras: $a^2 + b^2 = c^2$.

Display Math

Wrap in double dollar signs on their own lines:

Markdown Source

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

Rendered Result

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

Starting $ on its own line is the clearest form. MDash also accepts an opening delimiter immediately after prose, such as Text $, when a standalone closing $ follows. Display delimiters inside fenced code remain code.

Greek Letters

LetterSourceResult
Alpha\alpha$\alpha$
Delta\delta$\delta$
Theta\theta$\theta$
Lambda\lambda$\lambda$
Pi\pi$\pi$
Sigma\sigma$\sigma$
Phi\phi$\phi$
Omega\omega$\omega$

Capitalize the command for supported uppercase forms, such as \Delta, \Theta, \Lambda, \Pi, \Sigma, \Phi, or \Omega.

Fractions, Roots, Powers

Markdown Source

$
\frac{1}{1 + e^{-x}}, \quad
\sqrt[3]{\frac{a^2}{b}}, \quad
x^n, \quad x_n
$

Rendered Result

$ \frac{1}{1 + e^{-x}}, \quad \sqrt[3]{\frac{a^2}{b}}, \quad x^n, \quad x_n $

Sums, Products, Integrals

Markdown Source

$
\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}, \qquad
\prod_{i=1}^{n} i = n!, \qquad
\int_a^b f(x)\,dx
$

Rendered Result

$ \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}, \qquad \prod_{i=1}^{n} i = n!, \qquad \int_a^b f(x),dx $

Matrices

Markdown Source

$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \qquad
B = \begin{bmatrix} a & b \\ c & d \end{bmatrix}, \qquad
\det = \begin{vmatrix} a & b \\ c & d \end{vmatrix}
$

Rendered Result

$ A = \begin{pmatrix} 1 & 2 \ 3 & 4 \end{pmatrix}, \qquad B = \begin{bmatrix} a & b \ c & d \end{bmatrix}, \qquad \det = \begin{vmatrix} a & b \ c & d \end{vmatrix} $

Aligned Equations

Markdown Source

$
\begin{aligned}
y &= mx + b \\
m &= \frac{y_2 - y_1}{x_2 - x_1}
\end{aligned}
$

Rendered Result

$ \begin{aligned} y &= mx + b \ m &= \frac{y_2 - y_1}{x_2 - x_1} \end{aligned} $

Functions, Text, and Cases

Use named functions so KaTeX applies mathematical spacing and typography:

Common named functions include \sin, \cos, \log, \ln, and \lim.

Markdown Source

$
\sin^2(x) + \cos^2(x) = 1
$

Rendered Result

$ \sin^2(x) + \cos^2(x) = 1 $

Use \text{...} for words inside an expression:

Markdown Source

Velocity: $v = \frac{d}{t} \quad \text{where } t > 0$.

Rendered Result

Velocity: $v = \frac{d}{t} \quad \text{where } t > 0$.

A cases environment is useful for piecewise definitions:

Markdown Source

$
f(x) =
\begin{cases}
  x^2, & x \ge 0 \\
  -x, & x < 0
\end{cases}
$

Rendered Result

$ f(x) = \begin{cases} x^2, & x \ge 0 \ -x, & x < 0 \end{cases} $

Accents and Delimiters

PurposeSourceResult
Vector\vec{v}$\vec{v}$
Hat\hat{x}$\hat{x}$
Bar\bar{x}$\bar{x}$
Paired delimiters\left(\frac{a}{b}\right)$\left(\frac{a}{b}\right)$
Absolute value\left\lvert x\right\rvert$\left\lvert x\right\rvert$

Use \,, \:, \;, and \quad when an expression needs intentional spacing. Ordinary spaces in LaTeX-style math are usually ignored.

Common Operators

SymbolCode
$\le$\le
$\ge$\ge
$\neq$\neq
$\approx$\approx
$\pm$\pm
$\times$\times
$\div$\div
$\infty$\infty
$\partial$\partial
$\nabla$\nabla
$\rightarrow$\rightarrow
$\Rightarrow$\Rightarrow
$\in$\in
$\notin$\notin
$\subset$\subset
$\cup$\cup
$\cap$\cap

Dollar Signs and Plain Text

Escape a currency symbol when it could be mistaken for inline math:

Markdown Source

The total is \$25.

Rendered Result

The total is $25.

Math delimiters should contain a complete expression. A single unmatched dollar sign remains ordinary text. An unmatched $ also remains visible text instead of turning the rest of the document into a failed equation. Rendering, math-feature detection, and toolbar protection all use the same fence-aware delimiter scan.

Code fences and inline code are the best way to show math source without rendering it.

Accessibility

Introduce an important expression in words and explain the conclusion after it. KaTeX includes MathML alongside its visual output, which gives compatible assistive technology a mathematical representation, but surrounding prose still provides the clearest context.

Avoid using an equation as the only label for an action or section. Define uncommon variables close to the expression, keep logical reading order in the source, and break very long derivations into smaller steps.

Review exported HTML and PDF in the tools your audience uses. HTML retains the structured KaTeX output, while PDF accessibility depends on the browser print engine and the reader used to open the file.

Limitations and Errors

KaTeX supports a large, practical subset of LaTeX, but it is not a full TeX engine. Document layout commands, custom packages, and some uncommon macros are not available.

If an expression fails, simplify it until the error disappears, then add commands back one at a time. Also check braces, environment names, and backslash escaping.