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

Rob Heusdens robheus at xs4all.nl
Fri Jan 30 17:18:43 CET 2015


> 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) 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?

Greetings,

Rob





More information about the ntg-context mailing list