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

Wolfgang Schuster schuster.wolfgang at gmail.com
Fri Jan 30 17:34:50 CET 2015


> Am 30.01.2015 um 17:18 schrieb Rob Heusdens <robheus at 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:
> 
> \definehead[summary][section]
> 
> \setuphead[summary]
>     [
>     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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150130/5ffd8254/attachment.html>


More information about the ntg-context mailing list