[NTG-context] Grey background for pages belonging to last section of every chapter

Wolfgang Schuster schuster.wolfgang at gmail.com
Mon Feb 2 12:51:41 CET 2015


> Am 30.01.2015 um 21:43 schrieb Rob Heusdens <robheus at xs4all.nl>:
> 
> Correction, I added "offset=none,frameoffset=0pt," to the parameters for
> the textbackground frame.
> 
> Code again with correction:
> 
> % test background
> \setupwhitespace[none]
> \setupindenting[yes, small, next]
> \setuppagenumbering[alternative=doublesided]
> 
> \definetextbackground
>  [SummaryBackground]
>  [frame=off,offset=none,frameoffset=0pt,
>   background=color,
>   backgroundcolor=gray,
>   backgroundoffset=2ex]
> 
> \definehead[summary][section]
> 
> \setuphead
>  [summary]
>  [number=no,
>   style=bold,
>   before=,
>   beforesection={\noindentation\page\starttextbackground[SummaryBackground]},
>   aftersection={\stoptextbackground\blank}]
> 
> \setuphead[section][number=no,style=bold]
> 
> 
> \definecombinedlist[content][section,summary]
> \setupcombinedlist[content][level=4, alternative=c]
> 
> \starttext
> \completecontent
> \page
> \dorecurse{9}{
> \startsection[title={Knuth -- \recurselevel}]
> 
> \input{knuth}
> 
> \stopsection
> }
> 
> \startsummary[title=Samenvatting]
> 
> \input{zapf}
> 
> \stopsummary
> 
> \stoptext
> 
> 
> 
> Still the summary title is a bit lower on the page then other text.


You have to add „location=paragraph” to the textbackground setup.

\definetextbackground
  [ChapterFrame]
  [frame=off,
   background=color,
   backgroundcolor=green,
   backgroundoffset=1ex,
   location=paragraph] % default: location=text

\definehead [Framed]    [chapter]
\definehead [Frameless] [chapter]

\setuphead
  [Frameless]
  [before={\blank[2*line]}]

\setuphead
  [Framed]
  [page=no,
   before=,
   beforesection={\page\blank[2*line]\starttextbackground[ChapterFrame]},
   aftersection=\stoptextbackground]

\starttext

\startnamedsection[Frameless][title=Chapter without frame]

\input knuth

\stopnamedsection

\startnamedsection[Framed][title=Chapter with frame]

\input knuth

\stopnamedsection

\stoptext

Wolfgang


More information about the ntg-context mailing list