ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>,
	Benjamin Buchmuller <benjamin.buchmuller@gmail.com>
Subject: Re: setupregister with realpage?
Date: Fri, 23 Sep 2022 23:47:00 +0200	[thread overview]
Message-ID: <5eb35d4a-f20a-a12e-6ac9-f9ec12b2f0c7@freedom.nl> (raw)
In-Reply-To: <7451FD1A-B4A0-40D5-8FE1-D3B7448F3217@gmail.com>

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
___________________________________________________________________________________

  reply	other threads:[~2022-09-23 21:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 21:08 Benjamin Buchmuller via ntg-context
2022-09-23 21:47 ` Hans Hagen via ntg-context [this message]
2022-09-24  1:30   ` Benjamin Buchmuller via ntg-context
2022-09-24  8:25     ` 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=5eb35d4a-f20a-a12e-6ac9-f9ec12b2f0c7@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=benjamin.buchmuller@gmail.com \
    --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).