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
___________________________________________________________________________________

Reply via email to