ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Hynek, Stefan" <stefan.hynek@uni-goettingen.de>
To: "ntg-context@ntg.nl" <ntg-context@ntg.nl>
Subject: Re: Definition of \registerpagerange (Henning Hraban Ramm)
Date: Wed, 6 May 2020 10:45:20 +0000	[thread overview]
Message-ID: <944b4bbd63461fcff1306b70176c6091df424795.camel@uni-goettingen.de> (raw)
In-Reply-To: <mailman.138.1588740902.6418.ntg-context@ntg.nl>


[-- Attachment #1.1: Type: text/plain, Size: 3470 bytes --]

Am Mittwoch, den 06.05.2020, 06:55 +0200 schrieb ntg-context-
request@ntg.nl:
> This doesn’t answer your question, but I found:
> 
> \setupregister[index][compress=yes] % 14, 15 becomes 14-15
> \setupregister[index][compress=text] % 14, 15 becomes 14f.
> 
> To change the "f."/"ff." text, you’d use:
> 
> \setuplabeltext[de][following:singular=sq.,following:plural=sqq.]
> 
> This is defined in tex/context/base/mkiv/lang-txt.lua
> and addressed in context/base/mkiv/strc-reg.mkiv in the definition of
> \registerpagerange:
> 
> \unexpanded\def\registerpagerange#1#2#3#4#5#6#7#8% #1:class
> #2:processor  content, content todo: -- configurable
>   {\pushcurrentregister{#1}%
>    \edef\p_pagenumber{\registerparameter\c!pagenumber}%
>    \ifx\p_pagenumber\v!no\else
>      \registerpageseparator
>      \global\setconstant\c_strc_registers_page_state\plusone
>      \dostarttagged\t!registerpagerange\empty
>      \dostarttagged\t!registerfrompage\empty
>      \withregisterpagecommand{#2}{#3}{#4}{#5}%
>      \dostoptagged
>      \ifconditional\c_strc_registers_following
>        \ifnum#3=\numexpr#6-1\relax
>          \labeltext{following:\s!singular}%
>        \else
>          \labeltext{following:\s!plural}%
>        \fi
>     \else
>        \registeronepagerangeseparator
>        \dostarttagged\t!registertopage\empty
>        \withregisterpagecommand{#2}{#6}{#7}{#8}%
>      \fi
>      \dostoptagged
>      \dostoptagged
>    \fi
>    \popcurrentregister}
> 
> (see 
> https://source.contextgarden.net/tex/context/base/mkiv/strc-reg.mkiv?search=singular
> )
> 
> 
> You should be able to combine the two "else" branches.
Thank you for answering. I have had looked into this source before and
tried exactly the same approach you descrived but I am on TeXlive 2019
where this is defined differently: 
\unexpanded\def\registerpagerange#1#2#3#4#5#6#7#8% #1:class
#2:processor  content, content todo: -- configurable
  {\pushcurrentregister{#1}%
   \edef\p_pagenumber{\registerparameter\c!pagenumber}%
   \ifx\p_pagenumber\v!no\else
     \registerpageseparator
     \global\setconstant\c_strc_registers_page_state\plusone
     \dostarttagged\t!registerpagerange\empty
     \dostarttagged\t!registerfrompage\empty
     \withregisterpagecommand{#2}{#3}{#4}{#5}%
     \dostoptagged
     \registeronepagerangeseparator
     \dostarttagged\t!registertopage\empty
     \withregisterpagecommand{#2}{#6}{#7}{#8}%
     \dostoptagged
     \dostoptagged
   \fi
   \popcurrentregister}

and, most importantly, does not work with this approach:
\unexpanded\def\registerpagerange#1#2#3#4#5#6#7#8% #1:class
#2:processor  content, content todo: -- configurable
  { \pushcurrentregister{#1}%
    \edef\p_pagenumber{\registerparameter\c!pagenumber}%
    \ifx\p_pagenumber\v!no\else
      \registerpageseparator
      \global\setconstant\c_strc_registers_page_state\plusone
      \dostarttagged\t!registerpagerange\empty
      \dostarttagged\t!registerfrompage\empty
      \withregisterpagecommand{#2}{#3}{#4}{#5}%
      \dostoptagged
      \ifnum#3=\numexpr#6-1\relax
        f.%
      \else
        \registeronepagerangeseparator
        \dostarttagged\t!registertopage\empty
        \withregisterpagecommand{#2}{#6}{#7}{#8}%
      \fi
      \dostoptagged
      \dostoptagged
    \fi
    \popcurrentregister}

May it be that parameters have changed since then?
Best regards
Stefan

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 7015 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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

           reply	other threads:[~2020-05-06 10:45 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <mailman.138.1588740902.6418.ntg-context@ntg.nl>]

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=944b4bbd63461fcff1306b70176c6091df424795.camel@uni-goettingen.de \
    --to=stefan.hynek@uni-goettingen.de \
    --cc=ntg-context@ntg.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).