# Re: [NTG-context] Grey background for pages belonging to last section of every chapter

>
>> Am 30.01.2015 um 17:18 schrieb Rob Heusdens <robh...@xs4all.nl>:
>>
>>> Hello list,
>>>
>>> For the last section of every chapter I want a grey background for the
>>> text, which otherwise should look the same as every other section,
>>> except
>>> that it starts on a new page (I can set that by defining my own section
>>> command).
>>>
>>> The last section summarizes the chapter.
>>>
>>> My current implementation is using a frame:
>>>
>>>
>>> \defineframed[achtergrond]
>>>    [frame=off,
>>>    background=color,
>>>    backgroundcolor=gray,
>>>    width=fit,
>>>    height=fit,
>>>    offset=2ex,
>>>    align={flushleft,nothyphenated,verytolerant}]
>>>
>>> And use it as:
>>>
>>> \achtergrond{
>>> \section{Last section}
>>>
>>> \startitemize[n]
>>> \item ...
>>> \stopitemize
>>> }
>>>
>>> But this does not accomodate sections longer then a page. And I can't
>>> place \page command in the middle of an itemize, and using
>>> \stopitemize,
>>> \startitemize[continue] makes the pages vary in sizes.
>>>
>>> Is there some way to achieve the desired effect (grey background behind
>>> the text, and otherwise page layour identical to other sections)
>>> without
>>> the problem that text exceeds the page size?
>>>
>>> Greetings,
>>>
>>> Rob
>>>
>>> PS. The defined frame is also used elsewhere, but the last section
>>> should
>>> in fact not have normal alignment like the other sections.
>>>
>>>
>>>
>>
>> What perhaps fixes this problem is defining my own section command like
>> this:
>>
>>
>>     [
>>     number=no,
>>     style=bold,
>>     before={\page\setupbackgrounds[text][text][state=start]
>>                                   [background=color,backgroundcolor=gray]},
>>     after={\setupbackgrounds[text][text][state=stop]}
>>     ]
>>
>> According to the wiki
>> (http://wiki.contextgarden.net/Command/setupbackgrounds
>> <http://wiki.contextgarden.net/Command/setupbackgrounds>) that should
>> work,
>> but Context doesn't seem to understand the syntax and prints the part:
>> "[background=color,backgroundcolor=gray]" before the section title.
>>
>> What did I do wrong?
>
> 1. Put both assignments in the same argument, i.e. change
>
>
> \setupbackgrounds[text][text][state=start][background=color,backgroundcolor=gray]
>
> to
>
>
> \setupbackgrounds[text][text][state=start,background=color,backgroundcolor=gray]
>
> 2. You have to finish the page before you disable the coloured background.
>
>   after={\page\setupbackgrounds[â¦]}
>
> Wolfgang

Hello Wolfgang,

Yes, of course! I misinterpreted it, but now I see there is in fact only 3
options, not 4. I was misdirected by the 4 lines displayed below the
command explaining the syntax.

Problem is however resetting the background. In the after option of
\setuphead will not work, the \page is ejected directly after the section
title. I want to reset to normal background after the section itself
finishes. After this special section (summary) always a new chapter begins
(except perhaps the last summary).

Should I add that manually as the last command of every summary (where
also the chapter ends), or is there some way to perform a command after
the summary itself (at the location where one would place \stopsummary if
using the \startsummary syntax) ends?

The background should only be displayed behind the text itself, not the
whole text area (so if a section ends halfway of the page, the bottom part
should have no background) with some extra space surrounding it
(above,below,left,right) using the offset or perhaps backgroundoffset
options of \setupframed).

Greetings,

Rob

___________________________________________________________________________________