ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
Subject: Re: different page background for chapter title page
Date: Sat, 23 Mar 2013 13:27:47 +0100	[thread overview]
Message-ID: <514D9FC3.50108@wxs.nl> (raw)
In-Reply-To: <514D94BF.8000302@uni-bonn.de>

Hi,

You know the price you have to pay: wikifying ..


\setuplayout
   [header=0cm,
    topspace=1.625cm,
    footer=0cm,
    width=fit,
    height=fit]

\startMPinclusions
     numeric MyTitlePageDone[] ;
\stopMPinclusions

\startuseMPgraphic{background:normal}
     StartPage ;
         fill
             (topboundary Page --cycle) enlarged(0,5mm) shifted (0,-5mm)
             withcolor 
\MPcolor{color:background:\namedstructureuservariable{chapter}{mycolor}} ;
     StopPage ;
\stopuseMPgraphic

\defineoverlay
   [background:normal]
   [\useMPgraphic{background:normal}]

\startuseMPgraphic{background:title}
     if unknown 
MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} :
         StartPage ;
             fill
                 ((topboundary Page --cycle) enlarged(0,5mm)) shifted 
(0,-20mm)
                 withcolor 
\MPcolor{color:title:\namedstructureuservariable{chapter}{mycolor}} ;
         StopPage ;
         MyTitlePageDone.\namedstructureuservariable{chapter}{mycolor} 
:= 1 ;
     fi ;
\stopuseMPgraphic

\defineoverlay
   [background:title]
   [\useMPgraphic{background:title}]

\setupbackgrounds
   [page]
   [background={background:normal,background:title}] % could be drawn in 
one go

\definecolor [color:title:one]      [r=0.86,g=0.88,b=0.76]
\definecolor [color:background:one] [.9(color:title:one)]

\definecolor [color:title:two]      [g=0.86,r=0.88,b=0.76]
\definecolor [color:background:two] [.9(color:title:two)]

\starttext

\startchapter[title=One][mycolor=one] \input tufte \page \input knuth 
\stopchapter
\startchapter[title=Two][mycolor=two] \input tufte \page \input knuth 
\stopchapter

\stoptext

Of course more solutions are possible. Btw, watch the topboundary 
trickery and the fractional color.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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:[~2013-03-23 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 11:40 Thomas A. Schmitz
2013-03-23 12:27 ` Hans Hagen [this message]
2013-03-23 12:41   ` Thomas A. Schmitz

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=514D9FC3.50108@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    --cc=thomas.schmitz@uni-bonn.de \
    /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).