Operators, Delimiters, and Math Formatting

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Common Operators

Binary Operators

  • Command: + | Output: \( + \) | Command: \times | Output: \( \times \)

  • Command: - | Output: \( – \) | Command: \div | Output: \( \div \)

  • Command: \pm | Output: \( \pm \) | Command: \mp | Output: \( \mp \)

  • Command: \cdot | Output: \( \cdot \) | Command: \ast | Output: \( \ast \)

  • Command: \cap | Output: \( \cap \) | Command: \cup | Output: \( \cup \)

  • Command: \wedge | Output: \( \wedge \) | Command: \vee | Output: \( \vee \)

  • Command: \otimes | Output: \( \otimes \) | Command: \oplus | Output: \( \oplus \)

    Relations

  • Command: = | Output: \( = \) | Command: \neq | Output: \( \neq \)

  • Command: < | Output: \( < \) | Command: > | Output: \( > \)

  • Command: \leq | Output: \( \leq \) | Command: \geq | Output: \( \geq \)

  • Command: \ll | Output: \( \ll \) | Command: \gg | Output: \( \gg \)

  • Command: \approx | Output: \( \approx \) | Command: \equiv | Output: \( \equiv \)

  • Command: \sim | Output: \( \sim \) | Command: \simeq | Output: \( \simeq \)

  • Command: \in | Output: \( \in \) | Command: \notin | Output: \( \notin \)

  • Command: \subset | Output: \( \subset \) | Command: \supset | Output: \( \supset \)

  • Command: \subseteq | Output: \( \subseteq \) | Command: \supseteq | Output: \( \supseteq \)

    Named Functions

Use predefined commands for function names so they appear upright (not italic):

% WRONG: sin is italic
$sin(x)$

% RIGHT: sin is upright
$\sin(x)$, $\cos(x)$,
$\tan(x)$, $\log(x)$,
$\ln(x)$, $\exp(x)$,
$\lim_{n\to\infty}$,
$\max$, $\min$, $\sup$

\( sin(x) \) (wrong — italic) \( \sin(x) \), \( \cos(x) \), \( \tan(x) \), \( \log(x) \), \( \ln(x) \), \( \exp(x) \), \( \lim_{n\to\infty} \), \( \max \), \( \min \), \( \sup \)

Sums, Products, Integrals, and Limits

These “big operators” behave differently in inline and display modes:

Inline: $\sum_{i=1}^{n} i^2$

Display:
<!--M98-->

<!--M99-->

<!--M100-->

<!--M101-->

Inline: \( \sum_{i=1}^{n} i^2 \)

Display:

$$ \sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6} $$ $$ \int_0^\infty e^{-x}\,dx = 1 $$ $$ \prod_{k=1}^{n} k = n! $$ $$ \lim_{x \to 0} \frac{\sin x}{x} = 1 $$

Tip: In display mode, limits go above and below. In inline mode, they go to the side (to avoid stretching line height). To force display-style limits inline, use \displaystyle: \( \displaystyle\sum_{i=1}^{n} \). But use this sparingly — it disrupts line spacing.

Delimiters

Parentheses, brackets, and braces should scale with their content:

% Fixed size (bad)
$(\frac{a}{b})$

% Auto-scaling (good)
$\left(\frac{a}{b}\right)$

% Other delimiters:
$\left[\frac{a}{b}\right]$
$\left\{\frac{a}{b}\right\}$
$\left|\frac{a}{b}\right|$
$\left\langle x \right\rangle$

\( (\frac{a}{b}) \) (bad) \( \left(\frac{a}{b}\right) \) (good) \( \left[\frac{a}{b}\right] \) \( \left\{\frac{a}{b}\right\} \) \( \left|\frac{a}{b}\right| \) \( \left\langle x \right\rangle \)

\left and \right must always appear as a pair. If you need only one side, use a dot for the invisible delimiter:

\left. \frac{d}{dx} x^n \right|_{x=1} = n

renders as \( \left. \frac{d}{dx} x^n \right|_{x=1} = n \)

Manual Sizing

Sometimes \left/\right produces awkward sizes. Manual sizing gives you control:

  • Command: \big( | Size: \( \big( \)
  • Command: \Big( | Size: \( \Big( \)
  • Command: \bigg( | Size: \( \bigg( \)
  • Command: \Bigg( | Size: \( \Bigg( \)

    Math Spacing

LaTeX handles most math spacing automatically, but sometimes you need manual adjustments:

  • Command: \, | Width: thin space (3/18 em) | Use Case: Before \( dx \): \( \int f(x)\,dx \)
  • Command: \: | Width: medium space (4/18 em) | Use Case: Between related symbols
  • Command: \; | Width: thick space (5/18 em) | Use Case: Grouping in formulas
  • Command: \! | Width: negative thin space | Use Case: Tightening: \( \sqrt{\,x} \)
  • Command: \quad | Width: 1 em | Use Case: Between equations
  • Command: \qquad | Width: 2 em | Use Case: Wider separation
    The most common use: always put \, before the differential in integrals:
% Without thin space (cramped)
$\int f(x)dx$

% With thin space (correct)
$\int f(x)\,dx$

\( \int f(x)dx \) (cramped) vs. \( \int f(x)\,dx \) (correct)

Dots

  • Command: \ldots | Output: \( \ldots \) | Use: Low dots (lists: \( a_1, a_2, \ldots, a_n \))
  • Command: \cdots | Output: \( \cdots \) | Use: Centered dots (sums: \( a_1 + a_2 + \cdots + a_n \))
  • Command: \vdots | Output: \( \vdots \) | Use: Vertical dots (matrices)
  • Command: \ddots | Output: \( \ddots \) | Use: Diagonal dots (matrices)
  • Command: \dots | Output: context-dependent | Use: amsmath auto-selects the right dots

    Tip: With amsmath loaded, \dots is smart: it produces low dots after commas and centered dots after \( + \), \( = \), etc. Use \dots by default and override with \ldots/\cdots only when needed.

Text in Math Mode

Text within math mode should use \text{...} (from amsmath):

% WRONG: "if" is italic
$x = 1 if n > 0$

% RIGHT: "if" is upright
$x = 1 \text{ if } n > 0$

<!--M102-->

\( x = 1 if n > 0 \) (wrong) \( x = 1 \text{ if } n > 0 \) (right) $$ f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x^2 & \text{if } x < 0 \end{cases} $$

Accents and Decorations

  • Command: \hat | Output: \( \hat{a} \) | Command: \bar | Output: \( \bar{a} \)
  • Command: \tilde | Output: \( \tilde{a} \) | Command: \vec | Output: \( \vec{a} \)
  • Command: \dot | Output: \( \dot{a} \) | Command: \ddot | Output: \( \ddot{a} \)
  • Command: \widehat | Output: \( \widehat{abc} \) | Command: \widetilde | Output: \( \widetilde{abc} \)
  • Command: \overline | Output: \( \overline{ab} \) | Command: \underline | Output: \( \underline{ab} \)
  • Command: \overbrace | Output: \( \overbrace{abc} \) | Command: \underbrace | Output: \( \underbrace{abc} \)

    Putting It All Together

Here are real-world examples combining the techniques from this chapter:

Euler’s identity:

<!--M103-->

$$ e^{i\pi} + 1 = 0 $$

Binomial theorem:

<!--M104-->

$$ (x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k $$

Cauchy-Schwarz inequality:

<!--M105-->

$$ \left| \sum_{i=1}^{n} a_i b_i \right|^2 \leq \left( \sum_{i=1}^{n} a_i^2 \right) \left( \sum_{i=1}^{n} b_i^2 \right) $$

Gaussian integral:

<!--M106-->

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

Exercises

  1. Typeset the following equations:

    1. \( \displaystyle \frac{d}{dx}\left[\frac{f(x)}{g(x)}\right] = \frac{f'(x)g(x) – f(x)g'(x)}{[g(x)]^2} \) (Quotient rule)
    2. \( \displaystyle \oint_C \vec{F} \cdot d\vec{r} = \iint_S (\nabla \times \vec{F}) \cdot d\vec{S} \) (Stokes’ theorem)
    3. \( \displaystyle e = \sum_{n=0}^{\infty} \frac{1}{n!} \)
  2. Typeset a 3-case piecewise function using the cases environment.

  3. Write the Taylor series expansion of \( \sin(x) \) around \( x = 0 \), using proper dots notation.

  4. Find and fix three errors in this code:

     <!--M9-->
     $\int_0^1 f(x)dx$
     $sin(x) + cos(x)$