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.6 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 EDB6E23D23 for ; Thu, 7 Mar 2024 16:39:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 54DE34848E8 for ; Thu, 7 Mar 2024 16:37:55 +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 L1r5FV8HZb9k for ; Thu, 7 Mar 2024 16:37:55 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 8F6BA4849CC for ; Thu, 7 Mar 2024 16:37:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id BCE50484836 for ; Thu, 7 Mar 2024 16:36:32 +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 QNcAqFtIFCLy for ; Thu, 7 Mar 2024 16:36:32 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.208.41; helo=mail-ed1-f41.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 76208484835 for ; Thu, 7 Mar 2024 16:36:32 +0100 (CET) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so3997456a12.1 for ; Thu, 07 Mar 2024 07:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709825792; x=1710430592; 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=Ek2G4RVT8wnulAbQcjkSmf/KeKfdNZYhTRA1ee/hZyI=; b=jP576USLzL4atlurAqe4SHTbxN1SJtoh1RwcLvcalHL2zeiPW5b9FVDyCqaXQDd6dn DMQk0rgJ8FZjvIcV4Kj+a5lYFQiESHy4rvjJB4NonsX6LWYR6FRv/A9/3Spij/4GbmIL etmviJcAd3OECny1ztT9s2MSkCbBC6BTkJL+MhRUu0gzahTCc7JHXw2VSkroJ1E9c4rm MIplPUU4dwHUOotZNSds9oCBJANum2gGB3AxOh5Pq84QeKGurmAA0qRcd5QVnshvu/3O F8UORP6s1HnMPmlfK9uTxkcQKczwvNBiAybd6GWtf6GOYa1T+5yfARXVKVHNTOilMMv4 KDlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709825792; x=1710430592; 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=Ek2G4RVT8wnulAbQcjkSmf/KeKfdNZYhTRA1ee/hZyI=; b=t854RorRINBvW+JTCsFABbZUHs1BX0K174RIRzB11vYX7QUtKVkkrq8h8B7LSGSMhi 9/qE5/0BEzPlyGz2cQtjjJt52V+WT0QqGMMO9Pi4mH7+7VDtVXsf5he+i0YVXfcjZrqr JV7sCxJ5aQF3GYvXAfgdpzXAPdyUNY9FCyt5Cq8vMw6bulALi2xOPaI50KoJkRCyVwsu DNIJzN/ZSknF28wjvs6U/ATdlIVBddQpMgqXN4hA37Rr1IsO1RqrQynDyuv6nXRFdDur A8fVre5xGzrDDHkZ7bnCnW4F0K/0ZNQtIlxTvEr/TYAMYhpgYsAnluw1NhOOzsdnfYUq jSRw== X-Gm-Message-State: AOJu0Yz2jxeRaX3GOZr67PxoUSIjzDmBX9QENtiJ5i1A/l9MuyrV8Eg0 E2mNC3ncD4AFLZqYpij2W4sqH26o/bPIgcpdnRbGLxCbHDwFA4gR X-Google-Smtp-Source: AGHT+IF4fGgOPsxkrJ9zGEv5EJ9pt4diXUOSEK6C10QrUHtEiyxaByA+UncpGw8Ssp9rHa6Jq9Ms1w== X-Received: by 2002:a17:906:c7da:b0:a45:b616:29fc with SMTP id dc26-20020a170906c7da00b00a45b61629fcmr1787651ejb.0.1709825791514; Thu, 07 Mar 2024 07:36:31 -0800 (PST) Received: from [192.168.0.227] ([31.16.251.82]) by smtp.gmail.com with ESMTPSA id d1-20020a170906544100b00a45bda3cbb8sm1761564ejp.134.2024.03.07.07.36.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2024 07:36:31 -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> <1a825490-6258-4b2f-ef08-69573e68ff60@gmail.com> <112448bc-0647-8de3-7aa5-30c9c6d7305a@gmx.es> <94341cac-161d-f830-369d-d598418f34a3@gmail.com> From: Wolfgang Schuster Message-ID: <6506d576-ca46-539c-e25a-b0c36a14ac1c@gmail.com> Date: Thu, 7 Mar 2024 16:36:29 +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: Content-Language: en-US Message-ID-Hash: ZEMKTY3OUHXKBBRLVY5Y5G5ZO67RABKM X-Message-ID-Hash: ZEMKTY3OUHXKBBRLVY5Y5G5ZO67RABKM 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 06.03.2024 um 20:17: > On 3/6/24 19:50, Wolfgang Schuster wrote: >>> [...] >>> Could you write the first line in plain language? >> >> Look at the second example of the Lua code in the example below for each >> command (the first example is your version), the third example is just a >> condensed version of example 2. > > Many thanks for your extended explanation, Wolfgang. Here is another solution which uses \ifcase the select a different case dependent on the value of the remainder. \def\beforequadruplenumber#1% {\ifcase\numexpr#1;4\relax \the\numexpr#1+3\relax % remainder = 0 \or \the\numexpr#1+2\relax % remainder = 1 \or \the\numexpr#1+1\relax % remainder = 2 \or \the\numexpr#1+4\relax % remainder = 3 \fi} \def\afterquadruplenumber#1% {\ifcase\numexpr#1;4\relax \the\numexpr#1+1\relax % remainder = 0 \or \the\numexpr#1+4\relax % remainder = 1 \or \the\numexpr#1+3\relax % remainder = 2 \or \the\numexpr#1+2\relax % remainder = 3 \fi} > Now it is clearer to me (although I need some time to learn from it). When you use \numexpr to perform arithmetic in TeX it is recommended to add a final \relax to stop the command from scanning to additional values, e.g. in the example below \testone takes value beyond the argument because \numexpr hasn't ended yet. \starttext \def\testone#1{\the\numexpr #1 + 1 } \testone{1} + 1 \def\testtwo#1{\the\numexpr #1 + 1 \relax} \testtwo{1} + 1 \stoptext 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 ___________________________________________________________________________________