[NTG-context] MP scratch counter
Hans Hagen
j.hagen at freedom.nl
Wed Jul 13 22:33:38 CEST 2022
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
-----------------------------------------------------------------
More information about the ntg-context
mailing list