seyal.zav...@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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___________________________________________________________________________________

Reply via email to