I made it with eqarray, but it "only" allows me to have 3 columns. How
did you add more columns?

I tried using alignat and it works ok, except for the fact that LyX
doesn't show proper alignment (only the first column is right aligned,
while all of the others are left aligned.

Thanks for your help.
-------------------------------------------------
Julio Rojas
jcredbe...@gmail.com



On Wed, Sep 2, 2009 at 6:00 PM, Paul A. Rubin<ru...@msu.edu> wrote:
> Julio,
>
> Julio Rojas wrote:
>>
>> Thanks Paul, I've tried it but the first column is right aligned and
>> the third is left aligned.
>
> In the alignat* example?  Shouldn't be -- the alignment alternates
> right-left-right, so the first and third columns should have the same
> alignment.  Note that the first column is intentionally left empty, so that
> the 'maximize' and 'subject to' are in the second column (and hence
> left-aligned).
>
>> I'm kind of new on the subject and the
>> references I have from a friend make them left and right aligned,
>> respectively. Is there an standard way of aligning them?
>
> I'm not sure there's a generally accepted standard.  I like to put the
> keywords (maximize, s.t.) in one column, the objective function and LHS of
> constraints in a second column, the constraint direction (=,<,>) in a  third
> column, the RHS in the fourth column and any indexing stuff in a fifth
> column, so I usually use eqnarray (critics be damned).  If I'm going to use
> alignat, then I'll put max/s.t. in column 2 (left aligned), the LHS _and_
> =/>/< in the third column (right aligned), the RHS in the fourth column
> (left aligned) and indexing in the fifth column (right aligned), which
> should work pretty well (it avoids gratuitous space in the middle of the
> constraints).
>
> I guess it's a matter of taste (unless the constraints get long enough that
> eqnarray sends the equation numbers into another galaxy).
>
> /Paul
>
>> -------------------------------------------------
>> Julio Rojas
>> jcredbe...@gmail.com
>>
>>
>>
>> On Wed, Sep 2, 2009 at 5:11 PM, Paul A. Rubin<ru...@msu.edu> wrote:
>>>
>>> Julio Rojas wrote:
>>>>
>>>> Thanks, I've already done that, but no option seems to be of help. I'm
>>>> trying to put an integer programing model and every restriction should
>>>> be numbered and aligned like:
>>>>
>>>> Maximize Z                                          (1)
>>>> Subject to:
>>>> Z=sum(Xi)                                             (2)
>>>> Xi+Xj<=1                       for all i,j in P, i<j (3)
>>>> Xi,Xj in {0,1}                        for all i,j in P (4)
>>>>
>>>> So, some rows are numbered, the left column is left aligned and the
>>>> right column is right aligned. How can this numbered array be done?
>>>> -------------------------------------------------
>>>> Julio Rojas
>>>> jcredbe...@gmail.com
>>>>
>>>>
>>>>
>>>> 2009/9/2 Ignacio García <ignacio.gmora...@gmail.com>:
>>>>>
>>>>> Julio Rojas <jcredbe...@...> writes:
>>>>>
>>>>>> Dear all, is there a way to individually label some equations of an
>>>>>> equation array? Or some rows from an array?
>>>>>> -------------------------------------------------
>>>>>> Julio Rojas
>>>>>> jcredbe...@...
>>>>>>
>>>>> Please have a look at Help>Math (or Ecuaciones) where you can
>>>>> find a very fine description of this issue in the section 19,
>>>>> 19.3 and/or 19.4.
>>>>>
>>> Julio,
>>>
>>> Actually, I think what you want is in section 19.1.  Inside an equation
>>> array environment, Alt-m n toggles numbering of the entire array
>>> (separate
>>> number on each line), while Alt-m Shift-n toggles numbering of just the
>>> line
>>> the cursor occupies.
>>>
>>> BTW, I too write integer programs.  A while back I came across a
>>> reference
>>> to an article ("Avoid eqnarray!" by Lars Madsen, The PracTeX Journal #4,
>>> 2006) that claims that eqnarray is somehow evil.  The complaints are
>>> mainly
>>> about spacing (including the possibility that equation numbers are
>>> overwritten or crowded off the line).  He recommends AMS math
>>> environments
>>> or the mathenv package.  Then again, I came across a post on
>>> sci.op-research
>>> that as I recall advocated eqnarray.
>>>
>>> Anyway, here's an alternative I found somewhere:
>>>
>>> \begin{alignat*}{7}
>>>  & \text{maximize } & z= &  & 2x_{1} &  & + &  & 3x_{2} &  & + &  &
>>> 4x_{3}\\
>>>  & \text{subject to: } &  &  & 44x_{1} &  &  &  &  &  & + &  & 50x_{3} &
>>> \ge900\\
>>>  &  &  &  &  &  &  &  &  &  &  &  & \llap{\ensuremath{x_{1},x_{2},x_{3}}}
>>> &
>>> \ge0
>>> \end{alignat*}
>>>
>>> FWIW,
>>> Paul
>>>
>>>
>>
>
>

Reply via email to