Here is another approach
% small extension to underbar, accepts [settings]
\unprotected \def\underbarparameter#1{\getvalue{\??on#1}}
\unexpanded\def\dounderbar#1%
{\let\betweenisolatedwords#1%
\dosingleempty\redounderbar}
\unexpanded\def\redounderbar[#1]#2%
{\iffirstargument\setupunderbar[#1]\fi
\processisolatedwords{#2}\dodounderbar
\egroup}
% roughly the same
\startuniqueMPgraphic{underline}{color,width,height,depth}
numeric w,h; w := \MPvar{width} ; h := \MPvar{height} ; d := \MPvar{depth} ;
path p; p := (0, -h)..(w/2,0 + (h/3 randomized h/3))..(w, -h);
p := p shifted (0,-d) ;
draw p withpen pencircle scaled 1 withcolor \MPvar{color} ;
setbounds currentpicture to unitsquare xyscaled
(OverlayWidth,OverlayHeight); \stopuniqueMPgraphic
hook into underbar:
\unprotect
\def\underbarmethodx#1#2#3% mp
{\hbox to #1{\uniqueMPgraphic
{underline}{width=#1,height=#2,depth=\underbarparameter\c!bottomoffset,color=\underbarparameter\c!color}}}
\protect
% usage:
\setupunderbar[alternative=x,bottomoffset=1ex,color=red]
\startitemize
\item test: \underbars[color=blue]{how are you?}
\item test: \underbars{how are you?}
\item test: \underbars{how are you?}
\stopitemize
\stoptext
in your case, in order to make the graphic unique, you need to pass the second
arg in order to make them unique (uniqueness is determined by dimensions and a
few more things; another option would be to use the backgroundcolor of inframed
which is accessible by \OverlayColor and also determines uniqueness
\startuniqueMPgraphic{underline}{color}
alternative
\startuniqueMPgraphic{underline}
numeric w,h; w := OverlayWidth; h := ExHeight/6;
path p; p := (0, -h)..(w/2,0 + (h/3 randomized h/3))..(w, -h);
draw p withpen pencircle scaled 1 withcolor OverlayColor ;
setbounds currentpicture to unitsquare xyscaled
(OverlayWidth,OverlayHeight); \stopuniqueMPgraphic
\defineoverlay[underline][\uniqueMPgraphic{underline}]
\def\aidul{\dosingleempty\doaidul}
\def\doaidul[#1]{\inframed[background=underline,frame=off,#1]}
\setupcolors[state=start]
\startitemize
\item test: \aidul[backgroundcolor=red]{how} \aidul[color=green]{are}
\aidul[color=blue]{you?}
\item test:\aidul[backgroundcolor=blue]{how} \aidul[color=green]{how}
\aidul[color=red]{how}
\stopitemize
Hans
-
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context