# How can I make three little curly braces for this table?

I have copied what I wrote in LaTeX and I will also attach a picture of what I want to achieve.

Desired result:

What I wrote so far:

\begin{center}
\begin{tabular}{ |p{1.5cm}||p{1.5cm}|p{1.5cm}|p{1.5cm}||p{1.5cm}| }
\hline
\multicolumn{5}{|c|}{Lepton Classification} \\
\hline
$l$ & $Q$ & $L_e$ & $L_\mu$ & $L_\tau$\\
\hline
$e$  & -1 & 1 & 0 & 0 \\
$\nu_e$ & 0 & 1 & 0 & 0\\
\hline
$\mu$ & -1 & 0 & 1 & 0 \\
$\nu_\mu$ & 0  & 0 & 1 & 0\\
\hline
$\tau$ & -1 & 0 & 0 & 1 \\
$\nu_\tau$ & 0  & 0 & 0 & 1\\
\hline
\end{tabular}
\end{center}


I looked up several posts. However, I could not adjust the solutions to my problem.

• Quick suggestion, please use \usepackage{multirow} and \multirow.... Sep 20 '21 at 9:33

Here is a way to do that with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{center}
\begin{NiceTabular}{ccccc}[first-row,first-col,vlines,cell-space-limits=3pt]
& \Block{1-5}{Lepton Classification} \\ \Hline
\RowStyle[bold]{}
& $l$ & $Q$ & $L_e$ & $L_\mu$ & $L_\tau$ \\ \Hline
\Block[l]{2-1}{First generation\hspace*{3mm}}
& $e$  & -1 & 1 & 0 & 0 \\
& $\nu_e$ & 0 & 1 & 0 & 0 \\ \Hline
\Block[l]{2-1}{Second generation\hspace*{3mm}}
& $\mu$ & -1 & 0 & 1 & 0 \\
& $\nu_\mu$ & 0  & 0 & 1 & 0 \\ \Hline
\Block[l]{2-1}{Third generation\hspace*{3mm}}
& $\tau$ & -1 & 0 & 0 & 1 \\
& $\nu_\tau$ & 0  & 0 & 0 & 1 \\ \Hline
\CodeAfter [sub-matrix/left-xshift=2.5mm,sub-matrix/extra-height=-4pt]
\SubMatrix{\lbrace}{2-1}{3-1}{.}
\SubMatrix{\lbrace}{4-1}{5-1}{.}
\SubMatrix{\lbrace}{6-1}{7-1}{.}
\end{NiceTabular}
\end{center}

\end{document}


You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

• Thanks you very much for your help! Sep 20 '21 at 16:31
• BTW, what do you mean by several compilations? I tried it and I get some errors, like "undefined control sequence". If you happen to know how it can be solved, it would be very useful ! Sep 20 '21 at 17:10
• During the first compilation, some informations are written in the aux file. They are used at the next compilation, etc. Some tools, such as latexmk, directly do the right number of compilations. If you use Overleaf, the right number of compilations is done. Sep 20 '21 at 17:22
• Remark about Overleaf: Overleaf has not the latest version of nicematrix. You should upload the latest version of the file nicematrix.sty in the repertory of your Overleaf project. You can find that file on the SVN server of TeXLive: www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty Sep 20 '21 at 17:23
• @somerandomguest: I have modified my answer. Sep 23 '21 at 16:38

A solution with NiceArray of nicematrix

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{nicematrix}
\begin{document}
$\NiceMatrixOptions{exterior-arraycolsep} \begin{NiceArray}{c@{\hspace*{2em}}cccccc}[cell-space-limits=3pt] && \Block{1-5}{\text{Lepton Classification}} &&&& \\ && l & Q & L_e & L_\mu & L_\tau \\ \Block{2-1}{\text{First generation}} && e & -1 & 1 & 0 & 0 \\ && \nu_e & 0 & 1 & 0 & 0 \\ \Block{2-1}{\text{Second generation}} && \mu & -1 & 0 & 1 & 0 \\ && \nu_\mu & 0 & 0 & 1 & 0 \\ \Block{2-1}{\text{Third generation}} && \tau & -1 & 0 & 0 & 1 \\ && \nu_\tau & 0 & 0 & 0 & 1 \CodeAfter \begin{tikzpicture} \foreach \x in {3,5,7} \draw (\x-|3) -- (\x-|last); \foreach \x in {4,5,6,7} \draw (2-|\x) -- (last-|\x); \draw (2-|3) rectangle (last-|last); \draw[decoration={brace}, decorate] ([shift={(-4pt,2pt)}]5-|2) -- ([shift={(-4pt,-2pt)}]3-|2); \draw[decoration={brace}, decorate] ([shift={(-4pt,2pt)}]7-|2) -- ([shift={(-4pt,-2pt)}]5-|2); \draw[decoration={brace}, decorate] ([shift={(-4pt,2pt)}]9-|2) -- ([shift={(-4pt,-2pt)}]7-|2); \end{tikzpicture} \end{NiceArray}$
\end{document}


• Hi, perhaps it is better if you shift, a bit, to the right the curly brackets. Sep 20 '21 at 11:41
• @Sebasiano I agree. Thank you for the comment. It is easy to adjust. Sep 20 '21 at 11:53
• @polyn , thank you so much for your solution, it's great! But it needs so much knowledge, bruhh! Still have to learn a lot! Sep 20 '21 at 16:36

I propose this solution with basic tools – the eqparbox and bigdelim packages:

\documentclass{article}
\usepackage{geometry}
\usepackage{bigdelim}
\usepackage{eqparbox}

\begin{document}

\begin{center}
\setlength{\extrarowheight}{3pt}
\begin{tabular}{l |wc{1.2cm}||wc{1.2cm}|wc{1.2cm}|wc{1.2cm}||wc{1.2cm}| }
\cline{2-6}
& \multicolumn{5}{|c|}{Lepton Classification} \\
\cline{2-6}
& $l$ & $Q$ & $L_e$ & $L_\mu$ & $L_\tau$\\
\cline{2-6}
\ldelim\{{2}{*}[\eqparbox{A}{First generation}] & $e$ & -1 & 1 & 0 & 0 \\
& $\nu_e$ & 0 & 1 & 0 & 0\\[1ex]
\cline{2-6}
\ldelim\{{2}{*}[\eqparbox{A}{Second generation\hspace*{1.5em}}] & $\mu$ & -1 & 0 & 1 & 0 \\
& $\nu_\mu$ & 0 & 0 & 1 & 0\\[1ex]
\cline{2-6}
\ldelim\{{2}{*}[\eqparbox{A}{Third generation}] & $\tau$ & -1 & 0 & 0 & 1 \\
& $\nu_\tau$ & 0 & 0 & 0 & 1\\
\cline{2-6}
\end{tabular}
\end{center}

\end{document}


• A warm thanks for the edit, @Sebastiano! Once more, I forgot to check if everything was OK… Sep 20 '21 at 11:35
• We here are a great community...and it is a very pleasure to help everyone. :-) Sep 20 '21 at 11:37
• @Bernard , Thank you so much for your solution! Could you please tell me how to adjust the braces a bit more, so that they are shifted a bit downwards? (Since now they do not exactly point where they are supposed to, they are slightly shifted upwards) Sep 20 '21 at 16:33
• At the end of each group, I added a vertical spacing of 1ex (\\[1ex]). You may change this value, or even suppress these spacings (in this case, each brace touches the next one)? Other tool: cheat a bit and use decimal values in \ldelim,, e.g. \ldelim\{ {2.25}{*}{…} Sep 20 '21 at 17:49

i used the \multirow commands (from the multirow package) on a 6th column on the left of your table (for your generations comments). using \cline{2-6} instead of \hline prevent from having horizontal lines above and below the generations cases.

I have also put your title (Lepton classification) into a different table so it is not surrounded by vertical lines like the rest of your table.

My code :

\begin{table}
\centering
\begin{tabular}{m{4cm}m{1cm}m{1cm}m{1cm}m{1cm}m{1cm}}
& \multicolumn{5}{c}{Lepton Classification} \\
\end{tabular}
\begin{tabular}{m{4cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|m{1cm}|}
\cline{2-6}
& $l$ & $Q$ & $L_e$ & $L_\mu$ & $L_\tau$\\
\cline{2-6}
\multirow{2}{*}{First Generation} & $e$  & -1 & 1 & 0 & 0 \\
& $\nu_e$ & 0 & 1 & 0 & 0\\
\cline{2-6}
\multirow{2}{*}{Second Generation} & $\mu$ & -1 & 0 & 1 & 0 \\
& $\nu_\mu$ & 0  & 0 & 1 & 0\\
\cline{2-6}
\multirow{2}{*}{Third Generation} & $\tau$ & -1 & 0 & 0 & 1 \\
& $\nu_\tau$ & 0  & 0 & 0 & 1\\
\cline{2-6}
\end{tabular}
\end{table}


Result :

• I don't know about the brackets though. Sep 20 '21 at 9:58