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