ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: Page number in "beeldmerk"
Date: Fri, 20 Apr 2001 20:51:47 +0200	[thread overview]
Message-ID: <3.0.6.32.20010420205147.009e0380@server-1> (raw)
In-Reply-To: <3AE05862.A82AC269@jet.es>

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


      reply	other threads:[~2001-04-20 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-20 15:40 Geert Dobbels
2001-04-20 18:51 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3.0.6.32.20010420205147.009e0380@server-1 \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).