[Tex/LaTex] Curly Brackets – How to change the space between text and brackets

brackets

\documentclass[fleqn,12pt,a4paper]{article}
\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  \}$}

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

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

Best Answer

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

\newcommand{\lcurly}[1]{$\left\{\hspace{-0.5em}%
  \begin{array}{l}  #1   \end{array} \right.$}
\newcommand{\rcurly}[1]{$\left.
  \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{\slcurly}[1]{$\left\{\vcenter{\hbox{$\shortstack{#1}$}}\right.$}
\newcommand{\srcurly}[1]{$\left.\vcenter{\hbox{$\shortstack{#1}$}}\right \}$}

alt text

Related Question