ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Zhichu Chen <zhichu.chen@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: two newbie questions (about conditional processing)
Date: Sun, 24 May 2009 16:46:48 +0800	[thread overview]
Message-ID: <769ba7780905240146o6012ccb3rba2a389a6aaf47b1@mail.gmail.com> (raw)
In-Reply-To: <024BA87B-9088-422C-8DD8-785655479EDA@gmail.com>

On Sun, May 24, 2009 at 4:00 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 24.05.2009 um 06:12 schrieb Zhichu Chen:
>
>> As you said before, in my problem, this kind of handler could break
>> something
>> like hyper-links, and I assume Yue wanted those kind of stuffs.
>
> I don't think this is a problem for this example because the page dimension
> are always the same while in the code for you the real and the calculated
> coordinates are different.
>
>> Maybe just a \start(stop)setups which changes the background back to
>> normal
>> and \prependtoks it to some token list. So is there an \everypage or
>> \everyshipout
>> token? Then using \setuphead (I don't know if it's appropriate) or
>> \appendtoks to every title page.
>
> I posted a code to enable/disable the backgroundcolor for certain pages
> not so long ago, take a look in the mail archive.

Found it. Well, then it's just as easy as it sounds:

\unprotect

\let\!!savedbackgroundcolor\empty

\def\onbackground
 {\globallet\@@mapagebackgroundcolor\!!savedbackgroundcolor}

\def\offbackground
 {\globallet\!!savedbackgroundcolor\@@mapagebackgroundcolor
  \globalletempty\@@mapagebackgroundcolor}

\def\nobackground
 {\globallet\@@mapagebackgroundcolor\!!savedbackgroundcolor
  \globalletempty\@@mapagebackgroundcolor
  \appendtoks\globallet\@@mapagebackgroundcolor\!!savedbackgroundcolor\to\afterpage}

\def\gobackground
 {\globallet\@@mapagebackgroundcolor\!!savedbackgroundcolor
  \appendtoks\globalletempty\@@mapagebackgroundcolor\to\afterpage}

\protect

\setuphead
  [chapter]
  [before=\gobackground]

\setupcolors[state=start]
\setupbackgrounds[page][background=color,backgroundcolor=lightgray]\offbackground

\starttext

\chapter{hello}
\dorecurse{10}{\input zapf\par}

\chapter{hello}
\dorecurse{10}{\input zapf\par}

\chapter{hello}
\dorecurse{10}{\input zapf\par}

\stoptext

>
> 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://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2009-05-24  8:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-21  1:25 Yue Wang
2009-05-23 16:17 ` Yue Wang
2009-05-23 16:49 ` Zhichu Chen
2009-05-23 17:16   ` Yue Wang
2009-05-23 17:34 ` Wolfgang Schuster
2009-05-24  4:12   ` Zhichu Chen
2009-05-24  8:00     ` Wolfgang Schuster
2009-05-24  8:46       ` Zhichu Chen [this message]
2009-05-24  8:57         ` Wolfgang Schuster
2009-05-24  9:44           ` Zhichu Chen
2009-05-24 10:36     ` Hans Hagen
2009-05-25  6:55       ` Zhichu Chen
2009-05-25  7:12         ` Hans Hagen
2009-05-25  7:40           ` Zhichu Chen
2009-05-25  7:51           ` Wolfgang Schuster
2009-05-25  7:57             ` Hans Hagen
2009-05-25  7:30         ` Wolfgang Schuster
2009-05-25  7:42           ` Zhichu Chen
2009-05-25  7:49             ` 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=769ba7780905240146o6012ccb3rba2a389a6aaf47b1@mail.gmail.com \
    --to=zhichu.chen@gmail.com \
    --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).