ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Page number in "beeldmerk"
@ 2001-04-20 15:40 Geert Dobbels
  2001-04-20 18:51 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Dobbels @ 2001-04-20 15:40 UTC (permalink / raw)


My problem probably is due to beginner's ignorance.....

I need to create a document that has a predefined header on the top of
each page.  The header is a square with the width of the textblock.
Within that square are 2 company logos and 2 vertical lines.  The
pagenumber has to go in the right bottom side of this square and has a
format like in "page xx of yyy".

Since the normal positioning of pagenumbers in Context does not place
this pagenumber exactly where I need it, I decided to create the whole
header as described above within a "beeldmerk" (don't know the english
name of this command).  (to give a better idea of what I want, imagine
the logo on page 63 of the dutch context handleiding, appearing on every
page but with the pagenumber on the position where the pragma email
address appears in the book's example)

As I feared, the "beeldmerk" is generated and positioned correctly,
except for the pagenumber.  This number is in the correct position, is
correct on page 1 and on page 2, but stays 2 on all the pages that come
after page 2.

Any suggestion on how to avoid that ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Page number in "beeldmerk"
  2001-04-20 15:40 Page number in "beeldmerk" Geert Dobbels
@ 2001-04-20 18:51 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2001-04-20 18:51 UTC (permalink / raw)
  Cc: ntg-context

At 05:40 PM 4/20/01 +0200, Geert Dobbels wrote:
>My problem probably is due to beginner's ignorance.....
>
>I need to create a document that has a predefined header on the top of
>each page.  The header is a square with the width of the textblock.
>Within that square are 2 company logos and 2 vertical lines.  The
>pagenumber has to go in the right bottom side of this square and has a
>format like in "page xx of yyy".
>
>Since the normal positioning of pagenumbers in Context does not place
>this pagenumber exactly where I need it, I decided to create the whole
>header as described above within a "beeldmerk" (don't know the english
>name of this command).  (to give a better idea of what I want, imagine
>the logo on page 63 of the dutch context handleiding, appearing on every
>page but with the pagenumber on the position where the pragma email
>address appears in the book's example)
>
>As I feared, the "beeldmerk" is generated and positioned correctly,
>except for the pagenumber.  This number is in the correct position, is
>correct on page 1 and on page 2, but stays 2 on all the pages that come
>after page 2.
>
>Any suggestion on how to avoid that ?

Use the backhgounds instead. 

\setuplayout
  [header=1cm,headerdistance=1cm]

\setupbackgrounds
  [state=repeat]

\setupbackgrounds
  [header][text]
  [background={Logos,PageNumber}]

\setuppagenumbering
  [location=]

\defineoverlay
  [Logos]
  [{\framed
     [width=\overlaywidth,height=\overlayheight,
      offset=overlay,align=right,frame=off]
     {\framed
        [width=3cm,height=1cm]
        {logo 1}%
      \hskip.5em
      \framed
        [width=3cm,height=1cm]
        {logo 2}%
      \hskip.5em
      \blackrule
        [height=1cm,width=2mm,depth=0pt]%
      \hskip.5em
      \blackrule
        [height=1cm,width=2mm,depth=0pt]}}]

\defineoverlay
  [PageNumber]
  [{\framed
     [width=\overlaywidth,height=\overlayheight,
      align={left,low},offset=overlay,frame=off]
     {page {\pagenumber} of {\lastpage}}}]

\starttext test \page test \page \stoptext

or faster: 

\setuplayout
  [header=1cm,headerdistance=1cm]

\setupbackgrounds
  [state=repeat]

\setupheadertexts[\MyPageNumber]

\setuppagenumbering
  [location=]

\def\MyPageNumber
  {\framed
     [width=\textwidth,height=\headerheight,
      offset=overlay,align=right,frame=off]
     {\framed
        [width=3cm,height=1cm]
        {logo 1}%
      \hskip.5em
      \framed
        [width=3cm,height=1cm]
        {logo 2}%
      \hskip.5em
      \blackrule
        [height=1cm,width=2mm,depth=0pt]%
      \hskip.5em
      \blackrule
        [height=1cm,width=2mm,depth=0pt]%
      \hfill
      \framed
        [height=1cm,
         align={left,low},offset=overlay,frame=off]
        {page {\pagenumber} of {\lastpage}}}}

\starttext test \page test \page \stoptext

or faster 

\setuplayout
  [header=1cm,headerdistance=1cm]

\setupbackgrounds
  [state=repeat]

\setupheadertexts[\MyPageNumber]

\setuppagenumbering
  [location=]

\def\MyPageNumber
  {\vbox to \headerheight
     {\hbox to \textwidth
        {\framed[width=3cm,height=1cm]{logo 1}%
         \hskip.5em
         \framed[width=3cm,height=1cm]{logo 2}%
         \hskip.5em
         \blackrule[height=1cm,width=2mm,depth=0pt]%
         \hskip.5em
         \blackrule[height=1cm,width=2mm,depth=0pt]%
         \hfill
         page {\pagenumber} of {\lastpage}}}}

\starttext test \page test \page \stoptext

The alternative with frames is nice for debugging since you can turn on the
frames. In the latter example you can use \ruledhbox instead of \hbox for
debugging. 

Hans

-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-04-20 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-20 15:40 Page number in "beeldmerk" Geert Dobbels
2001-04-20 18:51 ` Hans Hagen

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).