ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* amsmath features
@ 2008-01-20 17:14 Peter I. Hansen
  2008-01-20 20:25 ` Aditya Mahajan
  2008-01-21 11:37 ` Aditya Mahajan
  0 siblings, 2 replies; 4+ messages in thread
From: Peter I. Hansen @ 2008-01-20 17:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

In context I would very much like to use the intlimits feature from
amsmath. I LaTex this would be done by:

\usepackage[intlimits]{amsmath}

I've seached google and contextgarden but didn't find any related
hint. Do any of you guys know?

thanks, Peter
___________________________________________________________________________________
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] 4+ messages in thread

* Re: amsmath features
  2008-01-20 17:14 amsmath features Peter I. Hansen
@ 2008-01-20 20:25 ` Aditya Mahajan
  2008-01-21 11:37 ` Aditya Mahajan
  1 sibling, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2008-01-20 20:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 20 Jan 2008, Peter I. Hansen wrote:

> Hi,
>
> In context I would very much like to use the intlimits feature from
> amsmath. I LaTex this would be done by:
>
> \usepackage[intlimits]{amsmath}
>
> I've seached google and contextgarden but didn't find any related
> hint. Do any of you guys know?

Currently no such method exists. It is relatively easy to do this, and so 
far there has been no demand for this. I will send a patch to allow this 
soon (in about a day)

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] 4+ messages in thread

* Re: amsmath features
  2008-01-20 17:14 amsmath features Peter I. Hansen
  2008-01-20 20:25 ` Aditya Mahajan
@ 2008-01-21 11:37 ` Aditya Mahajan
       [not found]   ` <b11f605c0801210455m15630ce7na7d68763c8edf900@mail.gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2008-01-21 11:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Peter,

On Sun, 20 Jan 2008, Peter I. Hansen wrote:

> Hi,
>
> In context I would very much like to use the intlimits feature from
> amsmath. I LaTex this would be done by:
>
> \usepackage[intlimits]{amsmath}
>
> I've seached google and contextgarden but didn't find any related
> hint. Do any of you guys know?

Here is a patch. Right now, you will have to use
\chardef\intlimitcode = <number>
 	where <number> is 0 for \nolimits (default)
               1 for \displaylimits (similar to amsmath  intlimit
 	      2 for \limits


Hans: I am not sure which is the right way to interface this. Should we 
add \setupmathematics (there could be other options in the future)?

\chardef\intlimitcode\zerocount  %0 nolimits 1 displaylimits 2 limits

\def\intlimits
   {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi}

\definemathcommand [int]    {\intop \intlimits}
\definemathcommand [oint]   {\ointop\intlimits}

\def\repeatintegral#1%
   {\scratchtoks\emptytoks
    \let\dointlimits\intlimits
    \dorecurse{#1}{\appendtoks \intop \dointkern \to \scratchtoks}
    \appendtoks \intop \dointlimits \to \scratchtoks
    \edef\dodorepeatintegral{\the\scratchtoks}%
    \futurelet\next\dorepeatintegral}

\def\dorepeatintegral
    {\ifx\next\limits          \dointlimitcorrection \else
     \ifx\next\displaylimits   \dointlimitcorrection \else
     \ifx\next\nolimits        \donothing            \else
     \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi
     \dodorepeatintegral}


% Example:
\starttext

\startbuffer
   $\int_a^b f(x) dx$ and also $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) 
dxdy$,
   $\iiiint_a^b f(x) dx$
   \startformula
     \int_a^b f(x) dx \quad
     \iint_a^b f(x) dx \quad
     \iiint_a^b f(x) dx \quad
     \iiiint_a^b f(x) dx \quad
   \stopformula
\stopbuffer

Default: \getbuffer

Displaylimits: \chardef\intlimitcode\plusone \getbuffer

Limits: \chardef\intlimitcode\plustwo \getbuffer

\stoptext




___________________________________________________________________________________
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] 4+ messages in thread

* Re: amsmath features
       [not found]   ` <b11f605c0801210455m15630ce7na7d68763c8edf900@mail.gmail.com>
@ 2008-01-21 17:57     ` Aditya Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2008-01-21 17:57 UTC (permalink / raw)
  To: Peter I. Hansen; +Cc: mailing list for ConTeXt users

On Mon, 21 Jan 2008, Peter I. Hansen wrote:

> Hi, I'm sending you this off-list because of the attachment...
>
> Your patch works nicely for what I want it do do (The displaylimits),
> but I'm a bit confused about the behaviour of the intext math in with
> the third option (intlimitcode = 2).
> Did I mess things up?
>
> Best, Peter

I had made a mistake in the code. Here is a corrected version, which works 
for all three cases

Aditya


\chardef\intlimitcode\zerocount  %0 nolimits 1 displaylimits 2 limits

\def\intlimits
   {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi}

\definemathcommand [int]    {\intop \intlimits}
\definemathcommand [oint]   {\ointop\intlimits}

\def\repeatintegral#1%
   {\scratchtoks\emptytoks
    \let\dointlimits\donothing
    \let\dodointlimits\intlimits
    \dorecurse{#1}{\appendtoks \intop \dointkern \to \scratchtoks}
    \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks
    \edef\dodorepeatintegral{\the\scratchtoks}%
    \futurelet\next\dorepeatintegral}

\def\dorepeatintegral
    {\ifx\next\limits          \dointlimitcorrection \else
     \ifx\next\displaylimits   \dointlimitcorrection \else
     \ifx\next\nolimits        \donothing            \else
     \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi
     \dodorepeatintegral}

\def\dointlimitcorrection
   {\mkern-7mu\mathchoice{\mkern-2mu}{}{}{}%
    \mathop\bgroup
      \mkern7mu\mathchoice{\mkern2mu}{}{}{}%
      \let\dointlimits\egroup}

\starttext

\startbuffer
   $\int_a^b f(x) dx$ and also $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) 
dxdy$,
   $\iiiint_a^b f(x) dx$
   \startformula
     \int_a^b f(x) dx \quad
     \iint_a^b f(x) dx \quad
     \iiint_a^b f(x) dx \quad
     \iiiint_a^b f(x) dx \quad
   \stopformula

   $\iint\limits_a^b$
   $\iint\nolimits_a^b$
   $\iint\displaylimits_a^b$
   \startformula
     \iint\limits_a^b
     \iint\nolimits_a^b
     \iint\displaylimits_a^b
   \stopformula
\stopbuffer

Default: \getbuffer

Displaylimits: \chardef\intlimitcode\plusone \getbuffer


Limits: \chardef\intlimitcode\plustwo \getbuffer

\stoptext

___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2008-01-21 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-20 17:14 amsmath features Peter I. Hansen
2008-01-20 20:25 ` Aditya Mahajan
2008-01-21 11:37 ` Aditya Mahajan
     [not found]   ` <b11f605c0801210455m15630ce7na7d68763c8edf900@mail.gmail.com>
2008-01-21 17:57     ` 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).