Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to typeset the enclosed equation but placing the last a_{i, j} in the same column as the above a_{i, j}+1 and a_{i, j}-1, and the b_i in the same column as the above b_i's and not as it is presented in this equation, where the last line is just center aligned.

enter image description here

share|improve this question
    
It would be useful if you add the code you have now for the equation. –  egreg Sep 29 '12 at 13:41
1  
I recommend adding if before b_i to avoid misinterpretation. And btw, your profile shows only 20% accept rate. I'm sure that you have some good solutions to your questions and you should consider accepting the answers, giving the answerers the site reputation. –  tohecz Sep 29 '12 at 14:31

2 Answers 2

up vote 12 down vote accepted

I prefer the cases environment of amsmath. Furthermore, it is advisable to add the word "if" to the conditions:

\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  a_{i,j} =
  \begin{cases}
    a_{i,j}+1 & \text{if $b_{i}=1$ and $c_{j}=0$}\\
    a_{i,j}-1 & \text{if $b_{i}=0$ and $c_{j}=1$}\\
    a_{i,j}   & \text{if $b_{i}=0$}
  \end{cases}
\end{equation}
\end{document}

enter image description here

share|improve this answer
    
without the word "if", the mathematical meaning is quite unclear –  tohecz Sep 29 '12 at 14:29
1  
Besides adding the word if, I suggest you typeset the commas in text mode (or add the word and): \text{if $b_i = 1$ and $c_j = 0$} .... (Requires amsmath.) –  Marc van Dongen Sep 29 '12 at 15:04
    
@tohecz and (at)Marc I added your propositions to the answer. –  sebschub Sep 29 '12 at 16:48
1  
The mathtools gives you, among others, the environment cases* where you don't need the \text part. –  Qrrbrbirlbel Sep 29 '12 at 17:01

Although I am not exactly sure what you are trying to do (it seems like a circular definition to me), perhaps this answers your question:

\documentclass{article}

\begin{document}
\begin{equation}
a_{i,j}=\left\lbrace
\begin{array}{lll}
a_{i,j}+1, & b_i = 1, & c_j = 0\\
a_{i,j}-1, & b_i = 0, & c_j = 1\\
a_{i,j}  , & b_i = 0  & 
\end{array}
\right.
\end{equation}
\end{document}

enter image description here

Note that you could also use the cases environment from the amsmath package, but in that case you would only have two columns while you seem to need three here (the spacing will be different). A solution with cases would be

\documentclass{article}

\usepackage{amsmath}
\begin{document}
\begin{equation}
  a_{i,j} =
  \begin{cases}
    a_{i,j}+1 & b_i = 1,\quad c_j = 0\\
    a_{i,j}-1 & b_i = 0,\quad c_j = 1\\
    a_{i,j}   & b_i = 0
  \end{cases}
\end{equation}
\end{document}

With output:

enter image description here

share|improve this answer
    
If you add @{} in front of the three llls you have a spacing between the \lbrace and your array in the same way as the cases environment. –  Qrrbrbirlbel Sep 29 '12 at 14:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.