Hi Wolfgang, 

Indeed your solution works without any flaw…
Looking at your code, I learned that Overlaybox is an object which can be 
filled with a background color, as in:
        fill OverlayBox withcolor lightgray ;    
so that the background can be in color.

Should we add this kind of problems and solutions to the wiki?
If yes, I am willing to do so.

Best regards: OK

On 18 oct. 2010, at 17:22, Wolfgang Schuster wrote:

> 
> Am 18.10.2010 um 14:18 schrieb Otared Kavian:
> 
>> Your solution works as intended when the framed, highlighted text with 
>> background spans over two pages (though it doesn't when it spans over three 
>> pages or more, but this is not a real issue, since it is a bad idea to have 
>> such long highlighted texts…).
> 
> 
> I guess this is also possible with textbackground:
> 
> \newcounter\CurrentBackground
> 
> \def\StartBackground
>  {\doglobal\increment\CurrentBackground
>   \setposition{Background:b:\CurrentBackground}%
>   \startbackground}
> 
> \def\StopBackground
>  {\stopbackground
>   \setposition{Background:e:\CurrentBackground}}
> 
> \def\DrawBackground
>  
> {\ifnum\MPp{Background:b:\CurrentBackground}=\MPp{Background:e:\CurrentBackground}
>     \startMPcode
>     draw topboundary    OverlayBox withcolor red ;
>     draw bottomboundary OverlayBox withcolor red ;
>     draw leftboundary   OverlayBox withcolor red ;
>     draw rightboundary  OverlayBox withcolor red ;
>     \stopMPcode
>   \else\ifnum\realpageno=\MPp{Background:b:\CurrentBackground}
>     \startMPcode
>     draw topboundary    OverlayBox withcolor red ;
>     draw leftboundary   OverlayBox withcolor red ;
>     draw rightboundary  OverlayBox withcolor red ;
>     \stopMPcode
>   \else\ifnum\realpageno=\MPp{Background:e:\CurrentBackground}
>     \startMPcode
>     draw bottomboundary OverlayBox withcolor red ;
>     draw leftboundary   OverlayBox withcolor red ;
>     draw rightboundary  OverlayBox withcolor red ;
>     \stopMPcode
>   \else
>     \startMPcode
>     draw leftboundary   OverlayBox withcolor red ;
>     draw rightboundary  OverlayBox withcolor red ;
>     \stopMPcode
>   \fi\fi\fi}
> 
> \defineoverlay[DrawBackground][\DrawBackground]
> 
> \starttext
> 
> \setupbackground[background=DrawBackground]
> 
> \input knuth
> 
> \StartBackground
> \dorecurse{12}{\input knuth\par}
> \StopBackground
> 
> \input knuth
> 
> \StartBackground
> \input knuth\par
> \StopBackground
> 
> \input knuth
> 
> \stoptext
> 
> Wolfgang
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to