ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: A few questions about aligned maths
Date: Sun, 23 Mar 2008 01:31:41 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.1.00.0803230117460.10686@nqv-yncgbc> (raw)
In-Reply-To: <alpine.DEB.1.00.0803130156370.12550@leo>

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  parent reply	other threads:[~2008-03-23  5:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  1:13 Morgan Brassel
2008-03-13 12:23 ` Aditya Mahajan
2008-03-13 18:16   ` Morgan Brassel
2008-03-13 23:48     ` Aditya Mahajan
2008-03-14  0:53       ` Morgan Brassel
2008-03-14  7:13       ` Wolfgang Schuster
2008-03-14 20:45         ` Aditya Mahajan
2008-03-23  5:31 ` Aditya Mahajan [this message]
2008-03-24  0:00   ` Morgan Brassel
2008-03-24 10:19     ` Hans Hagen
2008-03-24 12:17       ` Aditya Mahajan
2009-01-18  4:56         ` Dave
2009-01-19 14:52           ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0803230117460.10686@nqv-yncgbc \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).