Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

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

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer
    
Great solutions here, I will accept this one, as it's the most simple one, concerning flexibility and LOC. –  qqilihq Jun 11 at 18:26

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.

share|improve this answer
    
Thank you for your answer, however I noticed some limitations, see edit2 in question. Any ideas for that? –  qqilihq Jun 11 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 Jun 11 at 18:04
\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

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

Your Answer

 
discard

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.