seyal.zavira@gmail.com schrieb am 14.05.2024 um 09:57:
Hi all,
what is the better way to apply a metapost effect to a piece of any structure text for example when defining footnotes, frames , etc. i use this method for frames:
this is my MWE: \defineframed[Myframe][frame=off] \starttexdefinition spaces protected Mystyle #1 \startMPcode picture tt ; tt:= lmt_outline [ kind = "path", text = "\Myframe{#1}", ]; fill for i within tt : pathpart i && endfor cycle withshademethod "linear" withshadedirection up withshadecolors (red,blue); \stopMPcode \stoptexdefinition
\starttext \Mystyle{hello} \stoptext
but what is the proper way if i want to use this style as simple as \tfb in definition of this structures? such as: \defineframed[Myframe][frame=off,style=\tfb\Mystyle,]
You can't apply commands which take arguments (like \Mystyle) to pass content fro TeX to Metapost with the style key. The only solution here is to create a new commands which takes the content as argument and combine the frame and shade in the command definition. \defineframed[Myframe][frame=off] \starttexdefinition spaces protected Mystyle #1 \startMPcode picture tt ; tt:= lmt_outline [ kind = "path", text = "#1", ]; fill for i within tt : pathpart i && endfor cycle withshademethod "linear" withshadedirection up withshadecolors (red,blue); \stopMPcode \stoptexdefinition \define[1]\Mycommand {\Myframe{\Mystyle{#1}}} % \define[1]\Mycommand % {\Mystyle{\Myframe{#1}}} \starttext \Mycommand{hello} \stoptext Wolfgang