ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: "Jan U. Hasecke" <juh+ntg-context@mailbox.org>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Manipulating the left blank page when chapter starts on the right page
Date: Mon, 14 Jan 2019 19:25:48 +0100	[thread overview]
Message-ID: <09135ba1-2522-62e9-c634-2dceb90d235e@gmail.com> (raw)
In-Reply-To: <d88401b5-1ada-6f97-ee9b-f0e8fe83cb45@mailbox.org>

Jan U. Hasecke schrieb am 14.01.19 um 08:39:
> 
> Am 13.01.19 um 16:56 schrieb Wolfgang Schuster:
> 
>> Here is a example which shows how you can change the background color
>> of a empty page before the chapter title.
>>
>> \setuppagenumbering
>>    [alternative=doublesided]
>>
>> \startsetups [chapter:before]
>>    \doifoddpageelse
>>      {}
>>      {\pushbackground[page]
>>       \setupbackgrounds[page][background=color,backgroundcolor=black]
>>       \page[empty,right]
>>       \popbackground}
>> \stopsetups
>>
>> \setuphead
>>    [chapter]
>>    [page=yes,
>>     before=\directsetup{chapter:before}]
>>
>> \starttext
>>
>> \startchapter[title={Knuth}]
>> \dorecurse{10}{\samplefile{knuth}}
>> \stopchapter
>>
>> \startchapter[title={Zapf}]
>> \dorecurse{10}{\samplefile{zapf}}
>> \stopchapter
>>
>> \startchapter[title={Ward}]
>> \dorecurse{10}{\samplefile{ward}}
>> \stopchapter
>>
>> \stoptext
> 
> Thanks a lot Wolfgang!
> 
> This was just the thing I was looking for. These setups seems to be the
> golden bullet in ConTeXt but I often have difficulties to understand the
> mechanism.

If you mean the setups-environment with setups you’re wrong because this 
is only a alternative way to a command (e.g. \define\mycommand{...}).

The main point is that you finish the page before the section title and 
check on the new page whether you’re on a odd or even numbered page.

When the test tells you that you’re on a even numbered page you know 
there is a empty left page before the chapter which can be used to add 
something special.

Below is a simplified example for the method.

\starttext

\dorecurse{10}{\samplefile{knuth}}

\page

\doifoddpageelse
   {}
   {\pushbackground[page]
    \setupbackgrounds[page][background=color,backgroundcolor=red]
    \page[empty]
    \popbackground}

\dorecurse{10}{\samplefile{zapf}}

\stoptext

> I'll try to wikify this later this week.
> 
> The push-pop-background pair is mentionend in x-setups-overview together
> with some other push-pop-pairs or push single commands. Are they
> documented somewhere?

Most of these push/pop commands are used for internal stuff (or 
sometimes in styles) which means there is no documentation for them.

The purpose of them is to store the state of a command (e.g. the page 
background) before you change its values, afterwards you can just revert 
back to the previously saved state.

As these commands are no real environments they are listed as separate 
commands but it’s possible I will change this.

Wolfgang
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-01-14 18:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12 19:07 Jan U. Hasecke
2019-01-12 19:11 ` Aditya Mahajan
2019-01-12 21:08   ` Jan U. Hasecke
2019-01-12 23:00     ` Rik Kabel
2019-01-13 15:56     ` Wolfgang Schuster
2019-01-14  7:39       ` Jan U. Hasecke
2019-01-14 18:25         ` Wolfgang Schuster [this message]
2019-01-17 11:27           ` Jan U. Hasecke
2019-01-17 12:42             ` Taco Hoekwater

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=09135ba1-2522-62e9-c634-2dceb90d235e@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=juh+ntg-context@mailbox.org \
    --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).