* Problems with uniqueMPgraphic @ 2004-12-16 15:51 Adam Duck 2004-12-17 10:49 ` Hans Hagen 0 siblings, 1 reply; 5+ messages in thread From: Adam Duck @ 2004-12-16 15:51 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 30 bytes --] I have this small test case: [-- Attachment #2: test.tex --] [-- Type: application/x-tex, Size: 798 bytes --] [-- Attachment #3: Type: text/plain, Size: 205 bytes --] and it comes out with the wrong colors. So, I think I know that this is because of the same dimensions but I want to have different colors for the same overlay-dimensions. How do I do that? bye, Adam. [-- Attachment #4: Type: text/plain, Size: 139 bytes --] _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with uniqueMPgraphic 2004-12-16 15:51 Problems with uniqueMPgraphic Adam Duck @ 2004-12-17 10:49 ` Hans Hagen 2004-12-17 11:14 ` Hans Hagen 0 siblings, 1 reply; 5+ messages in thread From: Hans Hagen @ 2004-12-17 10:49 UTC (permalink / raw) Adam Duck wrote: > I have this small test case: > > > > ------------------------------------------------------------------------ > > > and it comes out with the wrong colors. So, I think I know that this > is because of the same dimensions but I want to have different colors > for the same overlay-dimensions. How do I do that? \setupcolors[state=start] ----------------------------------------------------------------- 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 ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with uniqueMPgraphic 2004-12-17 10:49 ` Hans Hagen @ 2004-12-17 11:14 ` Hans Hagen 2004-12-18 0:40 ` Adam Duck 0 siblings, 1 reply; 5+ messages in thread From: Hans Hagen @ 2004-12-17 11:14 UTC (permalink / raw) 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 ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with uniqueMPgraphic 2004-12-17 11:14 ` Hans Hagen @ 2004-12-18 0:40 ` Adam Duck 2004-12-18 22:35 ` h h extern 0 siblings, 1 reply; 5+ messages in thread From: Adam Duck @ 2004-12-18 0:40 UTC (permalink / raw) Hans Hagen <pragma@wxs.nl> writes: [... stuff I didn't understand ...] > 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] Thanks for the fast response and the many lines you've written (although I didn't understand everything). The OverlayColor works fine and as underlining is in the background, I'll take this aproach. So, one last question remains: why doesn't this work? \def\uli{backgroundcolor=peachpuff} \aidul[\uli]{test} bye, Adam. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with uniqueMPgraphic 2004-12-18 0:40 ` Adam Duck @ 2004-12-18 22:35 ` h h extern 0 siblings, 0 replies; 5+ messages in thread From: h h extern @ 2004-12-18 22:35 UTC (permalink / raw) Adam Duck wrote: >>\def\aidul{\dosingleempty\doaidul} >>\def\doaidul[#1]{\inframed[background=underline,frame=off,#1]} > So, one last question remains: why doesn't this work? > > \def\uli{backgroundcolor=peachpuff} \aidul[\uli]{test} parsing .... \def\doaidul[#1]{\expanded{\inframed[background=underline,frame=off,#1]}} would work however, in that case i'd go for: \def\doaidul[#1]{\inframed[background=underline,frame=off,backgroundcolor=#1]} \definecolor[important][red] \definecolor[notimportant][green] and \aidul[important]{test} as well as \aidul[notimportant]{test} since one can redefine the colors 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 ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-12-18 22:35 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-12-16 15:51 Problems with uniqueMPgraphic Adam Duck 2004-12-17 10:49 ` Hans Hagen 2004-12-17 11:14 ` Hans Hagen 2004-12-18 0:40 ` Adam Duck 2004-12-18 22:35 ` h h extern
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).