* 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