[NTG-context] Problem with a macro
Otared Kavian
otared at gmail.com
Sun Feb 11 17:23:11 CET 2018
Hi Dalyoung,
You are right regarding the unnatural way of using \autointegral. An easy way to use the \autointegral command in a more natural way is to define one’s own macro, as in the following:
\setupmathdelimiter[integral][rightoffset=-3mu,exact=yes,factor=2]
\unexpanded\def\myint#1#2#3#4{\autointegral{#2}{#1}{#3(#4)}\,\diff #4}
\starttext
$\myint{1}{4}{f}{x}$
\startformula
\myint{0}{2\pi}{\cos(t)^2\sin}{t} = 0
\stopformula
And here is the classical \type{\int} command:
\startformula
\int_{0}^{1} g(x)\,\diff x = 1.
\stopformula
\stoptext
Best regards: OK
> On 11 Feb 2018, at 15:20, Jeong Dal <haksan at me.com> wrote:
>
> Dear Otared,
>
> As you said, it is working well.
>
> However, the numbers 1, 4 located at the top and the bottom of the integral sign which is not usual in math.
> I have seen a discussion about such an output, but I may not see the result which I want.
>
> As you see in the following example, only the 1st and the 2nd gave the output which is usual in math.
> Is still there no way to make nice output using “\startformula”?
>
> Thank you.
>
> Best regards,
>
> Dalyoung
>
> %%%%%%%%%%
> \unexpanded\def\integ#1#2#3{\math{\autointegral{#1}{#2}{#3}\diff x}}
>
> \starttext
> \math{\int_1^4 f(x) \diff x}
>
> \math{\displaystyle \int_1^4 f(x) \diff x}
>
> \startformula
> \int_1^4 f(x) \diff x
> \stopformula
>
> \integ{4}{1}{f(x)}
> \stoptext
>
>
>> If you remove the line
>> \setupmathextensible[integral][rightoffset=-3mu,exact=yes,factor=2]
>> then your example typesets well with the last beta version 2018.02.09 00:04.
>>
>> Best regards: OK
>>
>>> On 11 Feb 2018, at 09:35, Fabrice Couvreur <fabrice1.couvreur at gmail.com> wrote:
>>>
>>> Hi Hans,
>>> The macro that you proposed me worked very well but since my update of context standalone, it does not work any more.
>>> Thank you.
>>> Fabrice
>>>
>>> \setupmathextensible[integral][rightoffset=-3mu,exact=yes,factor=2]
>>>
>>> \unexpanded\def\integ#1#2#3{\math{\autointegral{#1}{#2}{#3}\diff x}}
>>>
>>> \starttext
>>> \integ{4}{1}{f(x)}
>>> \stoptext
>>> ____________________________________________________________________________
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
More information about the ntg-context
mailing list