* Definition of \registerpagerange
@ 2020-05-05 8:35 Hynek, Stefan
2020-05-05 10:08 ` Henning Hraban Ramm
0 siblings, 1 reply; 2+ messages in thread
From: Hynek, Stefan @ 2020-05-05 8:35 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 1124 bytes --]
Hello fellow ConTeXies,
since April 2019 it is possible to use \setupregister with
compress=text which is a fine addition and has its use cases.
Unfortunately, I am confronted with the demand to style the registers
with 'f.' for a following single page and else with page ranges. Since
the Definition of \registerpagerange is not well documented I don't
know which parameter to check for the conditional statement when
rewriting it. Could you please give me a hint?
In ConTeXt that shipped with TeXlive 2015 it worked that way:
\unexpanded\def\registerpagerange#1#2#3#4#5#6#7%
{\registerpageseparator
\global\setconstant\c_strc_registers_page_state\plusone
\dostarttagged\t!registerpagerange\empty
\dostarttagged\t!registerfrompage\empty
\withregisterpagecommand{#1}{#2}{#3}{#4}%
\dostoptagged
\ifnum\the\numexpr#6-#3\relax=1
f.%
\else
\registeronepagerangeseparator
\dostarttagged\t!registertopage\empty
\withregisterpagecommand{#1}{#5}{#6}{#7}%
\dostoptagged
\fi
\dostoptagged}
With 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Definition of \registerpagerange
2020-05-05 8:35 Definition of \registerpagerange Hynek, Stefan
@ 2020-05-05 10:08 ` Henning Hraban Ramm
0 siblings, 0 replies; 2+ messages in thread
From: Henning Hraban Ramm @ 2020-05-05 10:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
> Am 05.05.2020 um 10:35 schrieb Hynek, Stefan <stefan.hynek@uni-goettingen.de>:
>
> Hello fellow ConTeXies,
>
> since April 2019 it is possible to use \setupregister with
> compress=text which is a fine addition and has its use cases.
> Unfortunately, I am confronted with the demand to style the registers
> with 'f.' for a following single page and else with page ranges. Since
> the Definition of \registerpagerange is not well documented I don't
> know which parameter to check for the conditional statement when
> rewriting it. Could you please give me a hint?
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.
HTH
Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-05 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 8:35 Definition of \registerpagerange Hynek, Stefan
2020-05-05 10:08 ` Henning Hraban Ramm
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).