From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: [NTG-context] Re: imposition: getting to the last page of a booklet
Date: Wed, 28 Feb 2024 19:02:15 +0100 [thread overview]
Message-ID: <4d1f4433-9357-2c35-cdea-4b227fab63a7@gmx.es> (raw)
In-Reply-To: <ecb720b0-cbba-c1f9-e95e-d0e3768dac54@gmx.es>
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\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}
\dorecurse{25}{\recurselevel: \beforequadruplenumber{\recurselevel}\\}
\dorecurse{25}{\recurselevel: \afterquadruplenumber{\recurselevel}\\}
%\page[123]
%\null
\page[\beforequadruplenumber{\realpageno}]
before quadruple
\page[\afterquadruplenumber{\realpageno}]
afterquadruple
\stoptext
Michael, if this fits your needs, please add it to the wiki.
I hope it helps,
Pablo
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2024-02-28 18:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 9:07 [NTG-context] " Michael Guravage
2024-02-24 13:30 ` [NTG-context] " Wolfgang Schuster
2024-02-27 10:13 ` Pablo Rodriguez via ntg-context
2024-02-28 10:56 ` Bruce Horrocks
2024-02-28 11:24 ` Pablo Rodriguez via ntg-context
2024-02-28 18:02 ` Pablo Rodriguez via ntg-context [this message]
2024-02-28 18:28 ` Wolfgang Schuster
2024-03-04 19:00 ` Pablo Rodriguez via ntg-context
2024-03-06 18:50 ` Wolfgang Schuster
2024-03-06 19:17 ` Pablo Rodriguez via ntg-context
2024-03-07 15:36 ` Wolfgang Schuster
2024-03-06 20:38 ` Hans Hagen
2024-03-06 21:06 ` Wolfgang Schuster
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=4d1f4433-9357-2c35-cdea-4b227fab63a7@gmx.es \
--to=ntg-context@ntg.nl \
--cc=oinos@gmx.es \
/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).