4

I have a very long conditional statement and I would like to make it multiline. I know how to do:

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

but would like something like: enter image description here

Thank you

  • Do you want to dispense with the "if" particle? – Mico Aug 28 '16 at 16:42
  • Typo on my end. Question has been solved. Thank you all. – user3155053 Aug 28 '16 at 18:22
4

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

  • Any reason for the downvote? – egreg Aug 29 '16 at 16:46
5

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}
2

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?

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.