Auto adjustable brackets “[], {}, (), ||, 〈〉” in LaTeX
In this tutorial, I will show you how to convert different types of brackets into auto-adjustable brackets. This means a bracket that will automatically increase or decrease its size according to the height of the content inside it.
In LaTeX, you use different types of brackets which are:
- Parentheses ( )
- Square brackets [ ]
- Curly brackets { }
- Angle brackets ⟨ ⟩
To make these brackets auto-adjustable you need to write extra commands \left and \right while writing these brackets. As you normally write parentheses as (x), now they should be written as \left(x\right).
\documentclass{article}
\begin{document}
\begin{center}
\section*{All types of Auto-adjustable brackets}
\end{center}
Parentheses:
$$ 2\left(\frac{1}{x^2 - 1}\right) $$
Square bracket:
$$ 2\left[\frac{1}{x^2 - 1}\right] $$
Curly bracket:
$$ 2\left\{\frac{1}{x^2 - 1}\right\} $$
Angle bracket:
$$ 2\left\langle\frac{1}{x^2 - 1}\right\rangle $$
Absolute value (pipe):
$$ 2\left|\frac{1}{x^2 - 1}\right| $$
Floor function:
$$ 2\left\lfloor\frac{1}{x^2 - 1}\right\rfloor $$
Ceiling function:
$$ 2\left\lceil\frac{1}{x^2 - 1}\right\rceil $$
\end{document}Output:

Brackets on one side
Now there might be a case where you just need a bracket to show up on one side not the other. In this case, to not display the bracket symbol you have to use a period (.) with \left or \right, It matters which side bracket you don’t want to display.
If I want to get an output like [x then I have to write like this \left[ x \right., and to get this x] I have to use \left. x \right].
\documentclass{article}
\begin{document}
\begin{center}
\section*{Auto-adjustable brackets on one side}
\end{center}
Parentheses:
$$ 2\left(\frac{1}{x^2 - 1}\right. $$
Square bracket:
$$ 2\left[\frac{1}{x^2 - 1}\right. $$
Curly bracket:
$$ 2\left\{\frac{1}{x^2 - 1}\right. $$
Angle bracket:
$$ 2\left\langle\frac{1}{x^2 - 1}\right. $$
Calculus:
$$ \left. \frac{dy}{dx} \right|_{x=1} $$
\end{document}Output:

Leave a Reply