7

I want to create this:

A table with brackets on either side of text

The following code does this, but produces a number of overfull hbox and vbox statements in the log -- how can I get rid of those? On the other hand, if there is a better way, I'd like to know that, too.

\documentclass[12pt]{article}

\usepackage{array,multirow}

\renewcommand{\arraystretch}{1}

\newlength{\tblboxvsize}

%% Adjust for a redefined \arraystretch
\makeatletter
\def\getcellvsize{% 
    \setlength{\tblboxvsize}{\ht\@arstrutbox}%
    \addtolength{\tblboxvsize}{\dp\@arstrutbox}%
}
\makeatother

\newcommand{\bracenote}[4][8em]{%[width of \vcenter]; l/r; n-rows; text
    \getcellvsize
    \multirow{#3}{#1}{%
        \(
            \ifx#2l%
                \vcenter{%
                    \hsize#1%
                    \raggedright
                    \noindent
                    #4
                }%
                \left\{
            \else
                \left.
            \fi
            \vcenter to #3\tblboxvsize{}%
            \ifx#2r%
                \right\}%
                \vcenter{%
                    \hsize#1%
                    \raggedright
                    \noindent
                    #4%
                }%
            \else
                \right.
            \fi
        \)
    }%
}

\parindent0pt%

\begin{document}

\begin{tabular}{@{}ll@{}ll@{}}
\bracenote[6em]{l}{6}{Some text about all six}& First&\bracenote{r}{4}{Some text about the first four}\\
& Second is rather long& \\
& Third& \\
& Fourth&&\bracenote[10em]{r}{3}{Something about the last three}\\
& Fifth& \\
& Sixth& 
\end{tabular}

\end{document}
2
  • It's clear that the entire structure is too wide for the text block. How can you get rid of that? It depends on what you're willing to do (wider margins, smaller fonts, or change the structure altogether).
    – Werner
    Jun 7, 2013 at 17:49
  • Looks like the schemata package could be of interest...
    – cgnieder
    Jun 7, 2013 at 17:54

2 Answers 2

1

Here is a construction that produces similar output, but doesn't require any packages:

enter image description here

The upper display is your original construction, while the lower one is provided by the code below:

\documentclass[12pt]{article}

\begin{document}
\[
  \parbox{5em}{\small\raggedright%
    Some text about all six}
  \left\{\begin{array}{@{}l@{}}
    \left.\kern-\nulldelimiterspace\begin{tabular}{@{}l@{}}
      First \\
      Second is rather long \\
      Third \\
      Fourth
    \end{tabular}\hspace*{2\tabcolsep}\right\}\parbox{15em}{\small\raggedright%
      Some text about the first four} \\[-\normalbaselineskip]
    \left.\kern-\nulldelimiterspace\begin{tabular}{@{}l@{}}
      \phantom{Fourth} \\
      Fifth \\
      Sixth
    \end{tabular}\hspace*{2\tabcolsep}\right\}\parbox{15em}{\small\raggedright%
      Something about the last three}
  \end{array}\right.\kern-\nulldelimiterspace
\]

\end{document}

Each description-text is set in a \parbox of fixed width using a smaller font (\small). You can add the horizontal spacing or manipulate the box widths as you like, depending on the desired outcome.

1
  • Thanks -- something to think about. On the whole, however, I prefer my approach as it is easier to code the table (I have rather a lot of them to do) and troubleshoot. I am still curious, however, about the source of the overfull hboxes and vboxes. I suspect that it is something to do with the braces themselves, but have not been able to diagnose the origin of the problem.
    – sgmoye
    Jun 7, 2013 at 21:17
1

Although I am still not sure of why this is a solution, nonetheless it is. The solution was to use the * argument for the width in multirow. This also required some changes to the the argument to \begin{tabular}. Why this solves the problem of overfull hboxes and vboxes is still a mystery.

\documentclass[10pt]{article}

\usepackage{multirow}

\renewcommand{\arraystretch}{1}

\newlength{\tblboxvsize}

%% Adjust for a redefined \arraystretch
\makeatletter
\def\getcellvsize{% 
    \setlength{\tblboxvsize}{\ht\@arstrutbox}%
    \addtolength{\tblboxvsize}{\dp\@arstrutbox}%
}
\makeatother

\newcommand{\bracenote}[4][8em]{%[width of \vcenter]; l/r; n-rows; text
    \getcellvsize
    \multirow{#3}{*}{%
        \(
            \ifx#2l%
                \vcenter{%
                    \baselineskip1.2em
                    \hsize#1%
                    \raggedright
                    \noindent
                    #4
                }%
                \left\{
            \else
                \left.
            \fi
            \vcenter to #3\tblboxvsize{}%
            \ifx#2r%
                \right\}%
                \vcenter{%
                    \hsize#1%
                    \baselineskip1.2em
                    \raggedright
                    \noindent
                    #4%
                }%
            \else
                \right.
            \fi
        \)
    }%
}

\parindent0pt%

\begin{document}

\begin{tabular}{@{}l@{}l@{}l@{}}
\bracenote[6em]{l}{6}{Some text about all six}& First&\bracenote{r}{4}{Some text about the first four}\\
& Second is rather long& \\
& Third& \\
& Fourth&\quad\bracenote[10em]{r}{3}{Something about the last three}\\
& Fifth& \\
& Sixth& 
\end{tabular}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .