Multiline in sub-conditional math

Something like this?

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
    A=
    \begin{cases}
      1, & \text{if           $x=1$}\\
         & \text{\phantom{if }$x=2$}\\
      2, & \text{else}
    \end{cases}
\end{equation}
\end{document}

You can use aligned:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
A=
\begin{cases}
  1, & \text{if }
       \begin{aligned}[t]
       x&=1\\
       x&=2
       \end{aligned}
\\
  2, & \text{otherwise}
\end{cases}
\end{equation}

\end{document}

enter image description here


Well, this should do:

\begin{equation}
    A=
    \begin{cases}
      1, & x=1 \\
        & x=2 \\
      2, & \text{else}
    \end{cases}
\end{equation}

Or do I miss something?

Tags:

Amsmath