ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* iint, iiint, etc. for math mode
@ 2007-04-28  7:40 Aditya Mahajan
  0 siblings, 0 replies; only message in thread
From: Aditya Mahajan @ 2007-04-28  7:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Here is ConTeXt version of iint, iiint, etc from amsmath. Basically, 
just combine the intop symbols with appropriate kern between them. And 
in case of \iint\limits, provides a visually centered subscript.

Aditya


\unprotect

\def\dointkern  {\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}}

\definemathcommand  [iint]     {\repeatintegral{1}}
\definemathcommand  [iiint]    {\repeatintegral{2}}
\definemathcommand  [iiiint]   {\repeatintegral{3}}

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

%D If the \type{\limits} option is used after \type{\iint}, use
%D \type{\mathop} and fudge the left hand space a bit to make the
%D subscript visually centered.

\def\dorepeatintegral
    {\ifx\limits\next               \dointlimitcorrection
     \else \ifx \displaylimits\next \dointlimitcorrection
     \fi\fi
     \dodorepeatintegral}

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

\protect

\starttext

\tracingmacros=2

$$
\iint_a f(x) dx
\iint\limits_a f(x) dx
$$
$$
\iiint_a f(x) dx
$$

\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] only message in thread

only message in thread, other threads:[~2007-04-28  7:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-28  7:40 iint, iiint, etc. for math mode 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).