Markdown Features
Math Equations

Math Equations

Write beautiful mathematical equations using LaTeX/KaTeX notation in MD Editor.

Overview

MD Editor uses KaTeX for fast, high-quality mathematical rendering. You can write inline equations and display (block) equations using LaTeX syntax.

Inline Math

Use single dollar signs for inline equations within text.

Example syntax:

The Pythagorean theorem is $a^2 + b^2 = c^2$.

Display Math

Use double dollar signs for display equations (centered on their own line).

Example syntax:

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

Common Mathematical Notation

Superscripts and Subscripts

$x^2$, $x^{10}$, $x_1$, $x_{ij}$

Fractions

$\frac{1}{2}$, $\frac{a + b}{c + d}$

Square Roots

$\sqrt{2}$, $\sqrt[3]{8}$, $\sqrt{x^2 + y^2}$

Greek Letters

$\alpha$, $\beta$, $\gamma$, $\Delta$, $\pi$, $\Sigma$, $\Omega$

Operators

$\sum_{i=1}^{n} x_i$, $\prod_{i=1}^{n} x_i$, $\lim_{x \to \infty} f(x)$

Complex Equations

Quadratic Formula

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$

Matrix

$$
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
$$

System of Equations

$$
\begin{cases}
x + y = 5 \\
x - y = 1
\end{cases}
$$

Integral

$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$

Summation

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

Advanced Features

Aligned Equations

$$
\begin{aligned}
f(x) &= x^2 + 2x + 1 \\
     &= (x + 1)^2
\end{aligned}
$$

Multi-line Equations

$$
\begin{gather}
a = b + c \\
d = e + f + g \\
h = i + j + k + l
\end{gather}
$$

Matrices with Different Brackets

Parentheses:

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$

Brackets:

$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$

Braces:

$\begin{Bmatrix} a & b \\ c & d \end{Bmatrix}$

Vertical bars:

$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$

Mathematical Symbols

Comparison Operators

$<$, $>$, $\leq$, $\geq$, $\neq$, $\approx$, $\equiv$

Set Notation

$\in$, $\notin$, $\subset$, $\subseteq$, $\cup$, $\cap$, $\emptyset$

Logic Symbols

$\land$, $\lor$, $\neg$, $\implies$, $\iff$, $\forall$, $\exists$

Arrows

$\rightarrow$, $\leftarrow$, $\Rightarrow$, $\Leftarrow$, $\leftrightarrow$, $\Leftrightarrow$

Text in Math Mode

Use the text command for text within equations:

$$
P(\text{success}) = \frac{\text{favorable outcomes}}{\text{total outcomes}}
$$

Spacing in Math

Control spacing with these commands:

  • Thin space: \,
  • Medium space: \:
  • Thick space: \;
  • Quad space: \quad
  • Double quad space: \qquad

Example:

$a\,b$, $a\:b$, $a\;b$, $a\quad b$, $a\qquad b$

Special Functions

$\sin(x)$, $\cos(x)$, $\tan(x)$, $\log(x)$, $\ln(x)$, $\exp(x)$

Accents and Decorations

$\hat{x}$, $\bar{x}$, $\tilde{x}$, $\vec{x}$, $\dot{x}$, $\ddot{x}$

Large Operators

$$
\sum_{i=1}^{n} \quad \prod_{i=1}^{n} \quad \int_{a}^{b} \quad \oint_{C} \quad \bigcup_{i=1}^{n} \quad \bigcap_{i=1}^{n}
$$

Tips for Writing Math

  1. Use display mode for important equations - Makes them stand out
  2. Keep inline math simple - Complex expressions work better in display mode
  3. Use proper notation - Follow mathematical conventions
  4. Add context - Explain variables and symbols
  5. Test rendering - Preview your equations as you write

Common Pitfalls

Escaping Special Characters

If you need to use literal dollar signs in text, escape them with a backslash.

Example: The price is \$100

Curly Braces

Use backslash-escaped braces for literal braces in math.

Example: $\{x : x > 0\}$

KaTeX Support

MD Editor uses KaTeX for fast math rendering. Most LaTeX math commands are supported. For a complete reference, see the KaTeX documentation (opens in a new tab).

Examples from Different Fields

Physics - Newton's Law of Universal Gravitation

$$
F = G\frac{m_1 m_2}{r^2}
$$

Statistics - Standard Deviation

$$
\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2}
$$

Calculus - Fundamental Theorem of Calculus

$$
\frac{d}{dx}\left[\int_{a}^{x} f(t)\,dt\right] = f(x)
$$

Quick Reference

Common LaTeX commands for math:

  • Superscript: ^
  • Subscript: _
  • Fraction: \frac{numerator}{denominator}
  • Square root: \sqrt{x} or \sqrt[n]{x}
  • Sum: \sum_{lower}^{upper}
  • Integral: \int_{lower}^{upper}
  • Product: \prod_{lower}^{upper}
  • Limit: \lim_{x \to value}
  • Partial derivative: \frac{\partial f}{\partial x}
  • Infinity: \infty
  • Greek letters: \alpha, \beta, \gamma, etc.