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.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI 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 811C42D663 for ; Wed, 16 Oct 2024 23:24:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 2FB4548541D for ; Wed, 16 Oct 2024 23:21:42 +0200 (CEST) Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=ntg.nl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntg.nl; h= content-type:content-type:list-unsubscribe:list-subscribe :list-post:list-owner:list-help:list-archive:archived-at:list-id :subject:subject:reply-to:precedence:from:from:content-language :user-agent:mime-version:date:date:message-id:received:received :received:received:received:received; s=cgl; t=1729113701; x= 1731705702; bh=aA3Zy12uC7SGj+nOlXO0UjxyYbZDW1Xohf5wdUOT3hA=; b=T b2xnavOK7ybYOACxpI/1JLVha57PBK78tCQJx8PxlZ0IEMUW4OGVFQk8+IdRrls9 RYbYIKhd9nXMJwrqXC3C2EHQlrEY0uv59MrrbIfHe34GkwSxoZKnLC5wZBIKzXUf vTw6/3QO34BomW53Gdff6vILUjYJ/mlI0e5HfoiSiE= 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 sraOQVilKsDR for ; Wed, 16 Oct 2024 23:21:41 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 6797F48544D for ; Wed, 16 Oct 2024 23:19:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D89A84850B6 for ; Wed, 16 Oct 2024 23:18:58 +0200 (CEST) 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 25o_vm2EptWG for ; Wed, 16 Oct 2024 23:18:58 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=166.84.1.89; helo=mailbackend.panix.com; envelope-from=context@rik.users.panix.com; receiver= Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 29DA84850B2 for ; Wed, 16 Oct 2024 23:18:57 +0200 (CEST) Received: from [192.168.5.71] (syn-024-194-002-237.res.spectrum.com [24.194.2.237]) by mailbackend.panix.com (Postfix) with ESMTPSA id 4XTP3N3Xjxz444F for ; Wed, 16 Oct 2024 17:18:56 -0400 (EDT) Message-ID: <8b8380f8-fcaa-483b-bfd8-dfc4cf554d6e@rik.users.panix.com> Date: Wed, 16 Oct 2024 17:18:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: mailing list for ConTeXt users Content-Language: en-US From: Rik Kabel Message-ID-Hash: 6X3KVWDFE4AUQH5NJDX5HWZEANO5IU25 X-Message-ID-Hash: 6X3KVWDFE4AUQH5NJDX5HWZEANO5IU25 X-MailFrom: ConTeXt@rik.users.panix.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 X-Mailman-Version: 3.3.9 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Low-level macro help needed List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============1731356474411704353==" This is a multi-part message in MIME format. --===============1731356474411704353== Content-Type: multipart/alternative; boundary="------------wk01g1rVnFDqkUUt5vooIkl1" Content-Language: en-US This is a multi-part message in MIME format. --------------wk01g1rVnFDqkUUt5vooIkl1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hello Hans and developers, I have been trying to convert some two- and three-step macros (as shown=20 below) to single-step macros using the LMTX syntax given in the=20 low-level macros manual. I have succeeded in many cases, but failed when=20 the macro follows one particular group of patterns. The group of patterns is similar to this macro to process \MyMacro[optional]{Required}{Required}{Optional} In this the number of arguments can be 2, 3, or 4. A three-step solution might be as follows, which I use for a list of=20 persons: \defineregister[Bindex] \setupregister [Bindex][n=3D1, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bal= ance=3Dno, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 met= hod=3Ddefault, % or New follows Newton! =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 com= press=3Dno, % yes if not note number+q =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 exp= ansion=3Dyes, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pag= ecommand=3D\gobbleoneargument =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ] \starttexdefinition unexpanded Bi =C2=A0 \dosingleempty\doBindex \stoptexdefinition \starttexdefinition unexpanded doBindex [#SORTAS]#INDEXED =C2=A0 \def\SortAs{#SORTAS}% =C2=A0 \def\Indexed{#INDEXED}% =C2=A0 \dodoublegroupempty\doBindexFull \stoptexdefinition \starttexdefinition doBindexFull #BD#MORE =C2=A0 \doifemptyelse{#MORE} =C2=A0=C2=A0=C2=A0 {\Bindex[\SortAs]{\Indexed\ #BD}} =C2=A0=C2=A0=C2=A0 {\Bindex[\SortAs]{\Indexed\ #BD\\ #MORE}} \stoptexdefinition with input like: \Bi{Rumble, Walker}{1938|=E2=80=93|}% \Bi{Runia, David Theunis}{1951|=E2=80=93|}{Classicist}% \Bi{Rutherford, Ernest (Baron Rutherford of Nelson)}{1871|=E2=80=93|1937}{Physicist}% \Bi{Saenger, Paul}{1945|=E2=80=93|}% \Bi{Saldarini, Anthony J.}{1941|=E2=80=93|2001}% \Bi{Salter, William M.}{1853|=E2=80=93|1931}% \Bi[Saint-Exupery]{de Saint-Exup=C3=A9ry, Antoine}{1900|=E2=80=93|194= 4}% \Bi{Santayana, George}{1863|=E2=80=93|1952}% \Bi{Sapir, Edward}{1884|=E2=80=93|1939}{Linguist}% \Bi[Schrodinger]{Schr=C3=B6dinger, Erwin}{1887|=E2=80=93|1961}{Physic= ist}% \Bi[Spinoza]{de Spinoza, Baruch (Benedict de Spinoza, Bento de Espinosa)}{1632|=E2=80=93|1677}% The best I can get with the newer syntax is a two-step: \starttexdefinition unexpanded Bi =C2=A0 \dosingleempty\doBindex \stoptexdefinition \tolerant\def\doBindex [#1]#=3D#=3D#=3D% =C2=A0 {\doifemptyelse{#4} =C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3}}% =C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3\\ #4}}% =C2=A0 } In the low-level macros manual, near the end of chapter 2, it says that=20 some day there may be a use for #?, #!, #<, or #>. If I am not missing=20 something in the manual about how to provide that first optional=20 argument as an empty value, I think I have one. Could [#?] always return=20 a value (perhaps empty)? That would allow something like: \tolerant\def\doBindex [#?]#=3D#=3D#=3D% =C2=A0 {\doifemptyelse{#4} =C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3}}% =C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3\\ #4}}% =C2=A0 } --=20 Rik --------------wk01g1rVnFDqkUUt5vooIkl1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hello Hans and developers,

I have been trying to convert some two- and three-step macros (as shown below) to single-step macros using the LMTX syntax given in the low-level macros manual. I have succeeded in many cases, but failed when the macro follows one particular group of patterns.

The group of patterns is similar to this macro to process

\MyMacro[optional]{Required}{Required}{Optional}

In this the number of arguments can be 2, 3, or 4.

A three-step solution might be as follows, which I use for a list of persons:

\defineregister[Bindex]
\setupregister [Bindex][n=3D1,
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = balance=3Dno,
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = method=3Ddefault, % or New follows Newton!
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = compress=3Dno, % yes if not note number+q
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = expansion=3Dyes,
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = pagecommand=3D\gobbleoneargument
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ]

\starttexdefinition unexpanded Bi
=C2=A0 \dosingleempty\doBindex
\stoptexdefinition

\starttexdefinition unexpanded doBindex [#SORTAS]#INDEXED
=C2=A0 \def\SortAs{#SORTAS}%
=C2=A0 \def\Indexed{#INDEXED}%
=C2=A0 \dodoublegroupempty\doBindexFull
\stoptexdefinition

\starttexdefinition doBindexFull #BD#MORE
=C2=A0 \doifemptyelse{#MORE}
=C2=A0=C2=A0=C2=A0 {\Bindex[\SortAs]{\Indexed\ #BD}}
=C2=A0=C2=A0=C2=A0 {\Bindex[\SortAs]{\Indexed\ #BD\\ #MORE}}
\stoptexdefinition

with input like:

\Bi{Rumble, Walker}{1938|=E2=80=93|}%
\Bi{Runia, David Theunis}{1951|=E2=80=93|}{Classicist}%
\Bi{Rutherford, Ernest (Baron Rutherford of Nelson)}{1871|=E2=80=93|1937}{Physicist}%
\Bi{Saenger, Paul}{1945|=E2=80=93|}%
\Bi{Saldarini, Anthony J.}{1941|=E2=80=93|2001}%
\Bi{Salter, William M.}{1853|=E2=80=93|1931}%
\Bi[Saint-Exupery]{de Saint-Exup=C3=A9ry, Antoine}{1900|=E2=80=93= |1944}%
\Bi{Santayana, George}{1863|=E2=80=93|1952}%
\Bi{Sapir, Edward}{1884|=E2=80=93|1939}{Linguist}%
\Bi[Schrodinger]{Schr=C3=B6dinger, Erwin}{1887|=E2=80=93|1961}{Ph= ysicist}%
\Bi[Spinoza]{de Spinoza, Baruch (Benedict de Spinoza, Bento de Espinosa)}{1632|=E2=80=93|1677}%

The best I can get with the newer syntax is a two-step:


\starttexdefinition unexpanded Bi
=C2=A0 \dosingleempty\doBindex
\stoptexdefinition
\tolerant\def\doBindex [#1]#=3D#=3D#=3D%
=C2=A0 {\doifemptyelse{#4}
=C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3}}%
=C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3\\ #4}}%
=C2=A0 }

In the low-level macros manual, near the end of chapter 2, it says that some day there may be a use for #?, #!, #<, or #>. If I am not missing something in the manual about how to provide that first optional argument as an empty value, I think I have one. Could [#?] always return a value (perhaps empty)? That would allow something like:

\tolerant\def\doBindex [#?]#=3D#=3D#=3D%
=C2=A0 {\doifemptyelse{#4}
=C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3}}%
=C2=A0=C2=A0=C2=A0 {\Bindex[#1]{#2\ #3\\ #4}}%
=C2=A0 }

--
Rik



--------------wk01g1rVnFDqkUUt5vooIkl1-- --===============1731356474411704353== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1731356474411704353==--