ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Emanuele Sacco <emanuelesacco@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: background over two page
Date: Sat, 16 Oct 2010 17:30:08 +0200	[thread overview]
Message-ID: <AANLkTimqUDesa94dWZam+UieG_R5EqHv-degO00HDG=-@mail.gmail.com> (raw)
In-Reply-To: <AANLkTim9uWLz4XzECSKC6EbuwyC++bT2yeg64w1HuXXz@mail.gmail.com>

A solution by Luigi:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\SpaceLeft
\def\CheckSpace{%
\ifdim\pagetotal=0pt\SpaceLeft=\vsize\else\SpaceLeft=\pagegoal\advance\SpaceLeft
 by -\pagetotal\advance\SpaceLeft by -2\lineheight\fi}%


\setupcolors[state=start]


\long\def\StartBg#1\StopBg{%
\bgroup
\setbox8000=\vbox{\hsize=\dimexpr\textwidth-1em\relax#1}
\CheckSpace% \the\SpaceLeft\the\ht8000 \the\dp8000
\ifdim\dimexpr(\ht8000+\dp8000)>\SpaceLeft\relax
%
\setbox8001=\vsplit8000 to \SpaceLeft%
\setbox8001=\vbox{\unvbox8001}%
%
\setupbackground
[bottomframe=off,
rulethickness=1pt,
rightframe=on,width=\textwidth,
leftframe=on]
\startbackground\unvbox8001\stopbackground%

\setupbackground
[bottomframe=on,
rulethickness=1pt,
rightframe=on,width=\textwidth,
leftframe=on]
\startbackground\unvbox8000\stopbackground%
\else
\setupbackground
[bottomframe=on,
rulethickness=1pt,
rightframe=on,
leftframe=on]
\startbackground #1\stopbackground%
\fi
\egroup
}

\setupbackground
[bottomframe=on,
rulethickness=1pt,
rightframe=on,
leftframe=on]

\starttext

\startbackground
\input knuth
\stopbackground

e poi

\StartBg
\input knuth
\input knuth
\input knuth
\StopBg

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



An alternative solution with the command \definetextbackground:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setupcolors[state=start]
\enableregime[utf]
\def\Linea{\startMPcode
 draw (0,0) -- (\the\textwidth-1,0) withpen pencircle scaled 1bp withcolor red;
\stopMPcode
}
\definetextbackground
[Prova]
[
mp=background:mp,
location=paragraph,
rulethickness=1pt,
width=broad,
leftoffset=1em,
rightoffset=1em,
after={\Linea}
]
\startuseMPgraphic{background:mp}
path p;
for i = 1 upto nofmultipars :
p = (multipars[i]
topenlarged 5pt
bottomenlarged 10pt);
fill p withcolor lightgray ;
draw leftboundary p withpen pencircle scaled 1bp withcolor red ;
draw rightboundary p withpen pencircle scaled 1bp withcolor red ;
endfor;
\stopuseMPgraphic


\starttext

\startProva
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\stopProva

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

bye

ES

2010/10/14 luigi scarso <luigi.scarso@gmail.com>:
> On Thu, Oct 14, 2010 at 11:05 AM, Emanuele Sacco
> <emanuelesacco@gmail.com> wrote:
>> Hi all,
>>
>> I'm using context MkII.
>> My code is
>>
>>
>> \setupcolors[state=start]
>> \setupbackground
>> [bottomframe=on,
>> rulethickness=1pt,
>> rightframe=on,
>> leftframe=on]
>>
>> \starttext
>> Good:
>> \startbackground
>> \input knuth
>> \stopbackground
>>
>> Not good:
>>
>> \startbackground
>> \input knuth
>> \input knuth
>> \input knuth
>> \stopbackground
>> \stoptext
>>
>>
>>
>> The second backgrounded text is on two pages. Is there a way to not
>> show the bottomframe at the end of the first page?
>> thanks
>>
>> ES
>> --
>> Al mondo ci sono 10 tipi di persone: quelli che conoscono il sistema
>> binario e quelli che non lo conoscono.
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>>
>
> As always  my pov: a wrapper macro.
>
> \showframe
> \newdimen\SpaceLeft
> \def\CheckSpace{%
> \ifdim\pagetotal=0pt\SpaceLeft=\vsize\else\SpaceLeft=\pagegoal\advance\SpaceLeft
>  by -\pagetotal\advance\SpaceLeft by -2\lineheight\fi}%
>
>
> \setupcolors[state=start]
>
>
> \long\def\StartBg#1\StopBg{%
> \bgroup
> \setbox8000=\vbox{#1}
> \CheckSpace% \the\SpaceLeft\the\ht8000 \the\dp8000
> \ifdim\dimexpr(\ht8000+\dp8000)>\SpaceLeft\relax
> %
> \setbox8001=\vsplit8000 to \SpaceLeft%
> \setbox8001=\vbox{\unvbox8001}%
> %
> \setupbackground
> [bottomframe=off,
> rulethickness=1pt,
> rightframe=on,
> leftframe=on]
> \startbackground\unvbox8001\stopbackground%
>
> \setupbackground
> [bottomframe=on,
> rulethickness=1pt,
> rightframe=on,
> leftframe=on]
> \startbackground\unvbox8000\stopbackground%
> \else
> \setupbackground
> [bottomframe=on,
> rulethickness=1pt,
> rightframe=on,
> leftframe=on]
> \startbackground #1\stopbackground%
> \fi
> \egroup
> }
>
> \setupbackground
> [bottomframe=on,
> rulethickness=1pt,
> rightframe=on,
> leftframe=on]
>
> \starttext
> Good:
> \startbackground
> \input knuth
> \stopbackground
>
> Not good:
>
> \StartBg
> \input knuth
> \input knuth
> \input knuth
> \StopBg
>
> \stoptext
>
>
>
> --
> luigi
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>



-- 
Al mondo ci sono 10 tipi di persone: quelli che conoscono il sistema
binario e quelli che non lo conoscono.
___________________________________________________________________________________
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	other threads:[~2010-10-16 15:30 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 [this message]
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

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='AANLkTimqUDesa94dWZam+UieG_R5EqHv-degO00HDG=-@mail.gmail.com' \
    --to=emanuelesacco@gmail.com \
    --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).