How can i use multiple alignment inside cases environment? i tired to use alignat, align* … but it seems that they dont work inside equation environment.
\begin{equation}
\label{eq:13}
\begin{aligned}
W_{ij} = \begin{cases}
tf_{ij} \times \log \left( \frac{N}{n_i} \right) &if\quad &AW_i = 0\\
AW_i \times tf_{ij} \times \log \left( N/ n_i \right) &if\quad 0<&AW_i<1\\
\left(1 + \log \left( AW_i \right) \right) \times tf_{ij} \times \log
\left(\frac{N}{n_i} \right) &if\quad &AW_i \geq 1
\end{cases}
\end{aligned}
\end{equation}
when i insert second & for each case it returns error !
Best Answer
Basically, use only one
&
symbol per row. If this were my document, I'd stick with the default layout for the right-hand column of thecases
environment, which is left alignment of the material. For sure, you can't used analigned
environment to achieve your formatting objective.Two additional comments: (i) Use
\left
and\right
only sparingly. (ii) Try to keep your notation consistent. At times, you use\frac{N}{n_i}
, while at others you writeN/n_i
. In the present context, I'd use the latter, i.e., inline-fraction notation.Note also that I changed all instances of
tf_{ij}
in your code to\mathit{tf}_{\!ij}
, both to tighten up the appearance oftf
and to "snug up" the subscript term to its base. If you have a lot of instances oftf_{ij}
, you may want to create a shorthand macro, say,\newcommand\tfij{\mathit{tf}_{\!ij}}
, and then replace all instances oftf_{ij}
in your document with\tfij
.Addendum: For the case at hand (pun intended), what you may want to think about, in terms of changing the layout, is to right-align the material in the first column of the
cases
environment.Second addendum, to address the OP's follow-up comment: To achieve the desired special alignment of the material in the second column of the
cases
environment, I suggest you use\phantom
statements in rows 1 and 3.