From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113589 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joey McCollum via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Checking for a Unicode prefix of a Unicode string Date: Mon, 29 Nov 2021 12:11:59 -0500 Message-ID: References: <47a78903-0e58-7b6a-a6ba-1cf7f83e62de@xs4all.nl> <29046f7f-f861-f1d4-ba22-331a2301e2b6@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4825258724195769065==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19117"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Joey McCollum , mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Mon Nov 29 18:13:04 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mrkDA-0004o7-Qs for gctc-ntg-context-518@m.gmane-mx.org; Mon, 29 Nov 2021 18:13:04 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5E68E280329; Mon, 29 Nov 2021 18:12:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RDYqovasqASQ; Mon, 29 Nov 2021 18:12:25 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E21EC28045F; Mon, 29 Nov 2021 18:12:24 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7236B280329 for ; Mon, 29 Nov 2021 18:12:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Td7hoJyxfTDj for ; Mon, 29 Nov 2021 18:12:22 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.173; helo=mail-il1-f173.google.com; envelope-from=jmccollum20140511@gmail.com; receiver= Original-Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 31723280169 for ; Mon, 29 Nov 2021 18:12:22 +0100 (CET) Original-Received: by mail-il1-f173.google.com with SMTP id w4so18137741ilv.12 for ; Mon, 29 Nov 2021 09:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pqF6eOO1F/kZAhFjpXtwcqt1e9Jlkthl6H/Trx4jFRA=; b=Wec81HxWXRU0Ch68hCmeCmsHhWv39f8JPhdgyzrMkazE1hApRgO6lhKvFqYoM3PK/Q 2jD06rt2unHTp8PZuagzBBqX54LmEcDtSIYurDnWeE/MnDr4HmrJrw7dpGMXqJQILET/ A0eG6of8U5AnvTnLuAwAcdg/+6iD+qVM/PokDj/llO4PcZpQ0yZbKqWN6OVvSkWXB71t l1kSSk6ByX9/U5WrsqywxGl0eMTlZwN0SlcYQ1bif6OZTWeTH1b3lU6oao29GyRS5Aho x0J/xeDUQr9yHGw3EdBdAQR3mHFE5cM65+4mTVepbiTWugznnRsciJ+3hOpG1q5T+UJi nDbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pqF6eOO1F/kZAhFjpXtwcqt1e9Jlkthl6H/Trx4jFRA=; b=SgGxJwYDb/O2N5sxqtrjXBdGOiyqQbgCvDHUYL/S7DaTaTMsvn8IjAduDujSgnJppV AMA9JGU8CaMDYiZbGfudxlVlGpCTESogr/+ofvzZvX6j2X5lAHnCw8OEZgi/vcjoAOg4 NfWwEgAY9SwWT6HgVXULfJ39Ze+ZDy5fcFB8Atc0hUs29LeqoVrbtzNRCRwKCcfd/+sZ bB68AqBEbhulRGRcQ0RBBHmX1WavCIFZLp/xwEspR5FKAMwTGiBSCJ3uDFUUvQ0e9WgT rZCMaa25RJ59AaXKGJ/MqaZOu1+eYbcLUVQf4qbH2ElOgsgjpdC67Ij+X4WJ/3rCDNYE J1qg== X-Gm-Message-State: AOAM530f/LXvHHMDEqkFn/dBuB1IlVK3wWVXU7CcoUQQiThNXnqIan+8 Kq9iPiLlS1IQpE52ummoyVXJCymTs9mFuqBvIWg= X-Google-Smtp-Source: ABdhPJwAFB5751Ahq3Qpt0ycJRhx1zIrbm1h4l61tK5ynTePlC/3xclfz6Vr8akQf1Qo4Wgh2QdZQyDz2x2fKxfxg5E= X-Received: by 2002:a05:6e02:1485:: with SMTP id n5mr14450250ilk.77.1638205940488; Mon, 29 Nov 2021 09:12:20 -0800 (PST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:113589 Archived-At: --===============4825258724195769065== Content-Type: multipart/alternative; boundary="00000000000026df9205d1f08b9c" --00000000000026df9205d1f08b9c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Okay. So using this example as a template, I'd like to do the following: - define a general-purpose \loc macro that can be invoked in the main text (i.e., outside of citations) in the usual way; this one would correspond to \WhateverB above and would not remove punctuation precedin= g the macro. - separately define a \loctextloc macro that accepts the same input as \loc, but conditionally removes preceding punctuation based on variables set outside of this macro during the citation process (e.g., \btxsblshorthandbeforetextloc); this would correspond to \WhateverA abov= e. - in the macro for typesetting the loctext btx parameter, redefine \loc to do what \loctextloc does, and then invoke \currentbtxloctext so that = the \loc invocations it contains will be expanded like \loctextloc, as follo= ws: \begingroup \def\loc\loctextloc \currentbtxloctext \btxcomma \endgroup Is this a ConTeXt-friendly way to do this? I'm attempted this now, but I have some errors to debug, and I'd like to know if this is even a feasible direction before I continue. Joey On Sun, Nov 28, 2021 at 5:39 AM Hans Hagen wrote: > On 11/28/2021 2:39 AM, Joey McCollum wrote: > > I was afraid that might be the problem. I've described some of the > > intended purpose of this code near the end of the "Checking for a macro > > ... > > Maybe play with: > > \starttext > > \def\WhateverA{\removeunwantedspaces\removepunctuation\space =C2=B6 1.23} > \def\WhateverB{=C2=B6 1.23} > > foo bar, \WhateverA\ test > foo bar, \WhateverB\ test > > \stoptext > > so, wrap =C2=B6 into a macro > > \def\MyParSymbol{\removeunwantedspaces\removepunctuation\space =C2=B6} > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > --00000000000026df9205d1f08b9c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Okay. So using this example as a template, I'd like to= do the following:=C2=A0
  • define a general-purpose \loc macro th= at can be invoked in the main text (i.e., outside of citations) in the usua= l way; this one would correspond to \WhateverB above and would not remove p= unctuation preceding the macro.
  • separately define a \loctextloc mac= ro that accepts the same input as \loc, but conditionally removes preceding= punctuation based on variables set outside of this macro during the citati= on process (e.g., \btxsblshorthandbeforetextloc); this would correspond to = \WhateverA above.
  • in the macro for typesetting the loctext btx para= meter, redefine \loc to do what \loctextloc=C2=A0does, and then invoke \cur= rentbtxloctext=C2=A0so that the \loc invocations it contains will be expand= ed like \loctextloc, as follows:=C2=A0
\begingroup
\def\= loc\loctextloc
\currentbtxloctext
\btxcomma
\endgroup

Is this a ConTeXt-friendly wa= y to do this? I'm attempted this now, but I have some errors to debug, = and I'd like to know if this is even a feasible direction before I cont= inue.

Joey

On Sun, Nov 28, 2021 at 5:39 AM Hans Hag= en <j.hagen@xs4all.nl> wrote= :
On 11/28/2021 = 2:39 AM, Joey McCollum wrote:
> I was afraid that might be the problem. I've described some of the=
> intended purpose of this code near the end of the "Checking for a= macro=C2=A0 > ...

Maybe play with:

\starttext

\def\WhateverA{\removeunwantedspaces\removepunctuation\space =C2=B6 1.23} \def\WhateverB{=C2=B6 1.23}

foo bar, \WhateverA\ test
foo bar, \WhateverB\ test

\stoptext

so, wrap =C2=B6 into a macro

\def\MyParSymbol{\removeunwantedspaces\removepunctuation\space =C2=B6}

Hans

-----------------------------------------------------------------
=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=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------
--00000000000026df9205d1f08b9c-- --===============4825258724195769065== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============4825258724195769065==--