Am 30.01.2015 um 17:18 schrieb Rob Heusdens <robheus@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) 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