Framed text and pageboundary

I use in my environment file the following definition for framed text:

``````\defineframed[achtergrond]
[frame=off,
background=color,
backgroundcolor=gray,
width=fit,
height=fit,
offset=2ex,
align={flushleft,nothyphenated,verytolerant}]
``````

However, this interferes with page breaking. On the last section of every chapter I want to use a grey background for the text. The text consists solely of the section title and an itemization. This text can overflow the page. When I use the frame defined above, the page break does not occur and part of the text flows over the page boundary. Instead of manually having to insert where to break the page, how can I get a section with a grey background (and also, normal alignment just like the body text of other sections)?

• Use backgrounds or textbackgrounds instead of framed. – Aditya Jan 30 '15 at 15:49

Thanks to Wolfgang Schuster I now have a solution that works, except for one little detail. Using textbackgrounds enables the section to flow over page boundaries, and display the textbackground nicely behind the text.

The solution was:

``````\defineblank[sprong][.5cm]

\definetextbackground
[SummaryBackground]
[frame=off,frameoffset=0pt,
background=color,
backgroundcolor=gray,
backgroundoffset=2ex]

[number=no,style=bold,before=,
after={\blank[sprong]},
beforesection={\noindentation\page\starttextbackground[SummaryBackground]},
aftersection={\stoptextbackground\page}]
``````

This almost was ok. Since I only used an itemize in that section, and itemize standard emits a blank after, in some cases that blank line appeared solsely on the next page with a background. To correct that, I used:

``````\defineitemgroup[samenvatting]
\setupitemgroup[samenvatting][each][standard,joinedup]
``````

So that no space before or after this new itemgroup appears which solves the problem of the spurious empty blank line with background on a page on it's own.

What I could not yet solve is that the summary section now appears 1 line lower then other text (on other pages of regular sections), and didn't succeed in solving that.

Anyone any idea how to solve that?