Vertical and horizontal curly brackets (braces) - Latex
This article introduces a way to make vertical and horizontal curly brackets (braces) with Latex.
This is a semi-automatic translation from the french version. Please comment if you find any translation errors. I will be happy to fix them, thanks!
Horizontal curly brackets
Curly brackets on a text
To display curly brackets on a text, it is possible to use the command \overbrace
:
5+5 = \overbrace{10_{10}}^{1010_2}
$$5+5 = \overbrace{10_{10}}^{1010_2}$$
Curly brackets under a text
The analogous command is \underbrace
:
5+5 = \underbrace{10_{10}}_{1010_2}
Vertical curly brackets
To display a vertical curly bracket on the left of a text, you can use the following command:
\left\{ 1+1=2
$$\begin{cases} 1+1=2\end{cases}$$
For a curly bracket on the right, you can use the \right
command.
But \left
and \right
are really useful when writing systems or functions. Here are 2 examples:
\left\{
\begin{array}{rcr}
4x + 8y & = & 54 \\
2x + 7y & = & 39
\end{array}
\right.
$$\begin{cases} 4x + 8y = & 54 \cr 2x + 7y = & 39 \end{cases}$$
Another example :
g(i,j) = \left\{
\begin{array}{ll}
255 & \mbox{si} f(i,j) \leq s \\
0 & \mbox{sinon}
\end{array}
\right.
$$g(i,j) =\begin{cases}255&\text{si}; f(i,j)\leq s\cr0 &\text{sinon.}\end{cases}$$
Alternatively, you can use the \begin{cases}
environment:
g(i,j) =
\begin{cases}
255 & \text{si} f(i,j) \leq s \\
0 & \text{sinon.}
\end{cases}