For example, if you want to compile {2, 4}{6} in LaTeX as the source code, it only prints 2,4 6. That’s why many new users may get confused. This tutorial explains the ways to write and use the curly brackets in LaTeX.
How to Write and Use the Curly Brackets in LaTeX
To get the curly brackets as an output, use \{ and \} rather than { and }. Let’s take a look at the following example to write the curly brackets:
\begin{document}
$\{$ 1, 2, 3, 4, 5, 6, 7, 8, 9, $\}$
\end{document}
Output:
Now, let’s take another example of a mathematical expression that contains the curly brackets:
\begin{document}
A: $\{$1, 2, 3, 4, ..., x$\}$ $\rightarrow$ $\{$1, 2, 3, 4, ..., m$\}$\\
Therefore:\\
A($X_b$) = $X_{b+1}$ for 1 $\le$ b < c \\
Y($X_c$) = $X_1$ \\
\end{document}
Output:
You can also use the curly brackets through \begin{cases} and amsmath \usepackage in the source code. Here is the following source code that you can use to create it in LaTeX:
\usepackage{amsmath}
\begin{document}
\begin{gather*}
P \colon \{1, 2, 3, \dots, k\} \rightarrow \{1, 2, 3, \dots, m\} \text{ such that}\\
\begin{cases}
P(X_a) = X_{a+1} & \text{for }1\le a<b\\
P(X_b) = X_1
\end{cases}
\end{gather*}
\end{document}
Output:
In case you want to use multiple curly brackets, it can become confusing. Use the source codes correctly as shown in the following:
\usepackage{amsmath}
\begin{document}
Set X =$\{$2,4,6$\}$ so the subsets of X are;\\
$\{$$\}$, $\{$2$\}$, $\{$4$\}$, $\{$6$\}$, $\{$2,4$\}$, $\{$4,6$\}$, $\{$2,4$\}$ and $\{$2,4,6$\}$.\\
\end{document}
Output:
Conclusion
Various elements are used to make a document in LaTeX. One of these elements is the curly bracket that is used for multiple reasons and different outputs in the document. That’s why we used some various example source codes so that you can better understand how to use these curly brackets in LaTeX.