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