[Tex/LaTex] Curly brackets around a table

bracestables

I would like to have braces on the left side of a table (either that or on the right side) and bellow the same table.

What I have got is

$
m-Mal 
\underbrace{
  \left\{\begin{tabular}{|l|l|l|l|}\hline
   1+1 & 1+2 & ... & 1+n \\ \hline
   2+1 & 2+2 & ... & 2+n \\ \hline
   ... & ... & ... & ... \\ \hline
   m+1 & m+2 & ... & m+n \\ \hline
   \end{tabular}
   }_{n-Mal}
$

But the problem is that the underbrace goes too much to the left:

image

Ideally, the \underbrace would end where the first column starts.

Best Answer

Here's on option, with some modifications to your current arrangement:

enter image description here

\documentclass{article}
\begin{document}
\[
  m-Mal 
  \underbrace{
  \left\{\begin{tabular}{|l|l|l|l|}\hline
   1+1 & 1-2 & ... & 1+n \\ \hline
   2+1 & 2+2 & ... & 2+n \\ \hline
   ... & ... & ... & ... \\ \hline
   m+1 & m+2 & ... & m+n \\ \hline
   \end{tabular}\right.
   }_{n-Mal}
\]
\[
  % Store contents in \box0
  \setbox0=\hbox{$\begin{array}{|*{4}{c|}}\hline
    1+1 & 1-2 & \cdots & 1+n \\ \hline
    2+1 & 2+2 & \cdots & 2+n \\ \hline
    \cdots & \cdots & \cdots & \cdots \\ \hline
    m+1 & m+2 & \cdots & m+n \\ \hline
    \end{array}$}
  m-Mal\left\{\vphantom{\usebox0}\right.\kern-\nulldelimiterspace
  \underbrace{\usebox0}_{n-Mal}
\]
\end{document}

I've used

  • array instead of tabular since the content seemed math-related;
  • \cdots instead of ...;
  • a column specification that is easily identifiable and changeable (|*{4}{c|});
  • a box to store the entire structure (\box0), then used it to insert the left brace at the appropriate size (via a \vphantom). This leaves you to use a regular \underbrace to obtain the correct length.

A minor correction in terms of spacing is required to adjust for the "missing" right delimiter \right..

Related Question