Hi,
The following code (Metafun documentation, thanks again Hans !) is fully understood and works very well. Sorry if I insist, but can we create a counter to avoid writing \FrameTitle{Définition 1},
\FrameTitle{Définition 2}... ?
Thus, the only invocation \startMyText ... \stopMyText, \startMyText ... \stopMyText ... this return Définition 1, Définition 2 ...
Thank you,
Fabrice
\setupbodyfont [palatino,11pt]
\setupcolors[state=start,cmyk=yes]
\definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
\definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
\defineframedtext
[MyText]
[frame=off,
background=MyFrame,
width=\textwidth,
location=right]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}
\def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread 1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}
\setMPtext{MyFrame}{}
\startuseMPgraphic{MyFrame}
path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
fill a withcolor \MPcolor{MyColor} ;
b := boundingbox p ;
fill b withcolor \MPcolor{myColor} ;
draw p withcolor white ;
\stopuseMPgraphic
\starttext
\FrameTitle{Définition 1}
\startMyText
\input knuth
\stopMyText
\FrameTitle{Définition 2}
\startMyText
\input knuth
\stopMyText
\stoptext