\usepackage{amstext, amsmath}
\newcommand{\lcurly}[1]{$\left\{\begin{array}{l}  #1   \end{array} \right.$}
\newcommand{\rcurly}[1]{$\left. \begin{array}{l}  #1   \end{array} \right  \}$}
\newcommand{\slcurly}[1]{$\left\{   \shortstack{#1} \right.$}
\newcommand{\srcurly}[1]{$\left. \shortstack{#1} \right  \}$}

   \lcurly{1 \\ 2} \rcurly{Line 1 \\ Line 2} \vspace{1cm} \\    
   \slcurly{1 \\ 2}  \srcurly{Line 1\\ Line 2} \\

I have a need to create curly brackets, I managed to do that with above shown code. I am attaching a screenshot. When I use array the text is evenly distributed vertically but the bracket appears little bit farther. When I change array to stack the bracket appears closer but the text is not nicely aligned.

I was wondering if there is way to align the text as shown in the top image and make the bracket appear close like shown in the second part of the image. Thanks for your helpalt text


A quick fix would be to insert just some negative space before respectively after the array:

  \begin{array}{l}  #1   \end{array} \right.$}
  \begin{array}{l}  #1   \end{array}\hspace{-0.5em}\right  \}$}

In cases such as your second example \vcenter comes handy to vertically center objects:

\newcommand{\srcurly}[1]{$\left.\vcenter{\hbox{$\shortstack{#1}$}}\right \}$}

alt text

| improve this answer | |
  • 2
    Why not use \begin{array}{@{}l} and \begin{array}{l@{}}? – TH. Jan 16 '11 at 4:39
  • @TH.: Why not make an answer out of that? – Hendrik Vogt Jan 16 '11 at 10:03
  • @Hendrik: It'd be only a minor modification of Stefan's answer. I'm also not really sure I understand the use of this anyway. If the top line for the \lcurly is larger than the top line for the \rcurly, they're not going to match up. Something more like \newcommand\curly[1]{\ensuremath{\left\{\begin{array}{@{}ll@{}}#1\end{array}\right\}}} makes more sense to me. – TH. Jan 16 '11 at 10:11
  • @TH.: Makes more sense to me, too. Why not write that in your answer :-)? (stortstack even gives bad alignment of the text ...) – Hendrik Vogt Jan 16 '11 at 10:15

Per Hendrik's prodding =) here's how I would do this.

\curly{1 & \text{Line 1}\\
       2 & \text{Line 2}}

alt text

This has the advantage of keeping the lines aligned even if one part is larger than the others. My picture doesn't show it, but it also lines the vertical center of the array up with about half the x-height of the surrounding text. (TeX by Topic informs me that it's “\fontdimen22 of the font in family 2, the symbol font, in the current style,” just in case you were curious.)

| improve this answer | |

This seem to work also:

{\Schema[close]{0ex}{2ex}{\schemabox{1 Line 1\\2 Line 2}}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.