The term fences refers parentheses, brackets, and braces - generally, things that enclose numbers and variables. On this page, we will learn how to typeset different kinds of fences, and to resize fences so that they fit taller expressions in display mode, like fractions or integrals.
Commands for fences
First, let's go over how to typeset different types of fences. Some can be typed as usual, others require special commands.
Regular-sized parentheses with a fraction in display mode:
The commands \left and \right placed on their respective fences will cause the fences to resize to fit the contents. You can add the examples picture above to your own document:
Note that both \left and \right must be used!
For example, try adding the following code to your project and compiling the preview:
Overleaf does compile the Preview, but gives an error message noting that there is no matching \right. While the left parenthesis is resized, the right one is not.
We could add \left and \right to the first set of parentheses, around (x + 1). However, this would not make any visible difference, since x + 1 is of a normal line height.
Note on the other hand, that while \left and \right must be used together, the fences themselves can be mixed and matched.
For example, if we want to write the half-open interval from 1/2 to 1 (including 1/2, excluding 1), we can achieve this with the same \left and \right commands:
Even though the parentheses are different, they are both properly resized. The parentheses themselves are characters, unlike in other instances where we were matching opening and closing tags.
Now that we know how to group items in a single math expression, we will learn a way to group and organize multiple equations or expressions.