ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: Re: MP scratch counter
Date: Wed, 13 Jul 2022 22:33:38 +0200	[thread overview]
Message-ID: <995fe6de-ef43-8463-324f-b8e4514121e6@freedom.nl> (raw)
In-Reply-To: <8a9ad836-e78e-c887-636c-6307a9e281c2@fiee.net>

On 7/13/2022 8:14 PM, Henning Hraban Ramm via ntg-context wrote:
> Hi y’all,
> this is a scratch counter from the simpleslides module. It doesn’t work 
> any more (always shows max-1), and I guess it used to.
> What’s wrong?
> 
> Hraban
> 
> 
> """
> \startuseMPgraphic{MP:ornament}
> StartPage ;
> 
> save a,b ;
> numeric a,b ;
> a = 7mm ;
> b = PaperWidth/2 - NOfPages * 2.5pt ;
> 
> save p,q; path p,q ;
> p =((0,5mm)    -- (1mm,11mm)) shifted (b,0) ;
> q =((-8mm,5mm) -- (0,11mm)  ) shifted (b,0) ;
> 
> pickup pencircle scaled 3pt ;
> for i := NOfPages-1 downto 1:
>    draw (if i mod 5 = 0 : q else : p fi)
>         shifted (i*5pt, 0pt)
>         withcolor if i < PageNumber : red
>                   else :              black
>                   fi ;
> endfor ;
> StopPage ;
> \stopuseMPgraphic
> 
> \defineoverlay[background:ornament][\useMPgraphic{MP:ornament}]
> \setupbackgrounds[page][background={background:ornament}]
> 
> \setupbodyfont[ss,18pt]
> 
> \starttext
> 
> \dorecurse{10}{
>    \strut\par
>    \page
> }
> 
> \stoptext
in mlib-int.lmt change this:

registerdirect("PageNumber",           function() return 
getcount("userpageno")                    end)

(beware it's there twice - i'll fix that)

btw, normally you would use RealPageNumber for such a counter

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-07-13 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 18:14 Henning Hraban Ramm via ntg-context
2022-07-13 20:33 ` Hans Hagen via ntg-context [this message]
2022-07-13 20:58   ` Henning Hraban Ramm via ntg-context
2022-07-13 21:04     ` Hans Hagen via ntg-context

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=995fe6de-ef43-8463-324f-b8e4514121e6@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.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).