[NTG-context] Some questions about context

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sat Mar 10 08:45:01 CET 2007


On Wed, 7 Mar 2007 00:00:38 +1100
Robin Kirkham <robin.kirkham at csiro.au> wrote:

> Hi all,
> 
> Moreover, how do you get a rule in the header that extends from the  
> left of the left margin, right across to the right of the right  
> margin (including the gaps in between)?
> 
> Cheers,
> 
> Robin
> 
> On 06/03/2007, at 10:00 PM, ntg-context-request at ntg.nl wrote:
> 
> > From: Oliver Buerschaper <oliver.buerschaper at mpq.mpg.de>
> > Date: 6 March 2007 9:19:23 PM
> > To: mailing list for ConTeXt users <ntg-context at ntg.nl>
> > Subject: Re: [NTG-context] Some questions about context
> >
> >> And another question (in other topic): how we can do lines at  
> >> header and
> >> footer like fancyheaders in latex?
> >
> > For your headers try this:
> >
> > \setupheader
> > 	[text]
> > 	[after=\hrule]

Hi Robin,

I tried to make something working and came to the following three
methods to draw a rule under the header at the whole pagewidth.

If you use ConTeXts default layout with different margins you should
use bigger values for the rulewidth than only pagewidth.

\setuplayout[location=middle,cutspace=\backspace,width=middle]
%\setuppapersize[A5][A4]
%\showframe

\startuseMPgraphic{headerrule}
setbounds currentpicture to unitsquare xyscaled (\the\paperwidth,\the
\headerheight); draw (0,0)--(\the\paperwidth,0);
\stopuseMPgraphic

\defineoverlay
  [headerrule]
  [\useMPgraphic{headerrule}]

\defineoverlay
  [headerrule]
  [\vrule height\headerheight width0pt%
   \vrule width\paperwidth height 0.4pt\relax]

\defineoverlay
  [headerrule]
  [{\framed[width=\paperwidth,height=
\headerheight,frame=off,bottomframe=on]{}}]

\setupbackgrounds
  [header]
  [text]
  [background=headerrule]

\starttext

\input knuth

\stoptext

Wolfgang


More information about the ntg-context mailing list