ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* questions about math formula
@ 2007-06-06 15:31 fdu.xiaojf
  2007-06-06 16:01 ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: fdu.xiaojf @ 2007-06-06 15:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I have two questions about math formula.

1) I'd like to use \startalign to typeset mathematical formulas since it
is more convenient than \eqalign. But the formula number cannot be
located between two lines just as \eqalign can. I hope following example
can make me clear.

\starttext

\placeformula \startformula
\eqalign{
    a + b & = c + d\cr
          & = e + f\cr}
\stopformula

\placeformula \startformula
\startalign
\NC a + b \NC = c + d \NR[+]
\NC       \NC = e + f \NR
\stopalign
\stopformula

\stoptext

The number of equations in second formula can only be put on the first
line or second line but not between them.

My question is how to make the location of formula number in \startalign
the same as it is in \eqalign ?

2) It seems that \left and \right cannot be used on separate groups.
Here is a simple example:

\starttext

\placeformula \startformula
\eqalign{
    a & = \left(\frac{b+c}{d+e}\cr
      &\phantom{=~} + \frac{g}{h}\cr}
\stopformula

\stoptext

If I change \left and \right to \big, it compiles successfully. But I
think \left and \right are more convenient. Are there some solutions to
use \left and \right in this situation ?

Regards,

Xiao Jianfeng

___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: questions about math formula
  2007-06-06 15:31 questions about math formula fdu.xiaojf
@ 2007-06-06 16:01 ` Aditya Mahajan
  2007-06-06 16:06   ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2007-06-06 16:01 UTC (permalink / raw)
  To: ntg-context

Quoting "fdu.xiaojf@gmail.com" <fdu.xiaojf@gmail.com>:

> Hi all,
>
> I have two questions about math formula.
>
> 1) I'd like to use \startalign to typeset mathematical formulas since it
> is more convenient than \eqalign. But the formula number cannot be
> located between two lines just as \eqalign can. I hope following example
> can make me clear.
>
> \starttext
>
> \placeformula \startformula
> \eqalign{
>    a + b & = c + d\cr
>          & = e + f\cr}
> \stopformula
>
> \placeformula \startformula
> \startalign
> \NC a + b \NC = c + d \NR[+]
> \NC       \NC = e + f \NR
> \stopalign
> \stopformula
>
> \stoptext
>
> The number of equations in second formula can only be put on the first
> line or second line but not between them.
>
> My question is how to make the location of formula number in \startalign
> the same as it is in \eqalign ?

As of now, no. This is equivalent to what split environment in amsmath 
does, and right now, there is no context equivalent. It is easy to 
provide simple support, (actually even some of the more sophisticated 
features), and has been on my todo list for a long time now. You can 
get something by using matrix environments, but then the interline 
spacing is not correct. See 
http://dl.contextgarden.net/myway/mathalign.pdf page 21.


> 2) It seems that \left and \right cannot be used on separate groups.
> Here is a simple example:
>
> \starttext
>
> \placeformula \startformula
> \eqalign{
>    a & = \left(\frac{b+c}{d+e}\cr
>      &\phantom{=~} + \frac{g}{h}\cr}
> \stopformula
>
> \stoptext
>
> If I change \left and \right to \big, it compiles successfully. But I
> think \left and \right are more convenient. Are there some solutions to
> use \left and \right in this situation ?

The easier way is to use manual scaling, for example use \big, \bigg, 
\Big, \Bigg or you can have a more fine-tuned control by

\protected\def\domathbig{\@@dobig}

and then use \domathbig{1.25} to have something which is 1.25 the body 
font size, etc. The default values are

\def\big {\@@dobig{0.85}}
\def\Big {\@@dobig{1.15}}
\def\bigg{\@@dobig{1.45}}
\def\Bigg{\@@dobig{1.75}}

A more automated way is to use \vphantom, something like

\eqalign{
  a &= \left( <expr 1> \vphantom{<expr 2>} \right.
    &  \left. \vphantom { <expr 1>} <expr 2> \right) }

but this quickly becomes unmanageable if you have more than two expressions.

A more sophisticated approach is taken by nath package in latex, see 
its documentation on CTAN. With nath it is as easy as

a \wall = \left( <expr 1> \\
         <expr 2> \right) \return

There is a nath module for ConTeXt, but it is old and was made before 
Hans provided all the amsmath like alignment features. I do not know if 
you can still use it these days.

HTH,
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: questions about math formula
  2007-06-06 16:01 ` Aditya Mahajan
@ 2007-06-06 16:06   ` Aditya Mahajan
  0 siblings, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2007-06-06 16:06 UTC (permalink / raw)
  To: ntg-context

Quoting Aditya Mahajan <adityam@umich.edu>:
>
> The easier way is to use manual scaling, for example use \big, \bigg,
> \Big, \Bigg or you can have a more fine-tuned control by
>
> \protected\def\domathbig{\@@dobig}

Oops, that should be

\unprotected\def\....

\unprotected is same as surrounding the command by \unprotect ... 
\protect and useful for redefinitions of one or two commands.

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-06 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-06 15:31 questions about math formula fdu.xiaojf
2007-06-06 16:01 ` Aditya Mahajan
2007-06-06 16:06   ` Aditya Mahajan

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).