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: Re: amsmath features
Date: Mon, 21 Jan 2008 06:37:03 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.0.9999.0801210630120.6139@nqv-yncgbc> (raw)
In-Reply-To: <b11f605c0801200914j78ae5804j1befa2bbba17d76d@mail.gmail.com>

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
___________________________________________________________________________________


  parent reply	other threads:[~2008-01-21 11:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-20 17:14 Peter I. Hansen
2008-01-20 20:25 ` Aditya Mahajan
2008-01-21 11:37 ` Aditya Mahajan [this message]
     [not found]   ` <b11f605c0801210455m15630ce7na7d68763c8edf900@mail.gmail.com>
2008-01-21 17:57     ` Aditya Mahajan

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.DEB.0.9999.0801210630120.6139@nqv-yncgbc \
    --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).