# [Tex/LaTex] How to write a multiline case in latex

casesequationspdftex

I am trying to get the output similar to this:

I have written this code:

$$\text{RHS} \rightarrow \begin{cases} \vert 1 \rangle \left[\frac{2\beta}{\sqrt{\alpha^2 + 4\beta^2}}\vert B\rangle - \frac{\alpha}{\sqrt{\alpha^2 + 4\beta^2}}\vert A \rangle\right] , &D_1\textrm{ clicks, probability \frac{\alpha^2}{4}}\\ \vert 2 \rangle\vert A \rangle, &D_2\textrm{ clicks, probability \frac{\alpha^2}{4}}\\ \vert \text{scattered} \rangle\vert A \rangle, &\textrm{ no clicks with probability \frac{\alpha^2}{2}} \end{cases}$$


And the following is the output:

How then, should I modify the code to get the output similar to first image? If I just add a line break in the first case it gives an error.

Thank you.

Would this hack be sufficient?

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$$\text{RHS} \rightarrow \begin{cases} \vert 1 \rangle \bigg[\frac{2\beta}{\sqrt{\alpha^2 + 4\beta^2}}\vert B\rangle &D_1\textrm{ clicks, probability \frac{\alpha^2}{4}}\\ \quad - \frac{\alpha}{\sqrt{\alpha^2 + 4\beta^2}}\vert A \rangle\bigg], & \\ \vert 2 \rangle\vert A \rangle, &D_2\text{ clicks, probability \frac{\alpha^2}{4}}\\ \vert \text{scattered} \rangle\vert A \rangle, &\text{no clicks with probability \frac{\alpha^2}{2}} \end{cases}$$
\end{document}