5

I have a table with a common label for multiple lines. Using bigdelim I place brackets to give explanations. My explanation has too much text for one line, so I would like it to break over multiple lines. However, I have no idea how I could enable line breaks (preferably automatically, or manual, if there is no other way). My MWE:

\documentclass{scrbook}
\usepackage{multirow}
\usepackage{bigdelim}
\begin{document}
\begin{tabular}{l p{8cm}}
    \hline
    One & \rdelim]{3}{*}[And here we have some long text, which I want to wrap over multiple lines please. Is that possible?] \\
    Two \\
    Three \\
    \hline
\end{tabular}
\end{document}

Current result:

bigdelimExample

[edit] After applying the suggestion given in the comments and changing the enclosing brackets for the text from [ to {, I have the following result:

bigdelimExample2

[edit2] Thank you for your suggestions! When trying it out however, I found the following limitations which makes it impossible, to implement them as suggested (apologies if MWE was too minimal):

  • There are even/odd numbers of rows which I need to group, the given solutions only work for odd amounts.
  • The bracket's length grows based on the amount of text. Sometimes I only a little amount of text, which means, that the bracket does not span all necessary rows.

Any solution to fix that?

2
  • For a starter, you need to use {} braces, not [] brackets to enclose the delimited text. Commented Jun 11, 2014 at 16:32
  • Thank you, this gives me line breaks, however the result is not what I would expect (edit coming).
    – qqilihq
    Commented Jun 11, 2014 at 16:35

3 Answers 3

6

I don't really know the purpose of this, but here's a solution:

\documentclass[draft]{scrbook}
\usepackage{calc}
\usepackage{multirow}
\usepackage{bigdelim}
\begin{document}
\begin{tabular}{l p{8cm}}
\hline
One & 
  \rdelim]{3}{*}[\parbox{8cm-\tabcolsep-\widthof{$\Bigg]$}}{
    And here we have some long text, which I want to wrap 
    over multiple lines please. Is that possible?}] \\
    Two \\
    Three \\
    \hline
\end{tabular}
\end{document}

enter image description here

More simply, without multirow:

\documentclass[draft]{scrbook}
\usepackage{array}

\begin{document}

\begin{tabular}{l m{8cm}}
\hline
$\kern-\nulldelimiterspace\left.\begin{tabular}{@{}l@{}}
One \\
Two \\
Three \\
\end{tabular}\right]$ &
  And here we have some long text, which I want to wrap 
  over multiple lines please. Is that possible? \\
\hline
\end{tabular}
\end{document}

Of course, something can be hidden in a macro.

\documentclass[draft]{scrbook}
\usepackage{array}

\newcommand{\bracketedright}[1]{%
  $\kern-\nulldelimiterspace\left.\begin{tabular}{@{}l@{}}
  #1
  \end{tabular}\right]$% 
}

\begin{document}

\begin{tabular}{l m{8cm}}
\hline
\bracketedright{
  One \\
  Two \\
  Three 
} &
  And here we have some long text, which I want to wrap
  over multiple lines please. Is that possible? \\
\hline
\end{tabular}
\end{document}

enter image description here

1
  • Great solutions here, I will accept this one, as it's the most simple one, concerning flexibility and LOC.
    – qqilihq
    Commented Jun 11, 2014 at 18:26
2

How about the following as an alternative (I also provide a possibility to stretch the delimiter to match the left rather than the right construction):

enter image description here

\documentclass{scrbook}
\begin{document}
\begin{tabular}{l p{8cm}}
  \hline
  One & \raisebox{-\normalbaselineskip}[0pt][0pt]{$\left]\parbox{\dimexpr8cm-1em}{And here we have some long text, 
    which I want to wrap over multiple lines please. Is that possible?}\right.\kern-\nulldelimiterspace$} \\
  Two \\
  Three \\
  \hline
\end{tabular}

\bigskip

\begin{tabular}{l p{8cm}}
  \hline
  One & \raisebox{-1.5\normalbaselineskip}[0pt][0pt]{$\left]\parbox{\dimexpr8cm-1em}{And here we have some long text, 
    which I want to wrap over multiple lines please. Is that possible?}\right.\kern-\nulldelimiterspace$} \\
  Two \\
  Three \\
  Four \\
  \hline
\end{tabular}

\bigskip

\begin{tabular}{l p{8cm}}
  \hline
  One & \raisebox{-2\normalbaselineskip}[0pt][0pt]{$\left]\parbox{\dimexpr8cm-1em}{And here we have some long text, 
    which I want to wrap over multiple lines please. Is that possible?}\right.\kern-\nulldelimiterspace$} \\
  Two \\
  Three \\
  Four \\
  Five \\
  \hline
\end{tabular}

\bigskip

\begin{tabular}{l p{8cm}}
  \hline
  One & \raisebox{-2\normalbaselineskip}[0pt][0pt]{$\left]
    \begin{tabular}{@{}c@{}}\strut\\\strut\\\strut\\\strut\\\strut\end{tabular}\right.\kern-\nulldelimiterspace
    \parbox{\dimexpr8cm-1em}{And here we have some long text, 
      which I want to wrap over multiple lines please. Is that possible?}$} \\
  Two \\
  Three \\
  Four \\
  Five \\
  \hline
\end{tabular}

\end{document}

\raisebox{<raise>}[0pt][0pt]{<stuff>} removes the height/depth of <stuff>, so placing the \parbox on the second row allows it to fill above/below that specific row.

2
  • Thank you for your answer, however I noticed some limitations, see edit2 in question. Any ideas for that?
    – qqilihq
    Commented Jun 11, 2014 at 17:58
  • @qqilihq: I've added a way of stretching the delimiter to match the left rather than the right construction. The idea is to set a zero-width tabular and insert a bunch of \struts. I've also adjusted the \raisebox command to move the contents down (from One) to the middle of the tabular using a specific multiple of \normalbaselineskip.
    – Werner
    Commented Jun 11, 2014 at 18:04
1
\documentclass[draft]{scrbook}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}
\noindent
\begin{tabularx}{8cm}{@{} >{$}l<{$}  X @{}}\hline
  \left.\begin{tabular}{@{\kern-\nulldelimiterspace} l }
    One \\ Two \\ Three
  \end{tabular}\right]  
  & 
  And here we have some long text, which I want to wrap over multiple
  lines please. Is that possible? \\\hline
\end{tabularx}

\noindent
\begin{tabularx}{8cm}{@{} >{$}l<{$} X @{}}\hline
  \left.\begin{tabular}{@{\kern-\nulldelimiterspace} l }
    One \\ Two \\ Three \\ Four
  \end{tabular}\right]  
  & 
  And here we have some long text, which I want to wrap over multiple
  lines please. Is that possible? \\\hline
\end{tabularx}

\noindent
\begin{tabularx}{8cm}{@{} >{$}l<{$}  X @{}}\hline
  \left.\begin{tabular}{@{\kern-\nulldelimiterspace} l }
    One \\ Two 
  \end{tabular}\right]  
  & 
  And here we have some long text, which I want to wrap over multiple
  lines please. Is that possible? \\\hline
\end{tabularx}

\end{document}

enter image description here

4
  • This still produces an overfull \hbox as \hsize doesn't take the width of \left] into consideration.
    – Werner
    Commented Jun 11, 2014 at 17:53
  • Thank you for your answer, however I noticed some limitations, see edit2 in question. Any ideas for that?
    – qqilihq
    Commented Jun 11, 2014 at 17:57
  • @Werner: you want see it, it is 6pt which is the \tabcolsep!
    – user2478
    Commented Jun 11, 2014 at 18:02
  • @qqilihq: see edited answer
    – user2478
    Commented Jun 11, 2014 at 18:12

You must log in to answer this question.

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