11

How can I add curly braces around both sides of a cases environment which contains text?

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{equation*}
\hat{C}(\hat{S},1) = \frac{1}{E} C(S,T) =
\begin{cases}
0 &\text{ if } S<E,\\[1ex]
\frac{S}{2E} &\text{ if } S=E,\\[1ex]
\frac{S}{E} &\text{ if } S>E.
\end{cases}
\end{equation*}
\end{document}
7

Here, I replace the cases environment with a \left\{\!\begin{aligned}...\end{aligned}\right\}. The \! seems necessary to overcome a small space introduced, I think by the leading &.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{equation*}
\hat{C}(\hat{S},1) = \frac{1}{E} C(S,T) =
\left\{\!\begin{aligned}
&0 &\text{ if } S<E,\\[1ex]
&\frac{S}{2E} &\text{ if } S=E,\\[1ex]
&\frac{S}{E} &\text{ if } S>E.
\end{aligned}\right\}
\end{equation*}
\end{document}

enter image description here

If one wanted to preserve the \textstyle of the cases environment,

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{equation*}
\hat{C}(\hat{S},1) = \frac{1}{E} C(S,T) =
\left\{\!\begin{aligned}
&0 &\text{ if } S<E,\\[1ex]
&\textstyle\frac{S}{2E} &\text{ if } S=E,\\[1ex]
&\textstyle\frac{S}{E} &\text{ if } S>E.
\end{aligned}\right\}
\end{equation*}
\end{document}

enter image description here

| improve this answer | |
  • How can you use that if you want the equation* environment to allow alignment as well? Edit: I found. We can just use \begin{aligned} directly after \begin{equation*}. – Felix Crazzolara Feb 23 at 19:29
  • @FelixCrazzolara That is correct: equation* plus aligned. – Steven B. Segletes Feb 23 at 19:41
4

You can simply use the (d)rcases environment from mathtools.

Also, I think it's better to use \widehat with capital letters.

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage{amssymb}

\begin{document}

\begin{equation*}
  \widehat{C}(\widehat{S},1) = \frac{1}{E} C(S,T) =
  \begin{rcases}
    \begin{dcases}
      0 & \text{ if } S<E, \\
      \frac{S}{2E} & \text{ if } S=E, \\
      \frac{S}{E} & \text{ if } S>E.
    \end{dcases}
  \end{rcases}
\end{equation*}

\end{document} 

enter image description here

| improve this answer | |
  • Note that this does not always result in the left and right braces having the same height. – jmd_dk Jun 5 '17 at 15:19
  • 1
    @jmd_dk: I never met the case. This isn't statistically significant, though… – Bernard Jun 5 '17 at 15:30
  • @Bernard Very helpful, thank you. +1 – Zubin Mukerjee Apr 9 at 22:03
3

You can exploit the \newcases feature in mathtools:

\documentclass[12pt]{article}
\usepackage{amsmath,mathtools}
\usepackage{amssymb}

\makeatletter
\newcases{lrdcases}
  {\quad}
  {$\m@th\displaystyle{##}$\hfil}
  {$\m@th\displaystyle{##}$\hfil}
  {\lbrace}
  {\rbrace}
\newcases{lrdcases*}
  {\quad}
  {$\m@th\displaystyle{##}$\hfil}
  {{##}\hfil}
  {\lbrace}
  {\rbrace}
\makeatother


\begin{document}

\begin{equation*}
\hat{C}(\hat{S},1) = \frac{1}{E} C(S,T) =
\begin{lrdcases}
0            &\text{if $S<E$,}\\[1ex]
\frac{S}{2E} &\text{if $S=E$,}\\[1ex]
\frac{S}{E}  &\text{if $S>E$.}
\end{lrdcases}
\end{equation*}

\begin{equation*}
\hat{C}(\hat{S},1) = \frac{1}{E} C(S,T) =
\begin{lrdcases*}
0            & if $S<E$,\\[1ex]
\frac{S}{2E} & if $S=E$,\\[1ex]
\frac{S}{E}  & if $S>E$.
\end{lrdcases*}
\end{equation*}

\end{document}

According to the conventions of mathtools, the *-variant has the second column typeset in text mode.

enter image description here

However, I'd use the left brace only.

| 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.