Vianney le Clément wrote:
Hello,
I'm having some trouble with a macro using \processaction inside a
metapost graphic. Here is a minimal example.
\def\Shape#1%
{\processaction[#1]
[square=unitsquare,
circle=unitcircle]}
\starttext
\startuseMPgraphic{test}
fill \Shape{square} scaled
On Thu, May 13, 2010 at 09:30, Taco Hoekwater t...@elvenkind.com wrote:
Like many of the more complex commands, \processaction does not
expand totally. If you are using mkiv, you could define \Shape
like this:
\def\Shape#1%
{\directlua{
local known = {square = 'unitsquare', circle =
2010/5/13 Vianney le Clément vleclem...@gmail.com:
On Thu, May 13, 2010 at 09:30, Taco Hoekwater t...@elvenkind.com wrote:
Like many of the more complex commands, \processaction does not
expand totally. If you are using mkiv, you could define \Shape
like this:
\def\Shape#1%
{\directlua{
On 13-5-2010 11:13, luigi scarso wrote:
\setevalue{square}{unitsquare}
\setevalue{circle}{unitcircle}
\starttext
\startuseMPgraphic{test}
fill \getvalue{square} scaled 1cm;
\stopuseMPgraphic
\useMPgraphic{test}
\stoptext
or
\setevalue{mynamespace:square}{unitsquare}
\getparameters[Shape][square={unitsquare },
circle={unitcircle }]
\starttext
\startuseMPgraphic{test}
fill \Shapesquare scaled 1cm;
\stopuseMPgraphic
\useMPgraphic{test}
\stoptext
This one's very nice. Thanks.
Vianney
2010/5/13 Vianney le Clément vleclem...@gmail.com:
\getparameters[Shape][square={unitsquare },
circle={unitcircle }]
\starttext
\startuseMPgraphic{test}
fill \Shapesquare scaled 1cm;
\stopuseMPgraphic
\useMPgraphic{test}
\stoptext
This one's very nice. Thanks.
becareful at the spaces at the end, ie
\getparameters[Shape][square={unitsquare},
circle={unitcircle}]
doesn't work.
That's logical, because \Shapesquare eats the spaces following it. In
my case, I define my macros like
\getparameters[Shape:]
[square=unitsquare,
Hello,
I'm having some trouble with a macro using \processaction inside a
metapost graphic. Here is a minimal example.
\def\Shape#1%
{\processaction[#1]
[square=unitsquare,
circle=unitcircle]}
\starttext
\startuseMPgraphic{test}
fill \Shape{square} scaled 1cm;
\stopuseMPgraphic