Introduction to Delimiters in LaTeX
In mathematics, brackets, parentheses, and braces (collectively known as delimiters) are essential for grouping terms, defining intervals, and clarifying the order of operations. While you can simply type (x+y) in a LaTeX math environment, you will quickly notice that standard keyboard characters don't always "stretch" to fit complex expressions like fractions or matrices.
In this guide, you will learn how to use basic delimiters, how to make them scale automatically to fit your content, and how to use specialized mathematical symbols like floor and ceiling brackets.
Basic Delimiters
The most common delimiters can be typed directly from your keyboard. However, because LaTeX uses certain characters for its own syntax, there is one major exception: curly braces.
Standard Parentheses and Square Brackets
For simple expressions, you can use the standard keys:
- Parentheses:
( ) - Square Brackets:
[ ]
Curly Braces
In LaTeX, the curly braces { } are reserved for defining commands and grouping arguments. To display them in a mathematical formula, you must escape them with a backslash.
| Delimiter Type | LaTeX Code | Output Example |
|---|---|---|
| Parentheses | (x + y) | $(x+y)$ |
| Square Brackets | [x + y] | $[x+y]$ |
| Curly Braces | \{ x + y \} | ${x+y}$ |
Example 1: Basic Usage
$ (a + b)^2 = a^2 + 2ab + b^2 $
$ A = \{ 1, 2, 3, 4 \} $
$ I = [0, 1] $Note: Always remember to "escape" curly braces with a backslash
\{ \}when you want them to appear in your document. Forgetting the backslash will likely result in an error or the braces simply disappearing.
Automatic Scaling with \left and \right
One of the most common issues beginners face is "small" brackets surrounding "tall" expressions. If you place a fraction inside standard parentheses, the parentheses will remain at the height of a single line of text, which looks unprofessional and is hard to read.
To solve this, LaTeX provides the \left and \right commands. When placed before a delimiter, these commands tell LaTeX to calculate the height of the enclosed content and scale the delimiters accordingly.
Syntax Rules
- Every
\leftmust have a corresponding\right. - They must appear in pairs, even if the delimiters are different (e.g.,
\left( ... \right]). - They must be used within a math environment.
Example 2: Comparing Standard vs. Scaled Delimiters
% This looks cramped and incorrect
$ ( \frac{1}{2} ) $
% This scales perfectly
$ \left( \frac{1}{2} \right) $
% Works with braces and brackets too
$ \left\{ \sum_{i=1}^{n} i^2 \right\} $Invisible Delimiters
Sometimes you only want a delimiter on one side. A classic example is a piecewise function or a vertical bar for evaluation. In these cases, you can use a period . to create an "invisible" delimiter.
Example 3: Using a Null Delimiter
$ \left. \frac{df}{dx} \right|_{x=0} $In this example, \left. tells LaTeX there is a starting point for scaling, but nothing is drawn. The \right| then draws a tall vertical bar that matches the height of the fraction.
Manual Sizing for Fine Control
While \left and \right are powerful, they aren't always perfect. Sometimes they make brackets slightly too large, or you may have nested delimiters where you want the outer ones to be slightly bigger than the inner ones for clarity.
The amsmath package (and standard LaTeX) provides four manual sizing commands:
\bigl/\bigr(Smallest increase)\Bigl/\Bigr\biggl/\biggr\Biggl/\Biggr(Largest increase)
The l stands for "left" and the r stands for "right." These are useful because they don't require a matching pair, allowing for more flexibility in complex layouts.
Example 4: Nested Delimiters
$ \Bigl( x + \bigl( y + (z+w) \bigr) \Bigr) $Specialized Mathematical Delimiters
Beyond standard brackets, advanced mathematics requires specific symbols like those used for sets, vectors, or rounding functions.
| Name | Left Code | Right Code | Output Example |
|---|---|---|---|
| Angle Brackets | \langle | \rangle | $\langle \psi \rangle$ |
| Floor Brackets | \lfloor | \rfloor | $\lfloor x \rfloor$ |
| Ceiling Brackets | \lceil | \rceil | $\lceil x \rceil$ |
| Absolute Value | ` | or\lvert` | ` |
| Norm (Double bar) | | or \lVert | | or \rVert | $|x|$ |
Best Practice: While you can use the pipe key
|for absolute values, using\lvertand\rvert(from theamsmathpackage) is preferred. It ensures the spacing around the symbol is typographically correct for "left" and "right" boundaries.
Example 5: Advanced Delimiters in Action
\usepackage{amsmath}
% ...
$ \langle \vec{u}, \vec{v} \rangle = 0 $
$ \text{The ceiling of } \pi \text{ is } \lceil \pi \rceil = 4 $
$ \left\| \frac{a}{b} \right\| \leq \frac{\|a\|}{\|b\|} $Common Pitfalls and Best Practices
To keep your LaTeX code clean and error-free, keep these tips in mind:
- The "Unmatched" Error: If you get an error saying
Extra \rightorMissing \right, check your\leftand\rightpairs. For every\left, there must be a\rightin the same math group. - Avoid Over-Scaling: Don't use
\leftand\rightfor every single parenthesis. For simple variables like $(x+y)$, standard parentheses are cleaner and more efficient. - Use amsmath: Always include
\usepackage{amsmath}in your preamble. It improves the spacing of delimiters and provides the\lvertand\lVertcommands. - Readability: If you have multiple nested groups, use manual sizing (
\bigl,\Bigl) to help the reader distinguish which opening bracket belongs to which closing bracket.
Summary Table of Sizes
| Command | Result for ( |
|---|---|
( | Normal size |
\bigl( | Slightly larger |
\Bigl( | Noticeably larger |
\biggl( | Large |
\Biggl( | Very large |
By mastering these commands, you can ensure that your mathematical expressions are not only accurate but also professionally typeset and easy to read.
