ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: iint, iiint, etc. for math mode
Date: Sat, 28 Apr 2007 03:40:58 -0400 (EDT)	[thread overview]
Message-ID: <alpine.WNT.0.98.0704280334220.1928@nqvgln> (raw)

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
___________________________________________________________________________________


                 reply	other threads:[~2007-04-28  7:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.WNT.0.98.0704280334220.1928@nqvgln \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).