Am 27.09.2025 um 13:52 schrieb Damien Thiriet via ntg-context:
Hello,
I am defining functions to design timelines. What I did works as long as
dates are positive, but fails with Ancien Greece or prahistory. Looks
like I do something wrong with MPvariables.
This works:
\setuppapersize [S3]
\starttext
\startreusableMPgraphic{Frise}
numeric l;
numeric a; a:= -900;
numeric b; b:= -800;
l:=abs(a-b);
draw fullsquare xyscaled (l,10);
\stopreusableMPgraphic
\reuseMPgraphic{Frise}
\stoptext
Whereas this MWE does not compile:
\setuppapersize [S3]
\starttext
\setupMPvariables[Frise][début=-900]
\setupMPvariables[Frise][fin=-800]
\startreusableMPgraphic{Frise}
numeric l;
l:=\MPvar{début}-\MPvar{fin};
l:=abs(l);
draw fullsquare xyscaled (l,10);
\stopreusableMPgraphic
\reuseMPgraphic{Frise}
\stoptext
I tried also without success:
\setupMPvariables[Frise][début={-900}]
\setupMPvariables[Frise][fin={-800}]
What is the problem here?
%%%% begin example
\startTEXpage[offset=1ts]
\startreusableMPgraphic{Frise}{début,fin}
numeric debut ; debut := \MPvar{début} ;
numeric fin ; fin := \MPvar{fin} ;
numeric l ; l := abs(debut-fin) ;
draw fullsquare xyscaled (l,10);
\stopreusableMPgraphic
\reuseMPgraphic{Frise}{début=-900,fin=-800}
\stopTEXpage
%%%% end example
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________