* MP scratch counter
@ 2022-07-13 18:14 Henning Hraban Ramm via ntg-context
2022-07-13 20:33 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-13 18:14 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm
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
"""
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MP scratch counter
2022-07-13 18:14 MP scratch counter Henning Hraban Ramm via ntg-context
@ 2022-07-13 20:33 ` Hans Hagen via ntg-context
2022-07-13 20:58 ` Henning Hraban Ramm via ntg-context
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2022-07-13 20:33 UTC (permalink / raw)
To: Henning Hraban Ramm via ntg-context; +Cc: Hans Hagen
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MP scratch counter
2022-07-13 20:33 ` Hans Hagen via ntg-context
@ 2022-07-13 20:58 ` Henning Hraban Ramm via ntg-context
2022-07-13 21:04 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-13 20:58 UTC (permalink / raw)
To: ntg-context; +Cc: Henning Hraban Ramm
Am 13.07.22 um 22:33 schrieb Hans Hagen via ntg-context:
> 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
Thank you, I just replaced all occurrences of PageNumber with
RealPageNumber, and it works.
This seems to have changed within the last few years, though.
Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MP scratch counter
2022-07-13 20:58 ` Henning Hraban Ramm via ntg-context
@ 2022-07-13 21:04 ` Hans Hagen via ntg-context
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2022-07-13 21:04 UTC (permalink / raw)
To: Henning Hraban Ramm via ntg-context; +Cc: Hans Hagen
On 7/13/2022 10:58 PM, Henning Hraban Ramm via ntg-context wrote:
> Am 13.07.22 um 22:33 schrieb Hans Hagen via ntg-context:
>> 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
>
> Thank you, I just replaced all occurrences of PageNumber with
> RealPageNumber, and it works.
> This seems to have changed within the last few years, though.
Not really ... what did change was the gleu between tex - lua - mp (way
more efficient and direct) and 'pageno' is some old plain thing, we have
userpageno ... so user interface wise it's all the same (maybe some more
actuall). What did change was the adapation to even /odd pages for
which one had to do some swapping in the mp code and which is now more
automatic
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-13 21:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 18:14 MP scratch counter Henning Hraban Ramm via ntg-context
2022-07-13 20:33 ` Hans Hagen via ntg-context
2022-07-13 20:58 ` Henning Hraban Ramm via ntg-context
2022-07-13 21:04 ` Hans Hagen via ntg-context
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).