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 a2+b2=c2a^2 + b^2 = c^2.

Display Math

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

Example syntax:

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

Common Mathematical Notation

Superscripts and Subscripts

x2x^2, x10x^{10}, x1x_1, xijx_{ij}

Fractions

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

Square Roots

2\sqrt{2}, 83\sqrt[3]{8}, x2+y2\sqrt{x^2 + y^2}

Greek Letters

α\alpha, β\beta, γ\gamma, Δ\Delta, π\pi, Σ\Sigma, Ω\Omega

Operators

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

Complex Equations

Quadratic Formula

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

Matrix

[abcd]\begin{bmatrix} a & b \\ c & d \end{bmatrix}

System of Equations

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

Integral

01x2dx=13\int_0^1 x^2 \, dx = \frac{1}{3}

Summation

k=1nk=n(n+1)2\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
Try writing math equations →

Advanced Features

Aligned Equations

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

Multi-line Equations

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

Matrices with Different Brackets

Parentheses:

(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}

Brackets:

[abcd]\begin{bmatrix} a & b \\ c & d \end{bmatrix}

Braces:

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

Vertical bars:

abcd\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(success)=favorable outcomestotal outcomesP(\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:

aba\,b, aba\:b, a  ba\;b, aba\quad b, aba\qquad b

Special Functions

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

Accents and Decorations

x^\hat{x}, xˉ\bar{x}, x~\tilde{x}, x\vec{x}, x˙\dot{x}, x¨\ddot{x}

Large Operators

i=1ni=1nabCi=1ni=1n\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=Gm1m2r2F = G\frac{m_1 m_2}{r^2}

Statistics - Standard Deviation

σ=1Ni=1N(xiμ)2\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2}

Calculus - Fundamental Theorem of Calculus

ddx[axf(t)dt]=f(x)\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.