LaTeX is renowned for its superior mathematical typesetting. This guide will take you from basic equations to advanced mathematical expressions.
Fun fact: LaTeX’s math rendering is so good that even Microsoft Word now uses a LaTeX-like syntax for its equation editor!
Why LaTeX for Math?
Compare these approaches to writing the quadratic formula:
Plain text: x = (-b +/- sqrt(b^2 - 4ac)) / 2a
LaTeX result: x=2a−b±b2−4ac
The difference is clear – LaTeX produces publication-quality mathematics.
Math Modes
LaTeX has two math modes:
1. Inline Math Mode
For math within text, use $...$ or \(...\):
Expected output
The famous equation E=mc2 was discovered by Einstein. We can also write a2+b2=c2 for the Pythagorean theorem.
2. Display Math Mode
For centered equations on their own line, use \[...\] or equation environment:
Expected output
The quadratic formula is:x=2a−b±b2−4acFor numbered equations:\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} \tag{1}
Use \[...\] for important formulas you want to highlight. Use $...$ for variables and simple expressions within sentences.
Basic Math Elements
Superscripts and Subscripts
Expected output
Superscripts: x2, x10, xn+1Subscripts: x1, x10, xi,jCombined: x12, ank+1Chemical formulas: H2O, CO2
Fractions
Expected output
Simple fractions: 21, baNested fractions: 1+211Display style: c+da+bAlternative notation: a/b or a/b
Roots
Expected output
Square root: 2, x2+y2nth root: 38, nxNested roots: 2+3
Common Math Symbols
Greek Letters
Expected output
Lowercase: α,β,γ,δ,ϵ and θ,λ,μ,π,σ,ϕUppercase: Γ,Δ,Θ,Λ,Σ,ΦVariants: ϵ vs ε and ϕ vs φ
Operators and Relations
Expected output
Basic operators: a+b−c×d÷eComparison: a<b≤c=d≥e>f and a=b≈c≡dSet operations: A∪B∩C⊂D and x∈A,y∈/BLogic: p∧q∨r⟹s and ∀x∃y
Arrows
Expected output
Basic arrows: →,←,↔ and ⇒,⇐,⇔Long arrows: ⟶,⟵Special arrows: ↑,↓,↕ and ↗,↘,↙,↖
Functions and Operators
Standard Functions
Expected output
Trigonometric: sinθ,cosθ,tanθLogarithms: logx,lnx,log2xLimits: x→0limxsinx=1Min/Max: min(a,b),max(a,b)
Sums and Products
Expected output
Summation: i=1∑ni=2n(n+1)Product: i=1∏ni=n!Multiple lines: i=1i=j∑nai
Integrals and Derivatives
Expected output
Derivatives: f′(x),f′′(x),f(n)(x) and dxdf,dx2d2f and ∂x∂fIntegrals: ∫f(x)dx and ∫abf(x)dx and ∬Df(x,y)dxdySpecial notation: ∮CF⋅dr
Matrices and Arrays
Basic Matrices
Expected output
pmatrix (parentheses): (acbd)bmatrix (brackets): 147258369vmatrix (determinant): acbd=ad−bc
Advanced Arrays
Expected output
Custom arrays: [142536]Cases (piecewise functions): f(x)={x2−xif x≥0if x<0
Spacing in Math Mode
Expected output
Default: ab vs abThin space: ab | Medium space: ab | Thick space: abQuad space: ab | Double quad: abNegative space: ab
Use \, before differentials in integrals: \int f(x)\,dx looks better than \int f(x)dx.
Advanced Features
Theorem Environments
Aligning Equations
Common Mistakes to Avoid
1. Forgetting braces for multi-character super/subscripts
- Wrong:
$x^10$ → x¹0
- Right:
$x^{10}$ → x¹⁰
2. Using text in math mode
- Wrong:
$x = speed * time$
- Right:
$x = \text{speed} \times \text{time}$
3. Incorrect fraction syntax
- Wrong:
$\frac{1/2}$
- Right:
$\frac{1}{2}$
Math Packages
Essential packages for advanced mathematics:
Practice Exercises
Try typesetting these formulas:
- Euler’s Identity: eiπ+1=0
- Gaussian Integral: ∫−∞∞e−x2dx=π
- Binomial Theorem: (x+y)n=∑k=0n(kn)xn−kyk
- Maxwell’s Equation: ∇×E=−∂t∂B
Quick Reference
Next Steps
Math Symbols Reference
Complete list of mathematical symbols
Advanced Equations
Multi-line equations and advanced layouts
Matrices & Arrays
Complex matrix operations and layouts
Scientific Notation
Physics, chemistry, and scientific formatting
Ready to create beautiful mathematical documents? You now have the foundation to typeset any mathematical expression in LaTeX!