Le 8 mai 13 à 06:56, Wolfgang Schuster a écrit :
Am 07.05.2013 um 22:28 schrieb Roland Thiers
<roland.thi...@gmail.com>:
Thank you very much for this precision, Wolfgang. I tried with two
variables and it works with this
syntax :
\startuniqueMPgraphic{polygoneregulier}
numeric u ; u:=\MPvar{unite}*cm ;
numeric n ; n:=\MPvar{sides};
rest of the code
\stopuniqueMPgraphic
\define[2]\polyreg
{\setupMPvariables[polygoneregulier][unite,sides]
\uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}}
You can define the command as
\define[2]\polyreg
{\setupMPvariables[polygoneregular][sides=#1,unite=#2]%
\uniqueMPgraphic{polygoneregular}}
where the variables are set with the \settupMPvariables command or as
\define[2]\polyreg
{\uniqueMPgraphic{polygoneregular}{sides=#1,unite=#2}}
where the variables are set in the optional argument for
\uniqueMPgraphic.
\starttext
%\uniqueMPgraphic{polygoneregulier}{unite=2,sides=4}
\polyreg{6}{0.5}
\stoptext
I did not find any détails on \MPvar et \setupMPvariables on the
wiki, however
Both commands are mentioned in the metafun [1] manual.
[1] http://www.pragma-ade.nl/show-man-7.htm
Wolfgang
Thank you Wolfgang for the correction of the syntax. I bought the
Metafun manual and began to work with it.
Great !
Roland
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________