* different page background for chapter title page
@ 2013-03-23 11:40 Thomas A. Schmitz
2013-03-23 12:27 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Thomas A. Schmitz @ 2013-03-23 11:40 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi all,
I'm sure there must be a solution for this, but I haven't been able to
find it yet: I want my chapter titles typeset in a sort of frame which
will span the entire page, not only the text area, so I guess the
easiest way to do that would be a page background. How can I set up a
background that will appear only on the title page, in addition to the
regular background? Bonus question: I also want the color schemes of
both backgrounds to be different in every chapter, so the solution
should make this possible. The example is a bit silly, but it shows what
I'm looking for, I hope.
Thanks, and all best
Thomas
\setuplayout [header=0cm,
topspace=1.625cm,
footer=0cm,
width=fit,
height=fit]
\definecolor [color:background] [r=0.86,g=0.61,b=0.54]
\definecolor [color:title] [r=0.91,g=0.75,b=0.7]
\startuseMPgraphic{background:normal}
StartPage ;
numeric h ; h = 10mm ;
z[1] = ulcorner Page ;
z[2] = urcorner Page ;
z[3] = z[2] shifted (0, -h) ;
z[4] = z[1] shifted (0, -h) ;
path p ; p = z[1] -- z[2] -- z[3] -- z[4] -- cycle ;
fill p withcolor \MPcolor{color:background} ;
StopPage ;
\stopuseMPgraphic
\defineoverlay [background:normal] [\useMPgraphic{background:normal}]
\startuseMPgraphic{background:title}
StartPage ;
numeric h ; h = 10mm ;
z[1] = ulcorner Page shifted (0, -1.5*h) ;
z[2] = urcorner Page shifted (0, -1.5*h);
z[3] = z[2] shifted (0, -h) ;
z[4] = z[1] shifted (0, -h) ;
path p ; p = z[1] -- z[2] -- z[3] -- z[4] -- cycle ;
fill p withcolor \MPcolor{color:title};
StopPage ;
\stopuseMPgraphic
\defineoverlay [background:title] [\useMPgraphic{background:title}]
\setupbackgrounds[page][background={background:normal,background:title}]
\starttext
\startchapter[title=One]
\input tufte
\page
\input knuth
\stopchapter
\startchapter[title=Two]
\definecolor [color:background] [r=0.82,g=0.85,b=0.68]
\definecolor [color:title] [r=0.86,g=0.88,b=0.76]
\input tufte
\page
\input knuth
\stopchapter
\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: different page background for chapter title page
2013-03-23 11:40 different page background for chapter title page Thomas A. Schmitz
@ 2013-03-23 12:27 ` Hans Hagen
2013-03-23 12:41 ` Thomas A. Schmitz
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2013-03-23 12:27 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: different page background for chapter title page
2013-03-23 12:27 ` Hans Hagen
@ 2013-03-23 12:41 ` Thomas A. Schmitz
0 siblings, 0 replies; 3+ messages in thread
From: Thomas A. Schmitz @ 2013-03-23 12:41 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
On 03/23/2013 01:27 PM, Hans Hagen wrote:
> Hi,
>
> You know the price you have to pay: wikifying ..
>
Hi Hans,
thanks a lot - will do after I have played with it and understood at
least the main parts of it!
All best
Thomas
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-23 12:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-23 11:40 different page background for chapter title page Thomas A. Schmitz
2013-03-23 12:27 ` Hans Hagen
2013-03-23 12:41 ` Thomas A. Schmitz
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).