From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/17563 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Problems with uniqueMPgraphic Date: Fri, 17 Dec 2004 12:14:06 +0100 Message-ID: <41C2BF7E.4070300@wxs.nl> References: <864qimjl73.fsf@oumu.localdomain> <41C2B9B5.9030203@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1103282059 20093 80.91.229.6 (17 Dec 2004 11:14:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Dec 2004 11:14:19 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Dec 17 12:14:11 2004 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CfG3n-0004me-00 for ; Fri, 17 Dec 2004 12:14:11 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DB0E7127A0; Fri, 17 Dec 2004 12:14:10 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17926-03; Fri, 17 Dec 2004 12:14:07 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9647212775; Fri, 17 Dec 2004 12:14:07 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D485612775 for ; Fri, 17 Dec 2004 12:14:06 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17816-05 for ; Fri, 17 Dec 2004 12:14:06 +0100 (CET) Original-Received: from mailrelay01.solcon.nl (unknown [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 1806D12771 for ; Fri, 17 Dec 2004 12:14:06 +0100 (CET) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay01.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id iBHBE3md004245 for ; Fri, 17 Dec 2004 12:14:03 +0100 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id 7920F17BF8; Fri, 17 Dec 2004 12:13:32 +0100 (CET) Original-Received: from [10.100.1.191] (unknown [10.100.1.191]) by server-1.pragma-net.nl (Postfix) with ESMTP id 76AC51798F for ; Fri, 17 Dec 2004 11:13:31 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <41C2B9B5.9030203@wxs.nl> X-Virus-Scanned: ClamAV 0.80/540/Tue Oct 19 14:59:23 2004 clamav-milter version 0.80j on mailrelay01 X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl Xref: main.gmane.org gmane.comp.tex.context:17563 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:17563 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 -----------------------------------------------------------------