2

i want to write equation like this enter image description here

a right brace to cover those equations and mark them with single equation number

what modifications need to be done to my code?

\begin{flalign*}
&Y \Longleftarrow minimize\\
&\text{Subject to:}\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le W &1\le i \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\le Y &1\le i \le m\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le x_j+M(x_{ij}+y_{ij}) &1\le i \le j \le m\\
&x_i+z_jh_{mj}-(1-z_j)w_{mj}\ge x_j-M(1-x_{ij}+y_{ij})&1\le i \le j \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\ge y_j+M(1+x_{ij}-y_{ij})&1\le i \le j \le m\\
&y_i-z_jw_{mj}-(1-z_j)h_{mj}\ge y_j-M(2-x_{ij}-y_{ij})&1\le i \le j \le m\\
&x_i\ge 0, y_i\ge 0 &1\le i \le m\\
\end{flalign*}

thanks...

1 Answer 1

3
\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \begin{flalign}
  \left.\begin{aligned}
&Y \Longleftarrow \text{minimize}\\
&\text{Subject to:}\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le W &1\le i \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\le Y &1\le i \le m\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le x_j+M(x_{ij}+y_{ij}) &1\le i \le j \le m\\
&x_i+z_jh_{mj}-(1-z_j)w_{mj}\ge x_j-M(1-x_{ij}+y_{ij})&1\le i \le j \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\ge y_j+M(1+x_{ij}-y_{ij})&1\le i \le j \le m\\
&y_i-z_jw_{mj}-(1-z_j)h_{mj}\ge y_j-M(2-x_{ij}-y_{ij})&1\le i \le j \le m\\
&x_i\ge 0, y_i\ge 0 &1\le i \le m
\end{aligned}\right\}
\end{flalign}
\end{document}

Same can be done with align too.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \begin{align}
  \left.\begin{aligned}
&Y \Longleftarrow \text{minimize}\\
&\text{Subject to:}\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le W &1\le i \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\le Y &1\le i \le m\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le x_j+M(x_{ij}+y_{ij}) &1\le i \le j \le m\\
&x_i+z_jh_{mj}-(1-z_j)w_{mj}\ge x_j-M(1-x_{ij}+y_{ij})&1\le i \le j \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\ge y_j+M(1+x_{ij}-y_{ij})&1\le i \le j \le m\\
&y_i-z_jw_{mj}-(1-z_j)h_{mj}\ge y_j-M(2-x_{ij}-y_{ij})&1\le i \le j \le m\\
&x_i\ge 0, y_i\ge 0 &1\le i \le m
\end{aligned}\right\}
\end{align}
\end{document}

enter image description here

If you want to number only the conditions do this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \begin{align}
&Y \Longleftarrow \text{minimize} \notag \\
&\text{Subject to:} \notag\\
&\left.\kern-\nulldelimiterspace\!\!\begin{aligned}
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le W &1\le i \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\le Y &1\le i \le m\\
&x_i+z_ih_{mi}+(1-z_i)w_{mi}\le x_j+M(x_{ij}+y_{ij}) &1\le i \le j \le m\\
&x_i+z_jh_{mj}-(1-z_j)w_{mj}\ge x_j-M(1-x_{ij}+y_{ij})&1\le i \le j \le m\\
&y_i+z_iw_{mi}+(1-z_i)h_{mi}\ge y_j+M(1+x_{ij}-y_{ij})&1\le i \le j \le m\\
&y_i-z_jw_{mj}-(1-z_j)h_{mj}\ge y_j-M(2-x_{ij}-y_{ij})&1\le i \le j \le m\\
&x_i\ge 0, y_i\ge 0 &1\le i \le m
\end{aligned}\right\}
\end{align}
\end{document}

enter image description here

2
  • thank you but my equation number is coming beneath the equation... is there any way so that the brace can start after "subject to"
    – user38375
    Mar 28, 2015 at 11:30
  • @user38375 It happens if your equation is too wide and there is no place for equation number on the right. Reduce the width by breaking your equation. For brace starting after Subject to: see the last edit at the bottom. Or put &\text{Subject to:} after \begin{aligned} if you mean that.
    – user11232
    Mar 28, 2015 at 11:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .