I'm a beginner trying to do an brace inside a table, that is spanning multiple rows.
I assume the best way to achieve this is to do a two-row tabular environment, with an array environment for the lower line inside a multiple row. My code for doing this would be:
\begin{tabular}{ l c r }
$T=0$ & $T=1$ & $T=2$ \\
$-1$ & \multicolumn{2}{l}{$\left\{
\begin{array}{l l}
0 & R\\
1 & 0 \\
\end{array} \right.$} \\
\end{tabular}
Now, the result doesn't quite look like what I want, in the sense that the last column of the array block is not aligned with the last column of the table ( the $T=2$
…). I could always push those a little bit left using ~~~
, but is there an easier, more elegant way to have a similar result?
Best Answer
For this kind of stuff I find it best to use
\tikzmark
:I was not sure where you wanted the brace, so the brace below might not be where you want it. But do the table as you normally would and get the text in the correct spot. Include a
\tikzmark{<nameA>}
and\tikzmark{<nameB>}
to mark the location of the two end points of the brace. Then provide the name of those two marks to\DrawVerticalBrace
to do the actual drawing.Notes:
This does require two runs. First one to determine the locations, and the second to do the drawing.
The
\tikzmark
is from Adding a large brace next to a body of text.Code: