# Align large vertical delimiters (brackets) to rows of a table?

I’m trying to typeset a table of data, with brackets (i.e. }) at the right-hand side to show a classification of the rows.  Something like:

-----------------------
| Aardvark | Armenia  |  \
|----------|----------|  |- things beginning with vowels
| Elephant | Ethiopia |  /
|----------|----------|
| Platypus | Portugal |  \
|----------|----------|  |- things beginning with consonants
| Zebra    | Zimbabwe |  /
-----------------------


The main data is in a tabular environment.  Is there a nice way to put the brackets on the right like this, aligned correctly with the rows?

Edit: if possible, I’d really prefer an approach which doesn’t interfere with how the table of data itself comes out.

-
check out the bigdelims package (part of multirow) - –  prettygully Apr 8 '11 at 2:59
You could also adapt this code, although that's probably overkill... –  Seamus Apr 8 '11 at 8:08
@prettygully: That looks like just the ticket! If you put it in an answer, I’ll accept it. @Seamus: hmm, that’s very nice — probably overkill here as you say, but I‘ll remember it for the future. –  Peter LeFanu Lumsdaine Apr 8 '11 at 16:05

You can use bigdelim from multirow to achieve this:

\documentclass{minimal}
\usepackage{multirow,bigdelim}
\begin{document}
\begin{tabular}{lll}
Aardvark & Armenia & \rdelim\{{2}{3mm}[things beginning with vowels] \\
Elephant & Ethiopia \\
Platypus & Portugal & \rdelim\{{2}{3mm}[things beginning with consonants] \\
Zebra  & Zimbabwe \\
text  & text & \rdelim\{{3}{3mm}[things beginning and ending with t] \\
text  & text \\
text  & text \\
\end{tabular}
\end{document}

-
\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{tabular}{@{}l}
$\left. \begin{tabular}{@{}*2{p{1.5cm}}} Aardvark & Armenia \\ Elephant & Ethiopia \end{tabular} \right\}\text{things beginning with vowels}$\\[\bigskipamount]
%
$\left. \begin{tabular}{@{}*2{p{1.5cm}}} Platypus & Portugal \\ Zebra & Zimbabwe \end{tabular} \right\}\text{things beginning with consonants}$
\end{tabular}

\end{document}


-
Thankyou — unfortunately this breaks up the structure of the table itself, which I really don’t want to do. –  Peter LeFanu Lumsdaine Apr 8 '11 at 15:57

One possible solution would be to nest tabular and array environments; in the following example I used a tabular with two columns; the first column will contain the tabular with the data and the second column will contain an array for the extensible braces and the text for the classification of the rows.

I also defined a command \MyLBrace (with two arguments) to typeset the brace; the first argument controls the height of the brace and the second one contains the text corresponding to the particular category; since the number of rows belonging to the same category is variable, some manual calculation will be needed to adjust the height of the braces.

A little example:

\documentclass{book}
\usepackage{amsmath}

\newcommand\MyLBrace[2]{%
\left.\rule{0pt}{#1}\right\}\text{#2}}

\begin{document}

\noindent\begin{tabular}{c@{}l}
\begin{tabular}{ll@{}}
Aardvark & Armenia \\
Elephant & Ethiopia \\
Platypus & Portugal \\
Zebra  & Zimbabwe \\
text  & text \\
text  & text \\
text  & text \\
\end{tabular}
&
$\begin{array}{l} \MyLBrace{3ex}{things beginning with vowels} \\ \MyLBrace{3ex}{things beginning with consonants} \\ \MyLBrace{4.4ex}{things beginning and ending with t} \end{array}$
\end{tabular}

\end{document}


-
ah, neat — a very nice “low-TeX” solution! I’ll probably go for bigdelims in the end as per @prettygully’s comment, but if that didn’t exist I’d definitely be going for this one. –  Peter LeFanu Lumsdaine Apr 8 '11 at 16:10