From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id B699423F18 for ; Wed, 28 Feb 2024 19:31:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 6C21348450B for ; Wed, 28 Feb 2024 19:30:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K4PsWzD_domf for ; Wed, 28 Feb 2024 19:30:16 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 1B0CB4846D3 for ; Wed, 28 Feb 2024 19:29:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 12DCC484292 for ; Wed, 28 Feb 2024 19:28:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6lUSG4EpkDYg for ; Wed, 28 Feb 2024 19:28:24 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.53; helo=mail-ej1-f53.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id AADC448428A for ; Wed, 28 Feb 2024 19:28:24 +0100 (CET) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a44282a09bdso13676166b.1 for ; Wed, 28 Feb 2024 10:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709144904; x=1709749704; darn=ntg.nl; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=JJhRtBz8HADl0VZM3WKY5dFlk92Ohlfkdf5dCsGnfrw=; b=C2uPOroxLuXb7OEUkQbv6bBghQsuv3wJZe9s6gkDGh8JnWXRXmykfS9NWji+TrbZkc G+U0+NxOMKPNqGi7IlIsn9ZefBB9LJcVO6SKQbf861SBMWajCr8zKnddlJP4OJs+IIIx bz2ZDUUeQrLbMRxgycHVY25/07nZhSVTb3GtzXAtwZ3q1C0jAuWJ8z3Ll0W5ZTAS3ZWF 9epl0yJfE43Fhw7RXujedhwG6pkTLROTLvL9PTgOXdyMtZNC6edVN25+eiRaGCnC0GlG QthAC14B11a0syrfqKlzZOZB/Q2tvsF1dc3wABtEttgzcjlnf2ThjSVVZ+wGWKJ3wD+C xpkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709144904; x=1709749704; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JJhRtBz8HADl0VZM3WKY5dFlk92Ohlfkdf5dCsGnfrw=; b=QXau7lBAHPXm3gZ3euk2K8B1tyOe6lskMinQaDnfuZ5cmejjyZr9V3J/0gIYj7hTez +P8lR5rKZwDp7aLNHsxxriqUqo/4xF5nAMpdvIl7nbPvnXKW9ihPGDnNYY2ggcBZ/yxK 8ff/8k3vMC+7n1k0BmU6Ms73sBX3E1aXGKJbZ9iuOfykuEagd9awj8al2s0+Jf0eYOOT XrUI/D8yjQM9qFaElWiaIFIwnPOjp8PEKnCWaFCg7sjpTxCNSthldQD0sCb5sd6r2Jlm XLtwFnvA84hy+mlLbRnLRZtCOva79HXfhsa9YAnqSGCBiW8Ucf2fx7+qq7H6xwOusqvQ iSdw== X-Gm-Message-State: AOJu0Yz5uQ57LpCW/2DY8M/ZmtPOWdjthawDw5gBBORrbnEmpJ1tZttF W2AyuMo93Gqu97Qtd6B8ulzGKWrRxb8ngllItWCbLnNx9eh0mF1xzx4crNxY X-Google-Smtp-Source: AGHT+IHIw3YfeNKyW8RG72SzYvloLVqoyLJV82gf+/5sHdbRNIjgQAL7Csmw4ho6YtQGOHK20pnHlg== X-Received: by 2002:a17:906:2359:b0:a3e:73c8:cd27 with SMTP id m25-20020a170906235900b00a3e73c8cd27mr330677eja.73.1709144904087; Wed, 28 Feb 2024 10:28:24 -0800 (PST) Received: from ?IPv6:2a02:810d:a8bf:dc10:1815:9ff9:8325:ea2b? ([2a02:810d:a8bf:dc10:1815:9ff9:8325:ea2b]) by smtp.gmail.com with ESMTPSA id l11-20020a17090612cb00b00a433e8cfb7esm2113861ejb.64.2024.02.28.10.28.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2024 10:28:23 -0800 (PST) To: mailing list for ConTeXt users , Pablo Rodriguez via ntg-context References: <90a33622-3cd1-5281-722d-30585a658557@gmail.com> <7F70701F-E868-44D3-9B8A-E89516D435F6@scorecrow.com> <4d1f4433-9357-2c35-cdea-4b227fab63a7@gmx.es> From: Wolfgang Schuster Message-ID: <1a825490-6258-4b2f-ef08-69573e68ff60@gmail.com> Date: Wed, 28 Feb 2024 19:28:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.60 MIME-Version: 1.0 In-Reply-To: <4d1f4433-9357-2c35-cdea-4b227fab63a7@gmx.es> Content-Language: en-US Message-ID-Hash: MP35XFU4VILDYDZJJTBW5BILQRWV7PQB X-Message-ID-Hash: MP35XFU4VILDYDZJJTBW5BILQRWV7PQB X-MailFrom: wolfgang.schuster.lists@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Pablo Rodriguez X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: imposition: getting to the last page of a booklet List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit 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 ___________________________________________________________________________________