The nicematrix package
11 Delimiters in the preamble of the environment¶
In the environments with preamble ({NiceArray}, {pNiceArray}, etc.), it’s possible to put vertical delimiters directly in the preamble of the environment.1
The opening delimiters should be prefixed by the keyword \left and the closing delimiters by the keyword \right. It’s not mandatory to use \left and \right pair-wise.
All the vertical extensible delimiters of LaTeX are allowed.
Here is a example which uses the delimiters \lgroup and \rgroup.
$\begin{NiceArray}{\left\lgroup ccc\right\rgroup l}
1 & 2 & 3 &
4 & 1 & 6 &
7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2
\end{NiceArray}$
For this example, it would also have been possible to use the environment {NiceArrayWithDelims} (cf. 14.11) and the key last-col (cf. 9).
There is a particular case: for the delimiters (, [ and \{2, and the corresponding closing delimiters, the prefixes \left et \right are optional.3
Here is an example with a left delimiter \{ in a {NiceTabular} (remark the compatibility with the key t).
We define $f$ with\quad
\begin{NiceTabular}[t]{\{ll}
$f(x) = 0$ & if $x$ is non positive \\
$f(x) = 1-e^x$ & if $x$ is positive
On définit \(f\) par
When there are two successive delimiters (necessarily a closing one following by an opening one for another submatrix), a space equal to \enskip is automatically inserted.
$\begin{pNiceArray}{(c)(c)(c)}
a_{11} & a_{12} & a_{13} \\
a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pNiceArray}$
For more complex constructions, in particular with delimiters spanning only a subset of the rows of the array, one should consider the command \SubMatrix available in the \CodeAfter (and the \CodeBefore). See the section 12.2.
1 This syntax is inspired by the extension blkarray.
2 For the braces, the protection by a backslash is mandatory (that’s why we have written \{).
3 For the delimiters [ and ], the prefixes remain mandatory when there is a conflict of notation with the square brackets for the options of some descriptors of columns.