# [NTG-context] Math equation with indentation

Wed May 14 01:44:45 CEST 2008

On Tue, 13 May 2008, 302302 wrote:

> Hi,
> I need to use a multieqaution in this form ( http://img233.imageshack.us/img233/2372/eqsx3.png ). I am mostly interested in the right brace and the indentation after the "subject to". I tried to use mathmatrix but without success. Can you help me with it?

I am using nested matrices, but this is one case which will be best solved
by something equivalent for gathered and aligned. It has been on my todo
list for a long time.

Here is a solution using nested matrices, where I use \noalign to fake
correct spacing after the first line (and changed the \cdots in the last
condition to \dots).

\definemathmatrix[rightbrace][left={\left.},right={\,\right\}},n=1,align=left]

\starttext

\placeformula[+] \startformula
\startrightbrace
\NC \min \{c_1 x_1 + c_2 x_2 + \cdots + c_n x_n \} \NR
\noalign{\vskip 0.2em}
\NC \text{subject to} \NR
\startmathmatrix[n=9,align={middle,middle,middle,
middle,middle,middle,right,middle,middle},
distance=0.3em]
\NC a_{11} x_1 \NC + \NC a_{12} x_2 \NC +
\NC \cdots \NC + \NC a_{1n} x_n \NC = \NC b_1 \NR
\NC a_{21} x_1 \NC + \NC a_{22} x_2 \NC +
\NC \cdots \NC + \NC a_{2n} x_n \NC = \NC b_2 \NR
\NC            \NC   \NC  \vdots    \NC
\NC        \NC   \NC            \NC   \NC \vdots \NR
\NC a_{m1} x_1 \NC + \NC a_{m2} x_2 \NC +
\NC \cdots \NC + \NC a_{mn} x_n \NC = \NC b_m \NR
\NC            \NC   \NC            \NC
\NC        \NC
\NC \llap{x_1,x_2,\dots,x_n} \NC \ge \NC 0.
\stopmathmatrix \NR
\stoprightbrace
\stopformula

\stoptext