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.

6
  • Are there any other requirements like how this fits in with surrounding text? Commented Dec 30, 2014 at 23:26
  • No other requirements. The real problem is the line on the left right where the curly brackets meet, which is unusual. Commented Dec 30, 2014 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. Commented Dec 30, 2014 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? Commented Dec 30, 2014 at 23:31
  • The line on the left is part of the text. Commented Dec 30, 2014 at 23:33

4 Answers 4

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

3
  • Excellent! except that I don't want the dash after "left". Commented Dec 30, 2014 at 23:36
  • @GuillaumeCoatalen: For equivalently spaced {...} (when A longer line differs from top/bottom), use a fixed-width column like p{7em} for the inner tabulars. Commented Dec 30, 2014 at 23:40
  • @GuillaumeCoatalen I've added a new implementation with an easier syntax Commented Dec 30, 2014 at 23:57
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

2
  • Only if the number of lines is the same. Commented Dec 31, 2014 at 0:58
  • @egreg: Using \raisebox, you can do what you want, I guess. Commented Dec 31, 2014 at 1:07
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.

4
  • One last thing. Is it possible to have two lines instead of one on the left, outside the brackets? Commented Dec 31, 2014 at 10:52
  • Do you mean $$\matrix {a\cr b} = \centertwo {...}{...}$$ ? Commented Dec 31, 2014 at 11:44
  • Where does that fit in? And which package do I need to use? Could you give me the whole code? Commented Jan 1, 2015 at 12:31
  • @GuillaumeCoatalen This is whole code. You needn't any package. Commented Jan 5, 2015 at 14:15
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

13
  • 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 Commented Jan 3, 2015 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. Commented Jan 3, 2015 at 23:44
  • Yes, but could I do it with a tabular environment? Commented Jan 4, 2015 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? Commented Jan 4, 2015 at 16:53
  • Do you think you could send an entire example which works?That'd be very helpful. Commented Jan 4, 2015 at 17:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.