5

enter image description here

I'd like to produce two sets of curly brackets around three lines of text, one beneath the other and a short line in between on the left. Hope this is clear enough. Apologies for the terrible pic.

Guillaume Coatalen
  • 491
  • 1
  • 4
  • 11
  • Are there any other requirements like how this fits in with surrounding text? – Werner Dec 30 '14 at 23:26
  • No other requirements. The real problem is the line on the left right where the curly brackets meet, which is unusual. – Guillaume Coatalen Dec 30 '14 at 23:29
  • Please help us to help you and add a minimal working example (MWE) that illustrates your situation. That makes it easier to help and more likely that any help you receive will be relevant. – cfr Dec 30 '14 at 23:29
  • Is the line part of the text on the left? Or is it a line? It looks as if it is above the text on the left? – cfr Dec 30 '14 at 23:31
  • The line on the left is part of the text. – Guillaume Coatalen Dec 30 '14 at 23:33
  • Related? http://tex.stackexchange.com/questions/31668/dynamically-sized-brackets-parentheses-for-text?rq=1, http://tex.stackexchange.com/questions/110391/big-brackets-around-text?rq=1, http://tex.stackexchange.com/questions/119163/dual-big-brackets-around-text?rq=1 etc.? – cfr Dec 30 '14 at 23:33

4 Answers4

9

Is this something like you'd like to obtain?

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{center}
Some text on the left
$\begin{array}{@{}l@{}c@{}}
\quad&\left\{
  \begin{tabular}{@{}l@{}}
  A line \\
  A longer line \\
  Another
  \end{tabular}
\right\}
\\
\cmidrule{1-1}
&\left\{
  \begin{tabular}{@{}l@{}}
  A line \\
  A longer line \\
  Another
  \end{tabular}
\right\}
\end{array}$
\end{center}

\end{document}

enter image description here

A better implementation (but using low level commands), that should have no problems even when the two parts have different number of lines.

\documentclass{article}

\newcommand{\topbottombraced}[2]{%
  \raise.5ex\vtop{
    \vbox{%
      \hbox{$\left\{\begin{tabular}{@{}l@{}}#1\end{tabular}\right\}$}
      \vskip1pt
    }
    \vbox{%
      \vskip1pt
      \hbox{$\left\{\begin{tabular}{@{}l@{}}#2\end{tabular}\right\}$}
    }
  }%
}

\begin{document}

Some text on the left
\topbottombraced{
  A line \\
  A longer line \\
  And another
}{
  A line \\
  A longer line \\
  Another
}
\topbottombraced{
  A line \\
  A longer line \\
  A longer line \\
  A longer line \\
  And another
}{
  A line \\
  A longer line \\
  Another
}
\topbottombraced{
  A line \\
  A longer line \\
  And another
}{
  A line \\
  A longer line \\
  A longer line \\
  A longer line \\
  Another
}

\end{document}

enter image description here

egreg
  • 1,121,712
3

A solution with the blkarray package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}%
\usepackage{xcolor}

\begin{document}

\renewcommand{\arraystretch}{1.3}
\[
  \text{
\raisebox{3ex}{Shakespeare wrote}\quad
\begin{blockarray}{l}
\begin{block}{\{>{\enspace}l<{\,}\}}
Shall I compare thee to a summer's day?\\
Thou art more lovely and more temperate.\\
Rough winds do shake the darling buds of May,\\
And summer’s lease hath all too short a date.\\
Sometime too hot the eye of heaven shines,\\
And often is his gold complexion dimmed;\\
And every fair from fair sometime declines,\\
\end{block}
\begin{block}{\{>{\enspace}l<{\,}\}}
By chance, or nature’s changing course, untrimmed;\\
But thy eternal summer shall not fade,\\
Nor lose possession of that fair thou ow’st,\\
Nor shall death brag thou wand’rest in his shade,\\
When in eternal lines to Time thou grow’st.\\
So long as men can breathe, or eyes can see,\\
So long lives this, and this gives life to thee.\\
\end{block}\\
  \end{blockarray}}
\]

\end{document} 

enter image description here

Bernard
  • 271,350
2

This uses stacks, and has no problem at all if the top and bottom halves have different numbers of entries.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\begin{document}
This is baseline text
\strutlongstacks{T}%
\renewcommand\stackalignment{l}%
\stackunder[0pt]{\stackon[5pt]{}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
  first line\\second line\\third line}\right\}$}
}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
  first line\\second line of text\\third line\\fourth line}\right\}$}
\end{document}

enter image description here


In follow up comments, the OP inquired about the use of stacks in tabular. There arise only 2 quirks to doing so: 1) tabular redefines \baselineskip, and so the long-stack gap must be set to an explicit value, as in \setstackgap{L}{12pt}; and 2) I use \addstackgap{} to provide vertical buffer above/below the stack.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\setstackgap{L}{12pt} 
\begin{document}
\begin{tabular}{|c|c|}
\hline
\Centerstack{This is split\\ baseline text}
\strutlongstacks{T}%
\renewcommand\stackalignment{l}%
\addstackgap{%
\stackunder[-1pt]{\stackon[6pt]{}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
  first line\\second line\\third line}\right\}$}
}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
  first line\\second line of text\\third line\\fourth line}\right\}$}}
& blah blah\\
\hline
\end{tabular}
\end{document}

enter image description here

  • I still don't know what to do to get two lines on the left outside the curly brackets, something like This is\baseline text – Guillaume Coatalen Jan 03 '15 at 22:47
  • @GuillaumeCoatalen If you wanted to keep it as stacks, you could use \Centerstack[l]{This is\\ baseline text} prior to the braced material. You might need to tweak the stacking gaps [0pt] and [5pt] to suit. – Steven B. Segletes Jan 03 '15 at 23:44
  • Yes, but could I do it with a tabular environment? – Guillaume Coatalen Jan 04 '15 at 10:27
  • @GuillaumeCoatalen You may use stacks inside of tabular environments, but there is a catch. Long stacks have, by default, an interbaseline skip of \baselineskip, which is redefined by tabular. Thus, before entering the tabular, you must redefine the long stack gap in explicit units, such as \setstackgap{L}{12pt}. Does this help? – Steven B. Segletes Jan 04 '15 at 16:53
  • Do you think you could send an entire example which works?That'd be very helpful. – Guillaume Coatalen Jan 04 '15 at 17:34
  • I've tried this which doesn't work \documentclass{article}

    \usepackage{booktabs}

    \begin{document}

    \begin{center} \setstackgap{L}{12pt} Some text on the left $\begin{array}{@{}l@{}c@{}} \quad&\left{ \begin{tabular}{@{}l@{}} A line \ A longer line \ Another \end{tabular} \right} \ \cmidrule{1-1} &\left{ \begin{tabular}{@{}l@{}} A line \ A longer line \ Another \end{tabular} \right} \end{array}$ \end{center}

    \end{document}

    – Guillaume Coatalen Jan 04 '15 at 17:42
  • @GuillaumeCoatalen You forgot, in the preamble, \usepackage[usestackEOL]{stackengine}. Add that and your example compiles for me. You can find the package documentation at http://ctan.org/pkg/stackengine. – Steven B. Segletes Jan 04 '15 at 21:15
  • @GuillaumeCoatalen I've never chatted (don't know how), but I added an example of how to employ a stack in a tabular. – Steven B. Segletes Jan 05 '15 at 12:53
  • many thanks, bt unfortunately, I need to get two lines on the left outside the curly brackets, something like "This is//baseline text" – Guillaume Coatalen Jan 05 '15 at 20:13
  • @GuillaumeCoatalen Something more akin to my edit? – Steven B. Segletes Jan 05 '15 at 20:35
  • The only problem I've got now is that the text on the left outside the brackets and the brackets themselves are set in bold which I do not want. What should I do to get rid of the bold? – Guillaume Coatalen Oct 18 '15 at 10:49
  • @GuillaumeCoatalen Nothing I have done is setting text in bold. Your two options are therefore to find in your code where the bold is being set and "turn it off." If you can't find the trigger, you can always enclose the particular text in \textmd{} to override the bolding. – Steven B. Segletes Oct 18 '15 at 15:13
2

If you need math-mode inside braces:

\def\bmatrix#1{\left\{\matrix{#1}\right\}}
$$
a + b + \cdots + f = \matrix{\bmatrix{a\cr b\cr c}\cr\bmatrix{d\cr e\cr f}}
$$

If you need text-mode inside braces:

\def\btext#1{\left\{\vcenter{\halign{##\strut\hfil\cr#1\crcr}}\right\}}
$$
a + b + \cdots + f = \matrix{\btext{aha\cr be\cr cc}\cr \btext{dee\cr e\cr ef\cr}}
$$

If you need to center two braced texts with different lines:

\def\centertwo#1#2{\raise\fontdimen22\textfont2\vtop{\vbox{\hbox{$#1$}\kern0pt}\hbox{$#2$}}}
$$
a + b + \cdots + f = \centertwo {\btext{aha\cr be}} {\btext{dee\cr e\cr ef}}
$$
\bye

Note. Your question was not mention LaTeX as desired macro pckage. My macros work in plain TeX.

wipet
  • 74,238