Skip to main content

mathematical-formulas-symbols

Mathematical Formulas and Symbols

Mathematical typesetting is the crown jewel of LaTeX and the primary reason most people choose it. This chapter covers the foundations of mathematical formulas: inline and display formulas, subscripts and superscripts, fractions, roots, Greek letters, and common symbol tables.

Each "syntax \to effect" comparison in this document is rendered in real time; what you see in the document is what LaTeX produces.

Inline and Display Formulas

Formulas exist in only two forms: inline formulas embedded in sentences, wrapped in a pair of $; and display formulas centered on their own line, wrapped in \[ and \].

\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
The quadratic equation $ax^2 + bx + c = 0$ has the root formula
\[
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a},
\]
where the discriminant $\Delta = b^2 - 4ac$ determines the number of roots.
\end{document}

Inline and display formula effect

FormSyntaxEffectWhen to Use
Inline formula$...$Same height as text, embedded in sentencesSimple formulas referenced by the sentence
Display formula\[...\]Independent line, centered, larger fontImportant or complex formulas

Two habits to avoid: first, using the old $$...$$ for display formulas, which has spacing flaws—unify to \[...\]; second, after a sentence is interrupted by a display formula, do not leave a blank line before the formula—the formula is still part of the sentence, not a new paragraph.

Subscripts and Superscripts

^ is superscript, _ is subscript, and both only act on the immediately following single character or brace group.

SyntaxRendered Result
x^2x2x^2
a_{ij}aija_{ij}
2^{n+1}2n+12^{n+1}
x_i^2xi2x_i^2
x^{i^2}xi2x^{i^2}
e^{-t}ete^{-t}

Compare the fourth and fifth lines: x_i^2 is "the square of the i-th x," while x^{i^2} is "x raised to the power of i2i^2"—braces determine the scope, and a tiny difference can be wildly wrong.

Subscripts and superscripts with more than one character must be enclosed in braces. \hat{x}10 will be typeset as x^10\hat{x}10 (x with a hat, followed directly by the number 10, not a superscript); the correct syntax is \hat{x}^{10}, producing x^10\hat{x}^{10}.

Fractions and Roots

\frac{numerator}{denominator} produces a fraction, \sqrt{radicand} produces a square root, and the n-th root is written as \sqrt[n]{...}.

SyntaxRendered Result
\frac{a+b}{c}a+bc\frac{a+b}{c}
\frac{1}{1+\frac{1}{x}}11+1x\frac{1}{1+\frac{1}{x}}
\sqrt{2}2\sqrt{2}
\sqrt[3]{x^2+1}x2+13\sqrt[3]{x^2+1}
(\frac{a}{b})(ab)(\frac{a}{b})
\left(\frac{a}{b}\right)(ab)\left(\frac{a}{b}\right)

The last pair is worth memorizing: ordinary parentheses do not grow with their content; \left( and \right) automatically adapt the parenthesis height to the content, essential for wrapping fractions and matrices.

Fractions in inline formulas are automatically compressed (denominator lowered, smaller font). If it is too small, replace \frac with \dfrac (display frac), and the fraction will retain its display size.

Greek Letters

Greek letters are written as "backslash + English name," with uppercase/lowercase controlled by the first letter of the command.

Lowercase Greek Letters

CommandEffectCommandEffect
\alphaα\alpha\betaβ\beta
\gammaγ\gamma\deltaδ\delta
\epsilonϵ\epsilon\varepsilonε\varepsilon
\thetaθ\theta\lambdaλ\lambda
\muμ\mu\piπ\pi
\sigmaσ\sigma\omegaω\omega
\phiϕ\phi\varphiφ\varphi

Uppercase Greek Letters

CommandEffectCommandEffect
\GammaΓ\Gamma\DeltaΔ\Delta
\SigmaΣ\Sigma\OmegaΩ\Omega

Note two things: uppercase commands only capitalize the first letter (\Sigma, not \SIGMA); \epsilon vs. \varepsilon and \phi vs. \varphi are two glyph variants of the same letter, each with its own mathematical convention. Keep consistent usage within a paper.

Quick Reference for Common Symbols

High-frequency symbols are grouped into three tables; the effect column is rendered in real time.

CommandEffectCommandEffect
\times×\times\div÷\div
\pm±\pm\mp\mp
\cdot\cdot\leq\leq
\geq\geq\neq\neq
\approx\approx\equiv\equiv
\ll\ll\gg\gg
CommandEffectCommandEffect
\in\in\notin\notin
\subset\subset\subseteq\subseteq
\cup\cup\cap\cap
\emptyset\emptyset\infty\infty
\forall\forall\exists\exists
\Rightarrow\Rightarrow\Leftrightarrow\Leftrightarrow
CommandEffectCommandEffect
\partial\partial\nabla\nabla
\to\to\mapsto\mapsto
\mathrm{d}xdx\mathrm{d}x\hat{x}x^\hat{x}
\bar{x}xˉ\bar{x}\vec{x}x\vec{x}

Large Operators: Sum, Integral, Limit

\sum, \int, and \lim are the three most commonly used large operators, used with subscripts and superscripts.

\sum_{i=1}^n i = \frac{n(n+1)}{2} \\[1em]
\int_{0}^{\infty} e^{-x^2} \mathrm{d}x = \frac{\sqrt{\pi}}{2} \\[1em]
\lim_{n\to\infty} \left(1+\frac{1}{n}\right)^n = e
i=1ni=n(n+1)20ex2dx=π2limn(1+1n)n=e\sum_{i=1}^n i = \frac{n(n+1)}{2} \\[1em] \int_{0}^{\infty} e^{-x^2} \mathrm{d}x = \frac{\sqrt{\pi}}{2} \\[1em] \lim_{n\to\infty} \left(1+\frac{1}{n}\right)^n = e

In display formulas, the limits of summation appear directly above and below the symbol; in inline formulas they are automatically compressed to the side. If you also want the "above/below" form inline, wrap it in \displaystyle.

Two Essential Packages: amsmath and amssymb

amsmath and amssymb are the "official extension libraries" for mathematical typesetting; it is recommended to load them before writing formulas.

PackageProvides
amsmathMore formula environments (align, etc., Chapter 7), \dfrac / \tfrac, equation numbering control
amssymbExtended mathematical symbols, such as \mathbb blackboard bold

Common font-effect commands in math also come from these two packages:

SyntaxEffect
\mathbb{R}R\mathbb{R}
\mathcal{F}F\mathcal{F}
\vec{v}v\vec{v}
\mathrm{e}^{\mathrm{i}\pi}eiπ\mathrm{e}^{\mathrm{i}\pi}

The last line is a typographical detail: the base of the natural logarithm e and the imaginary unit i, if written directly, are treated as variables and set in italics; wrapping them with \mathrm{} sets them upright, which conforms to publishing conventions. Do not include Chinese characters or full-width punctuation inside formulas. $\(\alpha\)+\(\beta\)$, with full-width plus signs and Unicode Greek letters typed from an input method, are wrong—formula content must be entered via commands, and Chinese explanations belong outside $.

Comprehensive Example: Compiling a Real Document

Put the contents of this chapter into a complete document and compile it:

\documentclass{ctexart}
\usepackage{amsmath} % Math formula enhancement package, standard for formula typesetting
\usepackage{amssymb}
\begin{document}

The quadratic equation $ax^2 + bx + c = 0$ has the root formula
\[
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a},
\]
where the discriminant $\Delta = b^2 - 4ac$ determines the number of roots.

The most beautiful formula in mathematics is Euler's formula
\[
\mathrm{e}^{\mathrm{i}\pi} + 1 = 0,
\]
It connects the five most important constants.

\end{document}

Comprehensive example compiled effect

Summary

NeedSyntax
Inline formula$...$
Display formula\[...\]
Subscripts/superscripts\(\hat{x}\){10}、a_{ij} (multi-character requires braces)
Fraction / root\frac{a}{b}\sqrt[n]{x}
Adaptive parentheses\left( \right)
Large inline fraction\dfrac{a}{b}
Upright characters\mathrm{e}