[NTG-context] Mathematical MetaFun Mania
Otared Kavian
otared at gmail.com
Thu Dec 15 22:54:12 CET 2022
Hi Hans,
Thanks for the new release and the nice anchoring features.
I played a little bit with these, and noticed some issues: in the following example, linking the bottom bounds of the integral signs is fine (as long as numbers are put there), but for the upper bounds, the \infty and \pi/2 are not accepted (nor is any letter or greek symbol), but if one replaces \infty and \pi/2 with numbers, then the link between the upper bounds is shown. (In this example the links are invading the text, but probably this is due to the fact that I just copied the Metapost snippet you sent to Gavin).
Best regards: Otared
% begin anchoring-integrals.tex
\starttext
\startMPpositiongraphic{mypos:boxanchor:top}
begingroup ;
save f, t, p ;
pair f, t ;
path p ;
f := positionxy(mpvars("from")) ;
t := positionxy(mpvars("to")) ;
p := f { up } .. t ;
drawarrow p
withpen pencircle scaled mpvard "rulethickness"
withcolor mpvars "linecolor" ; % historically different names
positioninregion ;
endgroup ;
\stopMPpositiongraphic
\startMPpositiongraphic{mypos:boxanchor:bottom}
begingroup ;
save f, t, p ;
pair f, t ;
path p ;
f := positionxy(mpvars("from")) ;
t := positionxy(mpvars("to")) ;
p := f { down } .. t ;
drawarrow p
withpen pencircle scaled mpvard "myrulethickness"
withcolor mpvars "linecolor" ; % historically different names
positioninregion ;
endgroup ;
\stopMPpositiongraphic
\input thuan.tex
\startboxanchoring[+]
\connectboxanchors[top][top]
[distance=1ex,
rulethickness=1pt,
rulecolor=darkgreen,
mp=mypos:boxanchor:top]{b1}{b3}
\connectboxanchors[bottom][bottom]
[distance=1ex,
myrulethickness=1pt,
rulecolor=darkred,
mp=mypos:boxanchor:bottom]{b2}{b4}
\startformula
\int_{\mathboxanchored[nucleus]{b2}0}^{\mathboxanchored[nucleus]{b1}\infty} \frac{\dd x}{1 + x^2} = \int_{\mathboxanchored[nucleus]{b4}0}^{\mathboxanchored[nucleus]{b3}\pi/2}(1 + \tan(\theta)^2)\frac{\dd \theta}{1 + \tan(\theta)^2} = \frac{\pi}{2}
\stopformula
\input thuan.tex
\stopboxanchoring
\stoptext
% end anchoring-integrals
> On 15 Dec 2022, at 18:21, Hans Hagen via ntg-context <ntg-context at ntg.nl> wrote:
>
> On 12/15/2022 5:15 PM, Gavin wrote:
>> Hi Hans and List,
>>>> 2) Can I tell \connectboxanchors to use my MetaPost code and pass key=value pairs like I do with \setMPpositiongraphic?
>>> see attached ... the 'cross pages' feature is in the upcoming
>> This indeed passes key=value pairs, but I cannot get it to pass mine. Is there some intermediate step? Your example has a key=value pair in \connectboxanchors and which is accessed in the MetaPost code. The pair, and MetaPost code are:
>> rulethickness=1pt
>> mpvard “rulethickness"
>> However, if I change the pair and MPcode to (see attached example for full code)
>> myrulethickness=1pt
>> mpvard “myrulethickness"
>> it doesn’t work. Similarly, you have a pair and MPcode that don’t match.
>> rulecolor=darkgreen
>> mpvars "linecolor"
>> This may be a historical fluke, but it suggests that there is some intermediate translation that I am missing. Any way I can name and pass by own key=value pairs?
> I updated lmtx so you can test it again.
>
> Hans
>
> ps. For the adventurous some bonus experiment in the engine:
>
> \def\ccc#1#2#3#4#5#6#7#8#9#A#B#C#D#E#F%
> {\def\ddd{#A-#D-#E/#F-#4-#1}%
> #A-#D-#E/#F-#4-#1+\ddd}
>
> so, upto 15 arguments:
>
> [[\ccc123456789abcdef]]
>
> (not that we need it in the context core, so more a gimmick for users and it fits the much is already hex approach)
>
> Hans
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___________________________________________________________________________________
Otared Kavian
e-mail: otared at gmail.com
Phone: +33 6 88 26 70 95
More information about the ntg-context
mailing list