1%D \module 2%D [ file=math-int, 3%D version=2007.07.19, 4%D title=\CONTEXT\ Math Macros, 5%D subtitle=Scripts, 6%D author={Hans Hagen \& Taco Hoekwater \& Aditya Mahajan}, 7%D date=\currentdate, 8%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] 9%C 10%C This module is part of the \CONTEXT\ macro||package and is 11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12%C details. 13 14\writestatus{loading}{ConTeXt Math Macros / Integrals} 15 16% todo: int and sum etc can be stackers 17 18\unprotect 19 20%D \startbuffer 21%D $\int _a^b f(x) dx $ and also 22%D $\iint _a^b f(x,y) dxdy$, 23%D $\iiint _a^b f(x,y) dxdy$, 24%D \startformula 25%D \int _a^b f(x) dx \quad 26%D \iint _a^b f(x) dx \quad 27%D \iiint _a^b f(x) dx \quad 28%D \stopformula 29%D \stopbuffer 30%D 31%D Default: \getbuffer 32%D 33%D Displaylimits: \setupmathematics[integral=displaylimits] \getbuffer 34%D 35%D Limits: \setupmathematics[integral=limits] \getbuffer 36 37%D Adapted to mkiv by HH from code by AM. 38 39\installcorenamespace{mathintegral} 40 41\newconstant\mathintlimitmode 42 43\def\intlimits % also used elsewhere 44 {\ifcase\mathintlimitmode 45 \nolimits 46 \or 47 \displaylimits 48 \or 49 \limits 50 \or 51 \ifnum\attribute\mathmodeattribute=\plusone 52 \limits 53 \else 54 \nolimits 55 \fi 56 \else 57 % none 58 \fi} 59 60\letvalue{\??mathintegral nolimits}\zerocount 61\letvalue{\??mathintegral displaylimits}\plusone 62\letvalue{\??mathintegral limits}\plustwo 63\letvalue{\??mathintegral autolimits}\plusthree 64\letvalue{\??mathintegral none}\plusfour 65 66\appendtoks 67 \mathintlimitmode\executeifdefined{\??mathintegral\mathematicsparameter\s!integral}\zerocount 68\to \everyswitchmathematics 69 70\setupmathematics 71% [\v!integral=nolimits] 72 [\v!integral=autolimits] 73 74%D The following code is used for fallbacks and might become obsolete once 75%D we have enough \OPENTYPE\ math fonts. 76 77% \def\math_repeated_integal_i 78% {\int} 79 80% \def\math_repeated_integal_ii 81% {\math_repeated_integal_i 82% \math_repeated_integral_kern 83% \math_repeated_integal_i 84% \math_repeat_integral_finish 85% \intlimits} 86 87% \def\math_repeated_integal_iii 88% {\math_repeated_integal_i 89% \math_repeated_integral_kern 90% \math_repeated_integal_ii} 91% 92% \def\math_repeated_integal_iiii 93% {\math_repeated_integal_i 94% \math_repeated_integral_kern 95% \math_repeated_integal_iii} 96% 97% \unexpanded\def\math_repeat_integral#1% 98% {\let\math_repeat_integral_finish\donothing 99% \iffontchar\textfont\zerocount#1\relax 100% \expandafter\math_repeat_integral_real 101% \else 102% \expandafter\math_repeat_integral_fake 103% \fi} 104% 105% \def\math_repeat_integral_fake#1#2% 106% {\let\math_repeat_integral_fake_symbol#2% 107% \futurelet\next\math_repeat_integral_fake_indeed} 108% 109% \def\math_repeat_integral_real#1#2% 110% {#1} 111% 112% \definemathcommand [iint] {\math_repeat_integral{"0222C}\normalint \math_repeated_integal_ii } % double 113% \definemathcommand [iiint] {\math_repeat_integral{"0222D}\normaliint \math_repeated_integal_iii } % tripple 114% \definemathcommand [iiiint] {\math_repeat_integral{"FFFFF}\normaliiint\math_repeated_integal_iiii} % quadruple 115% 116% \def\math_repeated_integral_kern 117% {\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} 118% 119% \def\math_repeat_integral_fake_indeed 120% {\ifx\next\limits 121% \math_repeated_integral_correction 122% \else\ifx\next\displaylimits 123% \math_repeated_integral_correction 124% \else\ifx\next\nolimits 125% % nothing 126% \else\ifcase\mathintlimitmode 127% % nothing 128% \else 129% \math_repeated_integral_correction 130% \fi\fi\fi\fi 131% \math_repeat_integral_fake_symbol} 132% 133% \def\math_repeated_integral_correction 134% {\mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% 135% \mathop\bgroup\mkern7mu\mathchoice{\mkern2mu}{}{}{}\let\math_repeat_integral_finish\egroup} 136% 137% %D If the \type{\limits} option is used after \type {\iint}, use \type 138% %D {\mathop} and fudge the left hand space a bit to make the subscript 139% %D visually centered. 140 141\protect \endinput 142 |