From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: background over two page
Date: Wed, 3 Aug 2011 11:08:29 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.02.1108031106350.20717@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <6D2C32DB-832A-4038-911B-8E705C558AED@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3067 bytes --]
Reviving an old thread because I found a really simple solution. Hopefully
this will also be useful to someone else.
On Mon, 18 Oct 2010, 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]
>
> \setupbackground[background=DrawBackground]
A much simpler solution using textbackgrounds:
\startuseMPgraphic{splitframe}
for i=1 upto nofmultipars :
if one_piece_multi_par :
draw multipars[i] ;
elseif multilocs[i]=1 :
draw topboundary multipars[i] ;
draw leftboundary multipars[i] ;
draw rightboundary multipars[i] ;
elseif multilocs[i]=2 :
draw leftboundary multipars[i] ;
draw rightboundary multipars[i] ;
elseif multilocs[i]=3 :
draw leftboundary multipars[i] ;
draw rightboundary multipars[i] ;
draw bottomboundary multipars[i];
fi ;
endfor ;
\stopuseMPgraphic
\definetextbackground
[splitframe]
[state=start,
mp=splitframe,
location=paragraph]
\starttext
\startsplitframe
\input knuth \endgraf
\stopsplitframe
\blank[big]
\startsplitframe
\dorecurse{4}{\input knuth \endgraf}
\stopsplitframe
\blank[big]
\startsplitframe
\dorecurse{10}{\input knuth \endgraf}
\stopsplitframe
\stoptext
Aditya
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
prev parent reply other threads:[~2011-08-03 15:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 9:05 Emanuele Sacco
2010-10-14 9:37 ` luigi scarso
2010-10-16 15:30 ` Emanuele Sacco
2010-10-18 7:32 ` Otared Kavian
2010-10-18 7:43 ` luigi scarso
2010-10-18 12:18 ` Otared Kavian
2010-10-18 15:22 ` Wolfgang Schuster
2010-10-18 20:20 ` Otared Kavian
2011-08-03 15:08 ` Aditya Mahajan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.02.1108031106350.20717@ybpnyubfg.ybpnyqbznva \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).