ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* setupregister with realpage?
@ 2022-09-23 21:08 Benjamin Buchmuller via ntg-context
  2022-09-23 21:47 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-09-23 21:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Benjamin Buchmuller

Dear list,

\setuplist has the convenient option [pagenumber=realpage]

\setupregister has not (yet).

How can I get the realpagenumber instead of the userpagenumber for the register indices?

I tried

\def\MyPageCommand#1{\realpagenumber}

\setupregister[MyIndex][pagecommand=\MyPageCommand]

but this prints only the current (although real) page number.

Thank you!


Benjamin
___________________________________________________________________________________
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: setupregister with realpage?
  2022-09-23 21:08 setupregister with realpage? Benjamin Buchmuller via ntg-context
@ 2022-09-23 21:47 ` Hans Hagen via ntg-context
  2022-09-24  1:30   ` Benjamin Buchmuller via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2022-09-23 21:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Benjamin Buchmuller

On 9/23/2022 11:08 PM, Benjamin Buchmuller via ntg-context wrote:
> Dear list,
> 
> \setuplist has the convenient option [pagenumber=realpage]
> 
> \setupregister has not (yet).
> 
> How can I get the realpagenumber instead of the userpagenumber for the register indices?
> 
> I tried
> 
> \def\MyPageCommand#1{\realpagenumber}
> 
> \setupregister[MyIndex][pagecommand=\MyPageCommand]
> 
> but this prints only the current (although real) page number.
you can try with this in cont-new.mkxl

\pushoverloadmode \unprotect

\let\currentregisterrealpage\!!zerocount % todo: more general accessor

\permanent\protected\def\withregisterpagecommand#1#2#3#4%
   {\ifcase#3\relax
      {\tt [entry\space not\space flushed]}%
    \else
      \def\currentregisterpageindex{#2}%
      \def\currentregisterrealpage{#3}%
      \iflocation
 
\strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
      \else
        \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
      \fi
    \fi}

\protect \popoverloadmode

which sets \currentregisterrealpage

-----------------------------------------------------------------
                                           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: setupregister with realpage?
  2022-09-23 21:47 ` Hans Hagen via ntg-context
@ 2022-09-24  1:30   ` Benjamin Buchmuller via ntg-context
  2022-09-24  8:25     ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-09-24  1:30 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Benjamin Buchmuller, mailing list for ConTeXt users

Thank you, Hans! This works, I get all the correct page references!

I didn't know about cont-new.mkxl to temporarily store "hacks". I assume the file is updated with each release? Is there a way to store local hacks, e.g., in texmf-local? I could not find "cont-loc" (maybe it's not a file).

For future reference, this is how I am using the hack:

\def\MyRegisterPageCommand#1{\currentregisterrealpage}

\setupregister[MyRegisterA][pagecommand=\MyRegisterPageCommand]
\setupregister[MyRegisterB][pagecommand=\MyRegisterPageCommand]

> On Sep 23, 2022, at 17:47, Hans Hagen <j.hagen@freedom.nl> wrote:
> 
> On 9/23/2022 11:08 PM, Benjamin Buchmuller via ntg-context wrote:
>> Dear list,
>> \setuplist has the convenient option [pagenumber=realpage]
>> \setupregister has not (yet).
>> How can I get the realpagenumber instead of the userpagenumber for the register indices?
>> I tried
>> \def\MyPageCommand#1{\realpagenumber}
>> \setupregister[MyIndex][pagecommand=\MyPageCommand]
>> but this prints only the current (although real) page number.
> you can try with this in cont-new.mkxl
> 
> \pushoverloadmode \unprotect
> 
> \let\currentregisterrealpage\!!zerocount % todo: more general accessor
> 
> \permanent\protected\def\withregisterpagecommand#1#2#3#4%
>  {\ifcase#3\relax
>     {\tt [entry\space not\space flushed]}%
>   \else
>     \def\currentregisterpageindex{#2}%
>     \def\currentregisterrealpage{#3}%
>     \iflocation
> \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
>     \else
>       \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
>     \fi
>   \fi}
> 
> \protect \popoverloadmode
> 
> which sets \currentregisterrealpage
> 
> -----------------------------------------------------------------
>                                          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: setupregister with realpage?
  2022-09-24  1:30   ` Benjamin Buchmuller via ntg-context
@ 2022-09-24  8:25     ` Hans Hagen via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2022-09-24  8:25 UTC (permalink / raw)
  To: Benjamin Buchmuller; +Cc: Hans Hagen, mailing list for ConTeXt users

On 9/24/2022 3:30 AM, Benjamin Buchmuller wrote:
> Thank you, Hans! This works, I get all the correct page references!
> 
> I didn't know about cont-new.mkxl to temporarily store "hacks". I assume the file is updated with each release? Is there a way to store local hacks, e.g., in texmf-local? I could not find "cont-loc" (maybe it's not a file).

Just use that file, as it will be updated. Local copies can only 
interfere later on (unless you check them each update).

You can have an cont-loc.mkxl file in you local tree for various 
personal preferences and hacks.

For dev there is also cont-exp.mkxl but that's not supposed to be known; 
it's what we use for experimental things that i test for a while.

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-09-24  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 21:08 setupregister with realpage? Benjamin Buchmuller via ntg-context
2022-09-23 21:47 ` Hans Hagen via ntg-context
2022-09-24  1:30   ` Benjamin Buchmuller via ntg-context
2022-09-24  8:25     ` 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).