TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 20 down vote accepted

You can use bigdelim from multirow to achieve this:

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} 
share|improve this answer

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:




    Aardvark & Armenia \\
    Elephant & Ethiopia \\
    Platypus & Portugal \\
    Zebra  & Zimbabwe \\
    text  & text \\
    text  & text \\
    text  & text \\
    \MyLBrace{3ex}{things beginning with vowels} \\ 
    \MyLBrace{3ex}{things beginning with consonants} \\
    \MyLBrace{4.4ex}{things beginning and ending with t} 


share|improve this answer
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


    Aardvark & Armenia \\
    Elephant & Ethiopia 
  \right\}\text{things beginning with vowels}$\\[\bigskipamount]
    Platypus & Portugal \\
    Zebra  & Zimbabwe
  \right\}\text{things beginning with consonants}$


enter image description here

share|improve this answer
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

Here's an expansion upon prettygully's answer that lets you have line breaks and defines a new command for it:


  \begin{tabularx}{0.75\textwidth}{>{$}l<{$} l l}
    \text{Complexity} & Growth rate \\ \cline{1-2}
    O(1)              & None\\
    O(log n)          & Logarithmic\\
    O(n^k)            & Polynomial\\
    O(n)              & Linear & \multibrace{3}{4.6cm}{
                                  All of these are special cases of polynomials,
                                  $n^1, n^2$ and $n^3$ respectively
                                } \\
    O(n^2)            & Quadratic\\
    O(n^3)            & Cubic\\
    O(k^n)            & Exponential\\
    O(n!)             & Factorial\\
  \caption{A number of common complexities and their equivalent growth rates}

The first parameter is the number of lines that the bracket should occupy, and the second parameter is the width of the text on the right of the bracket.

The result looks something like this: Screenshot of the table

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.