
Am 06.03.2025 um 01:49 schrieb Joel via ntg-context:
Here is my minimum working example:
\startuseMPgraphic{FunnyFrame} picture p ; numeric w, h, o ; p := textext.rt(\MPstring{FunnyFrame}) ; w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ; p := p shifted (2o,h-ypart center p) ; draw p ; drawoptions (withpen pencircle scaled 1pt withcolor black) ; draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ; %draw boundingbox p ; setbounds currentpicture to unitsquare xyscaled(w,h) ; \stopuseMPgraphic \defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] \defineframedtext[FunnyText][frame=off,background=FunnyFrame, width=\textwidth] \def\StartFrame{\startFunnyText} \def\StopFrame {\stopFunnyText } \def\FrameTitle#1% {\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}} \setMPtext{FunnyFrame}{}
\define\sidebarA{% \placefigure[none]{}{% \FrameTitle{\strut \bf Title}% \StartFrame% Text \StopFrame% }% }%
1. Add a optional argument to \sidebarA. \starttexdefinition tolerant protected sidebarA [#1] \startplacefigure[location=none] \FrameTitle{\strut \bf Title}% \StartFrame\relax \ifparameter#1\or\pagereference[#1]\fi Text \StopFrame \stopplacefigure \stoptexdefinition
\starttext
\startparagraph \input knuth \stopparagraph\reference[myrefA]{myrefA}
\sidebarA
2. Set the reference with the optional argument. \sidebarA[myrefA] Wolfgang