Symbols Keyboard📚 Guides
LaTeX & Typesetting⏱️ 12 min read

The Complete Guide to Mathematical Notation in LaTeX & Overleaf

Master mathematical typesetting in LaTeX and Overleaf. Learn inline vs display math, essential AMS-Math symbols, matrices, piecewise functions, and equation alignment.

Mathematical typesetting is one of the primary reasons researchers, engineers, and students adopt LaTeX. Created by Donald Knuth through TeX and expanded by Leslie Lamport and the American Mathematical Society (AMS), LaTeX produces publication-quality mathematical documents that are visually balanced, typographically consistent, and universally accepted by scientific journals.

Whether you are preparing an undergraduate thesis, submitting a paper to arXiv, or drafting collaborative lecture notes in Overleaf, mastering LaTeX's mathematical syntax is an essential STEM skill. This comprehensive guide covers everything from fundamental inline markup to complex tensor alignments, piecewise definitions, and matrix formatting.

1. Introduction to LaTeX Mathematical Typesetting

Unlike traditional "What You See Is What You Get" (WYSIWYG) word processors, LaTeX operates through declarative markup. Rather than clicking toolbar icons to insert a radical sign or fraction, you declare mathematical relationships semantically. LaTeX calculates exact typographic spacing, italicization angles, delimiter padding, and super/subscript baselines according to centuries-old mathematical typography traditions.

Variables in math mode are automatically italicized by default (e.g., $x$ produces x), whereas operational constants, functions, and digits remain upright. Understanding how LaTeX switches between text mode and math mode is your foundational starting point.

2. Inline vs Display Math Modes

LaTeX provides two distinct environments for mathematical text:

  • Inline Math: Placed inside running paragraphs. Delimited by single dollar signs $ ... $ or \( ... \). Fractions and operator limits (such as sums $\sum$ and integrals $\int$) are compressed vertically so they do not distort the line spacing of your paragraph.
  • Display Math: Isolated on its own line, centered with generous vertical margins. Delimited by \[ ... \] (preferred) or \begin{equation} ... \end{equation} for numbered equations. Operators render in full expanded display style (\displaystyle).

Example: Inline vs Display Render

% Inline: sits smoothly inside a sentence
The famous Gaussian integral evaluates to $\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$.

% Display: centered with automatic equation numbering
\begin{equation}
\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}
\label{eq:gaussian}
\end{equation}

3. Core AMS Packages (amsmath, amssymb, amsfonts)

Standard LaTeX provides basic math commands, but professional scientific documents almost universally require the American Mathematical Society (AMS) package suite. In your document preamble (before \begin{document}), always include:

\usepackage{amsmath}   % Multi-line alignments, matrices, cases, advanced symbols
\usepackage{amssymb}   % Blackboard bold (\mathbb{R}), advanced arrows, sets
\usepackage{amsfonts}  % Fraktur and calligraphic fonts
\usepackage{mathtools} % Useful extensions and bug fixes for amsmath

With these packages loaded, you unlock essential mathematical alphabets:

Alphabet / FontLaTeX CodeRendered OutputPrimary Academic Use
Blackboard Bold\mathbb{R}, \mathbb{C}, \mathbb{Z}, \mathbb{N}ℝ, ℂ, ℤ, ℕNumber systems (Real, Complex, Integers, Naturals)
Calligraphic\mathcal{L}, \mathcal{F}, \mathcal{H}ℒ, ℱ, ℋLaplace transforms, Fourier transforms, Hilbert spaces
Euler Fraktur\mathfrak{g}, \mathfrak{p}, \mathfrak{S}𝔤, 𝔭, 𝔖Lie algebras, ideal prime ideals, symmetric groups
Bold Math\mathbf{v}, \boldsymbol{\theta}v, θVectors, tensors, and bold Greek parameters

4. Greek Letters, Operators, and Relations

Greek letters are invoked by their spelled-out English names prefixed by a backslash. Lowercase letters start with a lowercase letter (e.g., \alpha $\to \alpha$, \beta $\to \beta$, \omega $\to \omega$), while capitalized names yield uppercase Greek letters (e.g., \Gamma $\to \Gamma$, \Delta $\to \Delta$, \Omega $\to \Omega$).

Typographic Tip: Letters like uppercase Alpha, Beta, or Omicron look identical to Latin A, B, and O, so LaTeX does not define \Alpha. Use regular Latin letters when these uppercase variants are needed.

Common Relational and Binary Operators

SymbolLaTeX SyntaxMath Meaning / Context
$\le$ / $\ge$\le or \leq / \ge or \geqLess than or equal to / Greater than or equal to
$\neq$\neq or \neNot equal to
$\approx$\approxApproximately equal to
$\equiv$\equivIdentical to or Modular congruence
$\times$ / $\div$\times / \divMultiplication cross / Division obelus
$\cdot$\cdotVector dot product, scalar multiplication
$\pm$ / $\mp$\pm / \mpPlus-minus / Minus-plus
$\infty$\inftyInfinity symbol

5. Fractions, Radicals, Subscripts, and Superscripts

Subscripts are created using the underscore _, and superscripts (powers) use the caret ^.

Grouping Rule: If your exponent or subscript contains more than one character, you must enclose it in curly braces { ... }. For example, x^10 renders as $x^10$ (the 0 falls back to normal text baseline), whereas x^{10} renders properly as $x^{10}$.

Fractions: \frac{num}{den}

Fractions take two bracketed arguments: the numerator followed by the denominator.

% Standard fraction
\frac{a + b}{c + d}

% Nested continued fraction
\frac{1}{1 + \frac{1}{2 + \frac{1}{3}}}

% Derivatives
\frac{df}{dx} \quad \text{and} \quad \frac{\partial^2 \psi}{\partial x^2}

Radicals and Roots: \sqrt[n]{x}

The square root command \sqrt{x} draws a radical bar spanning the entire argument. An optional parameter in square brackets specifies the root degree:

\sqrt{x^2 + y^2}           % Square root
\sqrt[3]{27}               % Cube root
\sqrt[n]{\frac{a}{b}}      % n-th root of a fraction

6. Dynamic Delimiters & Scaled Parentheses

One of the most frequent beginner blunders in LaTeX is using static parentheses around tall expressions like fractions or matrices. Compare:

% BAD: Parentheses remain tiny and look disjointed
(\frac{x^2 + 1}{y^2 - 1})

% GOOD: \left( and \right) expand dynamically
\left( \frac{x^2 + 1}{y^2 - 1} \right)

LaTeX supports several delimiter styles:

  • Parentheses: \left( ... \right)
  • Square Brackets: \left[ ... \right]
  • Curly Brackets: \left\{ ... \right\} (note the escaped backslash)
  • Angle Brackets: \left\langle ... \right\rangle
  • Absolute Value / Norm: \left| x \right| and \left\| \mathbf{v} \right\|
  • Single-sided delimiter: Use \left. or \right. to create invisible delimiters for evaluations (e.g., $\left. \frac{df}{dx} \right|_{x=0}$).

7. Typesetting Matrices, Vectors, and Arrays

The amsmath package provides dedicated matrix environments. Inside each environment, separate column entries using an ampersand & and terminate rows with a double backslash \\:

EnvironmentDelimiter StyleSample Code
matrixNone (plain numbers)\begin{matrix} a & b \\ c & d \end{matrix}
pmatrixRound parentheses $( \cdot )$\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
bmatrixSquare brackets $[ \cdot ]$\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}
vmatrixDeterminant single bars $| \cdot |$\det(A) = \begin{vmatrix} a & b \\ c & d \end{vmatrix}
VmatrixMatrix norm double bars $\| \cdot \|$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}

8. Aligning Multi-line Equations & Systems

When an equation is too lengthy for one line, or when you are presenting a step-by-step mathematical derivation, use the align environment from amsmath. The starred version align* suppresses equation numbers:

\begin{align*}
(x + y)^3 &= (x + y)(x + y)^2 \\
          &= (x + y)(x^2 + 2xy + y^2) \\
          &= x^3 + 2x^2y + xy^2 + x^2y + 2xy^2 + y^3 \\
          &= x^3 + 3x^2y + 3xy^2 + y^3
\end{align*}

The ampersand & specifies the vertical anchor point. Placing it right before the equals sign aligns every line cleanly down the page.

9. Piecewise Functions with Cases

For functions defined conditionally across different domains, use the cases environment. It automatically formats a left curly brace and handles column spacing:

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

Notice the use of \text{if }. Always wrap English commentary in \text{...} so that words are not styled as multiplied italic variables.

10. Common Errors & Typesetting Best Practices

  1. Missing Curly Braces on Exponents: Writing e^-ix renders as $e^- ix$. Always write e^{-ix}.
  2. Unescaped Function Names: Writing sin(x) causes LaTeX to render the word "sin" in italics as if it were $s \times i \times n$. Use the built-in upright operator \sin(x), \cos(x), \ln(x), or \exp(x).
  3. Overusing \frac in Exponents: Inside small exponents, e^{\frac{1}{2}} looks crowded. Prefer slash notation like e^{1/2} or negative powers.
  4. Hardcoding Spacing: Never use dozens of consecutive spaces in math mode. LaTeX ignores regular whitespace in math mode. Use dedicated micro-spacing commands:
    • \, — Thin space (ideal before differentials: \int f(x) \, dx)
    • \: — Medium space
    • \; — Thick space
    • \quad — One em space (equivalent to the width of the letter 'M')
    • \qquad — Two em space

11. Drawing & Converting LaTeX Online

Remembering hundreds of LaTeX commands can be intimidating when you are first drafting notes. If you ever forget the exact markup for a rare symbol, you can use our free interactive LaTeX Draw & Symbol Recognizer to sketch any handwritten character with your mouse, finger, or stylus. Our neural recognition engine immediately maps your sketch to the correct LaTeX code and Unicode character.

For rapid typing during exams or problem sets, check out our Maths Keyboard and Greek Keyboard for one-click symbol insertion.

Frequently Asked Questions

What is the difference between inline and display math mode in LaTeX?

Inline math ($...$ or \(...\)) renders equations embedded directly within running body text without disrupting paragraph flow. Display math ($$...$$ or \[...\] or \begin{equation}...) centers the formula on its own dedicated line, rendering larger sum, integral, and fraction symbols for optimal legibility.

Why should I use \[ ... \] instead of $$ ... $$ in modern LaTeX?

The double dollar sign $$ is an obsolete TeX primitive. In modern LaTeX, \[ ... \] is the officially recommended syntax because it properly respects document class spacing, prevents line-break bugs, and integrates seamlessly with AMS equation numbering environments.

How do I make brackets and parentheses automatically resize to fit tall fractions?

Enclose the expression between \left( and \right) or \left[ and \right]. LaTeX will automatically compute the vertical height of the enclosed fractions or matrices and scale the enclosing delimiters accordingly. If you only want one visible delimiter, pair it with a period, such as \left. and \right|.

How do I align multiple equations at their equals signs?

Use the \begin{align*} ... \end{align*} environment from the amsmath package. Place an ampersand (&) immediately before the operator or symbol you want to vertically align (e.g., f(x) &= 2x + 5 \\ &= 7).

SP

About the Author

Sunil Patil is a software engineer and STEM educator specializing in mathematical typesetting, scientific computing, and web utilities. He created Symbols Keyboard to streamline scientific documentation and make mathematical notation universally accessible to students, educators, and researchers worldwide.