On Sun, 23 Mar 2008, Aditya Mahajan wrote:
On Thu, 13 Mar 2008, Morgan Brassel wrote:
3) Aditya, I saw your remark in your 'My Way' concerning the 'multline' environment. I must admit I would really be glad to see it appear in ConTeXt! I'm afraid I'm not able to implement it myself... I use it a lot with amsmath: when a formula is just too long for one line, I put it on two with multline. The first part of the formula is left aligned on the first line, and the second part is right aligned on the second line. It seems impossible to get the same result with only 'align'. Would it be difficult to make it available in ConTeXt?
Here is my first attempt. Completely bare-bones right now, but short enough to show what needs to be done.
\unprotect \def\startmathlines {\def\stop@math{$} \def\NC{} \def\NR{\def\NC{\cr}} % Hack for number. Should be done by measuring the width of the number \scratchdimen\dimexpr\displaywidth-4em \relax \vbox \bgroup \halign\bgroup \hbox to \scratchdimen {\hfil \strut $\mathsurround\zeropoint\displaystyle{}## \stop@math \hfil}% \crcr \hfilneg}
\def\stopmathlines {\hfilneg \crcr \egroup \egroup} \protect
\starttext
\placeformula \startformula \startmathlines \NC f(x) = (a+b)^n \NR \NC = a^n + n \cdot a^{n-1} b + \cdots + n \cdot a b^{n-1} + b^n \NR \NC = a^n + n \cdot a^{n-1} b + \cdots + n \cdot a b^{n-1} + b^n \NR \stopmathlines \stopformula
\stoptext
Taking care of [align=left|right] should be easy. This version will not break across pages. I cannot figure out how to get rid of the outer \vbox. Any suggestions?
Aditya
Sorry that I can't help you with the implementation, Aditya... I just want to confirm that your new macro perfectly fits my needs. I hope it will make it into the core, it really is useful! As always, a big thanks for your time and patience! Morgan