Pablo Rodriguez via ntg-context schrieb am 28.02.2024 um 19:02:
On 2/28/24 12:24, Pablo Rodriguez via ntg-context wrote:
[...]
This is why beforequadruple would make sense. I guess some Lua magic
could do that, computing x to the follwing page that "x % 4 = 3" (and
then \page[x]).

I will try to find a trick for that, but not now.

Replying to myself, this is a command to compute next numbers before and
after quadruples (with application to \realpageno):

  \starttext
   \def\beforequadruplenumber#1%
     {\ifnum\modulonumber{4}{#1} = 1
        \the\numexpr #1 + 2
      \orelse\ifnum\modulonumber{4}{#1} = 2
        \the\numexpr #1 + 1
      \orelse\ifnum\modulonumber{4}{#1} = 3
        \the\numexpr #1 + 4
       \else
        \the\numexpr #1 + 3
      \fi}

\def\beforequadruplenumber#1%
  {\ifcase\numexpr#1+1;4\relax
     \number\numexpr#1+4\relax
   \else
     \number\numexpr#1+3-#1;4\relax
   \fi}

   \def\afterquadruplenumber#1%
     {\ifnum\modulonumber{4}{#1} = 1
        \the\numexpr #1 + 4
      \orelse\ifnum\modulonumber{4}{#1} = 2
        \the\numexpr #1 + 3
      \orelse\ifnum\modulonumber{4}{#1} = 3
        \the\numexpr #1 + 2
       \else
        \the\numexpr #1 +1
      \fi}

\def\afterquadruplenumber#1%
  {\ifcase\numexpr#1;4\relax
     \number\numexpr#1+1\relax
   \else
     \number\numexpr#1+5-#1;4\relax
   \fi}

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to