ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Emulating AMS stuff in ConTeXt
@ 2002-12-07 18:24 Giuseppe Bilotta
  2002-12-08 20:26 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Giuseppe Bilotta @ 2002-12-07 18:24 UTC (permalink / raw)


Hello,

while trying to build an AMS emulation layer on top of ConTeXt
math macros, I defined (among the other) the following macros:

\def\startalign{%
    \startformula
    \let\\\cr
    \grabuntil{stopalign}\doeqalign
}
\def\doeqalign#1{\eqalign{#1\cr}\stopformula}
\let\stopalign\relax

These allow me to write:

\startalign
  a & = b = \\
    & = c
\stopalign

and everything is fine. Yet I cannot do

\placeformula[hook]
\startalign
  a & = b = \\
    & = c
\stopalign

because of expansion problems. Why? How can I define the stuff?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Emulating AMS stuff in ConTeXt
  2002-12-07 18:24 Emulating AMS stuff in ConTeXt Giuseppe Bilotta
@ 2002-12-08 20:26 ` Hans Hagen
  2002-12-08 21:36   ` Re[2]: " Giuseppe Bilotta
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2002-12-08 20:26 UTC (permalink / raw)


At 07:24 PM 12/7/2002 +0100, you wrote:
>def\startalign{%
>     \startformula
>     \let\\\cr
>     \grabuntil{stopalign}\doeqalign
>}
>\def\doeqalign#1{\eqalign{#1\cr}\stopformula}

                              ^^ better make that \crcr in order to catch 
users \\

>\let\stopalign\relax
>
>These allow me to write:
>
>\startalign
>   a & = b = \\
>     & = c
>\stopalign

isn't \startmathalign a better choice?

>and everything is fine. Yet I cannot do
>
>\placeformula[hook]
>\startalign
>   a & = b = \\
>     & = c
>\stopalign
>
>because of expansion problems. Why? How can I define the stuff?

took me a couple of cd's to uncover this -)

(1) placeformula has to look ahead, and the next command is not seen as 
something math; so,
(2) i made another lookahead, and then
(3) we ran into those \cr & and # things that may not always show up 
everywhere, so
(4) i had to rewrite a low level macro that i didn't like rewriting, i.e.
(5) i had to use a variant i'd always thought that could be avoided

so, you spoiled my afternoon -)

btw, if you isolate/collect the ams math that's not yet in m-newmat, i can 
see if/how i can add it there in a configurable way, so if some things 
fails, we can look into it later

you can try the version i just uploaded

Hans


-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re[2]: Emulating AMS stuff in ConTeXt
  2002-12-08 20:26 ` Hans Hagen
@ 2002-12-08 21:36   ` Giuseppe Bilotta
  0 siblings, 0 replies; 3+ messages in thread
From: Giuseppe Bilotta @ 2002-12-08 21:36 UTC (permalink / raw)


Sunday, December 8, 2002 Hans Hagen wrote:

HH> At 07:24 PM 12/7/2002 +0100, you wrote:
>>def\startalign{%
>>     \startformula
>>     \let\\\cr
>>     \grabuntil{stopalign}\doeqalign
>>}
>>\def\doeqalign#1{\eqalign{#1\cr}\stopformula}

HH>                               ^^ better make that \crcr in order to catch 
HH> users \\

Will fix. I just "copied" the AMS defs ...

>>\let\stopalign\relax
>>
>>These allow me to write:
>>
>>\startalign
>>   a & = b = \\
>>     & = c
>>\stopalign

HH> isn't \startmathalign a better choice?

Maybe. I just "converted" the AMS-LaTeX "align" environment, so I
kept the align name.

>>and everything is fine. Yet I cannot do
>>
>>\placeformula[hook]
>>\startalign
>>   a & = b = \\
>>     & = c
>>\stopalign
>>
>>because of expansion problems. Why? How can I define the stuff?

HH> took me a couple of cd's to uncover this -)

HH> (1) placeformula has to look ahead, and the next command is not seen as 
HH> something math; so,
HH> (2) i made another lookahead, and then
HH> (3) we ran into those \cr & and # things that may not always show up 
HH> everywhere, so
HH> (4) i had to rewrite a low level macro that i didn't like rewriting, i.e.
HH> (5) i had to use a variant i'd always thought that could be avoided

HH> so, you spoiled my afternoon -)

:P Sorry, but it's your choice to work on sundays ;)

HH> btw, if you isolate/collect the ams math that's not yet in m-newmat, i can 
HH> see if/how i can add it there in a configurable way, so if some things 
HH> fails, we can look into it later

Ok. I'm "filling it up" as it comes while typesetting/converting
some notes (part of them were hand-written, part of the in LaTeX
form).

HH> you can try the version i just uploaded

Will do.

-- 
Giuseppe "Oblomov" Bilotta

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

end of thread, other threads:[~2002-12-08 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-07 18:24 Emulating AMS stuff in ConTeXt Giuseppe Bilotta
2002-12-08 20:26 ` Hans Hagen
2002-12-08 21:36   ` Re[2]: " Giuseppe Bilotta

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