ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Rob Heusdens" <robheus@xs4all.nl>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: Grey background for pages belonging to last section of every chapter
Date: Fri, 30 Jan 2015 18:17:11 +0100	[thread overview]
Message-ID: <ff90ce78efb46ffa1a994404b8fde17e.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <475204C3-A90A-404E-BBB9-2323A3703E96@gmail.com>

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2015-01-30 17:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 15:13 Rob Heusdens
2015-01-30 16:18 ` Rob Heusdens
2015-01-30 16:34   ` Wolfgang Schuster
2015-01-30 17:17     ` Rob Heusdens [this message]
2015-01-30 17:27       ` Wolfgang Schuster
2015-01-30 18:28         ` Rob Heusdens
2015-01-30 19:05           ` Wolfgang Schuster
2015-01-30 20:36             ` Rob Heusdens
2015-01-30 20:43             ` Rob Heusdens
2015-02-02 11:51               ` Wolfgang Schuster
2015-02-02 13:00                 ` TOC with " Keith J. Schultz
2015-02-02 22:23                   ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff90ce78efb46ffa1a994404b8fde17e.squirrel@webmail.xs4all.nl \
    --to=robheus@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).