4

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

  • It would be useful if you add the code you have now for the equation. – egreg Sep 29 '12 at 13:41
12

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

  • without the word "if", the mathematical meaning is quite unclear – yo' 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.) – user10274 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
4

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

  • 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

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.