From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113591 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 15:13:38 -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="===============3855955038018082937==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6747"; 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 21:14:43 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 1mrn2x-0001al-6l for gctc-ntg-context-518@m.gmane-mx.org; Mon, 29 Nov 2021 21:14:43 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 44115280130; Mon, 29 Nov 2021 21:14:07 +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 v-0n86HxMPlk; Mon, 29 Nov 2021 21:14:05 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3BE8628032C; Mon, 29 Nov 2021 21:14:05 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 05EB428020E for ; Mon, 29 Nov 2021 21:14:04 +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 SueM431mAWkl for ; Mon, 29 Nov 2021 21:14:02 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.44; helo=mail-io1-f44.google.com; envelope-from=jmccollum20140511@gmail.com; receiver= Original-Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (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 59B73280130 for ; Mon, 29 Nov 2021 21:14:01 +0100 (CET) Original-Received: by mail-io1-f44.google.com with SMTP id e144so23041474iof.3 for ; Mon, 29 Nov 2021 12:14:01 -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=5nqMPeLdAQCXfU1OgYBzVSAh2zPwWPBeCUSprxkup4c=; b=UeytDDy8js9uCn2BDIB5yl4j04jOF7AEbCBo8YZjyoLOJaW4gbXemzKKNJk/DbSgEB y+357oT56GK1HB69gnGsiut3WA4qN/wr9fzaorcOgpcFFYPJ1XtF+XUkp5qM2sP7EUDj 5bNTkfBlQ4W3lNfuwaBQQ6E0tw+aIKW+SR/vrF8HeHfOu+Y4Fy5EOpy+MrANevdcRO3x 9y4nDVfbth5zoaGVhDMD03IrfPRNOzS9XGSJPSEP+S+U+/Y28zwO+6WZgYNoN8CEAiSd P65QVReqvbXwElEaVetCicPhz+eensR5yM++FXmFf0/+M2D9Wq3eBw5v311hB656eOmI MxQQ== 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=5nqMPeLdAQCXfU1OgYBzVSAh2zPwWPBeCUSprxkup4c=; b=sxjzOkfGstESe6zUE+EzfXs3NtMYls11igBt/XBZ4QeAb1Ouc1/vovgBX5iP/tL5Mf kGv93RI/I8U02Cym8GQHAiglL+Rp1rzf1KNUNCpUJnSM93mqmPj9xDBY56oTEtxrQhCH ljqTeJRBdKfRmwNBgHdjm145oG6oehIuDmou7ZMXSH5cTkFBZbmzU2rZreazlG/0NhBV RV998pNyov8Kr7CLRQDi9sgmI/72x06JHA5gDwVM99zr4fU8ohEa16UwPoLFdj6FY97j vtdYj/Qd7xMkacr2PtPqV4tVo88PDr6b1M0sGRQo8JEKMO2ijAwoJNWBeVMrJzNcHbtC 67/w== X-Gm-Message-State: AOAM533tOFNr7PPYdTqJsIjNbAszAG4NIICQv8zQXO6VWvqTCL6ISutP mESoLr/aCpCuXfeYVTlDp5K8lwGM8W0s0v8Gim4= X-Google-Smtp-Source: ABdhPJwlb88/ggIF68BVBoz9OE5Sy9lc7u91YlmCVupT1wjI4DGJP/skz3FRI8awGg8WTZWk18BSQFRimUze14BzOlw= X-Received: by 2002:a05:6602:2d04:: with SMTP id c4mr55976365iow.146.1638216840457; Mon, 29 Nov 2021 12:14:00 -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:113591 Archived-At: --===============3855955038018082937== Content-Type: multipart/alternative; boundary="000000000000d730f805d1f3140a" --000000000000d730f805d1f3140a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable After some debugging, the example code I offered above seems to work, with minor adjustments: \begingroup \let\loc\loctextloc \currentbtxloctext \btxcomma \endgroup Thanks again for all the help! Joey On Mon, Nov 29, 2021 at 12:11 PM Joey McCollum wrote: > 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 preced= ing > the macro. > - separately define a \loctextloc macro that accepts the same input as > \loc, but conditionally removes preceding punctuation based on variabl= es > set outside of this macro during the citation process (e.g., > \btxsblshorthandbeforetextloc); this would correspond to \WhateverA ab= ove. > - in the macro for typesetting the loctext btx parameter, redefine > \loc to do what \loctextloc does, and then invoke \currentbtxloctext s= o > that the \loc invocations it contains will be expanded like \loctextlo= c, as > follows: > > \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 feasibl= e > 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 >> ----------------------------------------------------------------- >> > --000000000000d730f805d1f3140a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
After some debugging, the example code I offered above see= ms to work, with minor adjustments:

\begingroup
\let\loc\loctext= loc
\currentbtxloctext
\btxcomma
\en= dgroup

Thanks again for all the help!
=

Joey

On Mon, Nov 29, 2021 at 12:11 PM Joey McCollu= m <jmccollum20140511@gmai= l.com> wrote:
Okay. So using this example as a template, I'd li= ke to do the following:=C2=A0
  • define a general-purpose \loc mac= ro 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 rem= ove punctuation preceding the macro.
  • separately define a \loctextlo= c macro that accepts the same input as \loc, but conditionally removes prec= eding punctuation based on variables set outside of this macro during the c= itation process (e.g., \btxsblshorthandbeforetextloc); this would correspon= d to \WhateverA above.
  • in the macro for typesetting the loctext btx= parameter, redefine \loc to do what \loctextloc=C2=A0does, and then invoke= \currentbtxloctext=C2=A0so that the \loc invocations it contains will be e= xpanded like \loctextloc, as follows:=C2=A0
\begingroup
\def\loc\loctextloc
\currentbtxloctext
\b= txcomma
\endgroup

Is thi= s 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, 2= 021 at 5:39 AM Hans Hagen <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
-----------------------------------------------------------------
--000000000000d730f805d1f3140a-- --===============3855955038018082937== 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== --===============3855955038018082937==--