67

I am trying to write an equation that looks like this, everything should be left aligned on the right hand side.

enter image description here

I am using the following code to write this equation.

  \begin{equation}
  D_{it} = \Bigg\{if \ bank \ i \ issues \ ABS \ at \ time \ t \\
  2 \ if \ bank \ i \ issue \ CBs \ at \ time \ t \\ 
  \ 0 \ otherwise
  \end{equation}

I am putting \\ for a new line but it does not work. Please guide how I can write the desired equation.

Werner
  • 603,163
Ahmed Arif
  • 1,345

1 Answers1

122

Use the cases environment, like this.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
  D_{it} =
    \begin{cases}
      1 & \text{if bank $i$ issues ABs at time $t$}\\
      2 & \text{if bank $i$ issues CBs at time $t$}\\
      0 & \text{otherwise}
    \end{cases}       
\end{equation}
\end{document}

enter image description here

gernot
  • 49,614
  • However, this equation is not numbered by following this method. How I can number it? – Ahmed Arif Nov 03 '16 at 17:33
  • @AhmedArif Remove the star after equation. – gernot Nov 03 '16 at 17:34
  • 1
    Note this works also in MathJax :-) :-) – Antonello Feb 24 '20 at 11:22
  • @Antonello Great, good to know ... – gernot Feb 24 '20 at 11:30
  • how can i close the bracket? – Khan May 07 '20 at 18:19
  • 3
    If you want to close the bracket, it is probably no case distinction and you shouldn't use the cases environment. To enclose something between (big) delimiters use the \left and \right commands. E.g., to enclose something between braces, try \[\left\{\begin{array}{cc}1&2\\3&4\end{array}\right\}\] . If this doesn't solve your problem, ask a separate question and describe what you want to achieve. – gernot May 08 '20 at 11:07