3

How do I typeset something like,

 X = 0 if a=1 \& b=1 \& c= 5 \& d=9 ; 
     0 otherwise, 

using those huge left braces and specifying each condition in a line (4 conditions in 4 separate lines)?

3

It's not clear to me if the conditions for X=1 are separate (logical "or") or cumulative (logical "and"). Assuming it's the former, the following two expressions may meet your needs.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for cases environment and \text command
\begin{document}
\[
X = 
\begin{cases}
  1 & \text{if $a=0$ or $b=1$ or $c=5$ or $d=9$} \\
  0 & \text{otherwise}
\end{cases}
\]

\[
X =
\begin{cases}
1 & \text{if $a=0$} \\
1 & \text{if $b=1$} \\
1 & \text{if $c=5$} \\
1 & \text{if $d=9$} \\
0 & \text{otherwise}
\end{cases}
\]
\end{document} 

Personally, I strongly prefer the first of these two forms -- at least for the setup you've provided. Should the conditions be more elaborate, the second form may well be the better option.

2

As far as I understand, your want the following construction:

\documentclass{article}
\begin{document}

\[
\left\{
\begin{array}{rl}
X=1 & \mbox{if $a=1$},\\
X=10 & \mbox{if $a=2$},\\
X=100 & \mbox{if $a=3$},\\
X=1000 &\mbox{otherwise}
\end{array}
\right.
\]

or

\[
\left\{
\begin{array}{ll}
X=1 & \mbox{if $a=1$},\\
X=10 & \mbox{if $a=2$},\\
X=100 & \mbox{if $a=3$},\\
X=1000 &\mbox{otherwise}
\end{array}
\right.
\]

\end{document}

enter image description here

  • 1
    I think OP is looking for a cases solution – percusse Oct 21 '13 at 0:01

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.