I want to write this equation in latex:
I need that comments be in right side.
I did something like this but it has some flaws.
\begin{eqnarray}
\label{cons1}
% \begin{aligned}
x_i+w_{mi}\le X_j \hfill \hfill\text{if i is to the left of j}\\
\label{cons2}
x_i-w_{mj}\ge X_j \hfill \hfill\text{if i is to the right of j}\\
\label{cons3}
y_i+h_{mi}\le y_j \hfill \hfill\text{if i is below of j}\\
\label{cons4}
y_i-h_{mj}\ge y_j \hfill \hfill\text{if i is above of j}
%\end{aligned}
\end{eqnarray}
Where did I make mistake?
Best Answer
You would probably want to use an
align
environmentYou shouldn't use
eqnarray
in LaTeX, see eqnarray vs align