From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107978 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: Re: About xstring and ConTeXt Date: Tue, 7 Jul 2020 15:08:37 -0500 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4412435863360372653==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24106"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 07 22:09:06 2020 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 1jsttp-000691-R9 for gctc-ntg-context-518@m.gmane-mx.org; Tue, 07 Jul 2020 22:09:05 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 516A918551F; Tue, 7 Jul 2020 22:08:52 +0200 (CEST) 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 uQXRAqwmoXlP; Tue, 7 Jul 2020 22:08:51 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 53BBB1855F1; Tue, 7 Jul 2020 22:08:51 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CFE841854B9 for ; Tue, 7 Jul 2020 22:08:50 +0200 (CEST) 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 wtw7j9gRzY21 for ; Tue, 7 Jul 2020 22:08:49 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.45; helo=mail-wr1-f45.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 A34AA18530C for ; Tue, 7 Jul 2020 22:08:49 +0200 (CEST) Original-Received: by mail-wr1-f45.google.com with SMTP id z13so46584124wrw.5 for ; Tue, 07 Jul 2020 13:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8GNzobBn3ds8JBGiDlFGgnXxDg+iv2f9EkQ2ps597e4=; b=lJGWeS/ewTKgzBlFwDjmwS1uoOCIujj0dKTSiCYuo8MR+NgFOfpjmYtapMyxSx4foS kHSgXMN9ZDfsSsApWh0IHhh2U0NUKLjpUCV1utoFz14KRE7YH3IV+578BDBG/ZCkggzu OuZcRAqqII4rwjLxrQfuixHSpudrBuA1+fLAbFg4ts7gXxgx4yByu8WY5UVaaH0xGXAv cmGGCxbrQHEpX04SLZt9jUI6egTN98d61boZoUu6IGPFQfSthnkK4TQI0JSbNTsaBMSa APZXmDCU3iLgvHAG+sv2uJgOxIkconzHNu1381KMT/JRPo2Co56CwFdNZ68cJgUW6Ydp BYYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=8GNzobBn3ds8JBGiDlFGgnXxDg+iv2f9EkQ2ps597e4=; b=YaUCpogTEPLvw4gAZTLr3MlNnKj6bDyE9gf9oOHMxQsE4Ajhyozob/VOKgvVu50tcA yb6JpTtRJ8/mhMQNad/Stqy8UEW7nZ1HPiaRkIZUJjqD0vG5JPGdIOXj4/otvZMEFZMW kW387Bw7H0HvwVa7EuIGVbhQSBqtvAnS1U8yZARgkwI6H3AAhorkwnU3XFy/PF9nKIgf xItyJkm4JTPij+esKp0JKfWZ9gcWfdELt/GNXhp/00gHY20yfvLZClWBPj3/0kavxmE7 dyfd3SsAtcfBHx/NU/knZRudHCGmRuDSiDFffGL+/Mqns2NAHqbJSse464qebVSp8tMb TqCw== X-Gm-Message-State: AOAM531DmeoHMkN3AMucSZi+qx55pWlfWOWdw+EWrLV2PTlqLEjmMqee JPtxIesZIUxpSwH3fOm9IP925IPG/Lm1qx6lZg2f83rK X-Google-Smtp-Source: ABdhPJxPysKWgyB/hh4ZpjFDoUiU7Dry7TadS61rgBXLgXuK0WkL369Cy3nFx3hwIeZWbc1SCe9ui4f9JGqRT7Bnb1U= X-Received: by 2002:a5d:4f8b:: with SMTP id d11mr30370850wru.147.1594152529021; Tue, 07 Jul 2020 13:08:49 -0700 (PDT) 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:107978 Archived-At: --===============4412435863360372653== Content-Type: multipart/alternative; boundary="00000000000035d05305a9df8fa5" --00000000000035d05305a9df8fa5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've tried with a wrapper and it seems to work fine. However, changing definitions "on the fly" to make xstring usable seems to break things in ConTeXt... Whatever. I guess I will have to find out other command redefinitions in ConTeXt. Thank you very much, Phelype. Jairo :) El mar., 7 de jul. de 2020 a la(s) 13:54, Phelype Oleinik ( phe.h.o1@gmail.com) escribi=C3=B3: > Hi Jairo, > > ConTeXt's \unexpanded is e-TeX's \protected, so the error boils down to > something like: \edef\x{\unexpanded{#}}, which works in Plain but not in > ConTeXt. > > Usually packages that claim to be generic have to cope with that. > xstring would need to do (in a ConTeXt-specific loader): > \let\xstring@unexpanded\normalunexpanded > and > \let\xstring@unexpanded\unexpanded > in Plain and LaTeX loaders, then then use \xstring@unexpanded in the > code. But `xstring` doesn't claim (that I found, at least) to be > compatible with ConTeXt, so it's understandable: though if it is > compatible with Plain, it wouldn't be hard to adapt to ConTeXt. > > That said, you can load `xstring` if you do: > \let\unexpanded\normalunexpanded > \input xstring.tex > \let\unexpanded\protected > but the internals of the package will probably be comprimised by the > misuse of (ConTeXt) \unexpanded. > > Phelype > > On Tue, Jul 7, 2020 at 3:40 PM Jairo A. del Rio > wrote: > > > > Reading about macro bundles meant to be generic (format agnostic), some > of them work in plain/LaTeX, but crash when loaded on ConTeXt. The > following happens with xstring.tex > > > > tex error > tex error on line 372 in file xstring.tex: ! Illegal > parameter number in definition of \xs_reserved_C > > > > > > > > > > 1 > > > > \xs_newlines ->\unexpanded {}\xs_def \xs_arg_i {##1 > > > > } > > > > \xs_newmacro_ ...name \xs_myarg }\edef \xs_reserved_C {\unexpanded > \expandafter {\xs_newlines > > > > }\edef \noexpand \xs_call }\edef \xs_reserved_D {... > > > > l.372 \xs_newmacro\StrRemoveBraces{}{1}{1} > > > > {% > > > > > > > > > > > > You meant to type ## instead of #, right? Or maybe a } was forgotten > somewhere > > > > earlier, and things are all screwed up? I'm going to assume that you > meant ##. > > > > I've tried changing the catcode regime, but with no effect. > > > > Don't misunderstand me. I'm aware of ConTeXt capabilities and string > manipulation via Lua. My question is more like: "Why doesn't xstring.tex?= " > > > > Sorry if my question is outside the scope of ConTeXt > developers/maintainers. Thank you very much. > > > > Jairo :) > > > > > _________________________________________________________________________= __________ > > If your question is of interest to others as well, please add an entry > to the Wiki! > > > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > > archive : https://bitbucket.org/phg/context-mirror/commits/ > > wiki : http://contextgarden.net > > > _________________________________________________________________________= __________ > > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ > --00000000000035d05305a9df8fa5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've tried with a wrapper and it seems to wo= rk fine. However, changing definitions "on the fly" to make xstri= ng usable seems to break things in ConTeXt... Whatever. I guess I will have= to find out other command redefinitions in ConTeXt.

Thank you= very much, Phelype.

Jairo :)

El mar., 7 de jul. de 2020 a = la(s) 13:54, Phelype Oleinik (phe.h.o= 1@gmail.com) escribi=C3=B3:
Hi Jairo,

ConTeXt's \unexpanded is e-TeX's \protected, so the error boils dow= n to
something like: \edef\x{\unexpanded{#}}, which works in Plain but not in ConTeXt.

Usually packages that claim to be generic have to cope with that.
xstring would need to do (in a ConTeXt-specific loader):
=C2=A0 =C2=A0 \let\xstring@unexpanded\normalunexpanded
and
=C2=A0 =C2=A0 \let\xstring@unexpanded\unexpanded
in Plain and LaTeX loaders, then then use \xstring@unexpanded in the
code.=C2=A0 But `xstring` doesn't claim (that I found, at least) to be<= br> compatible with ConTeXt, so it's understandable: though if it is
compatible with Plain, it wouldn't be hard to adapt to ConTeXt.

That said, you can load `xstring` if you do:
=C2=A0 =C2=A0 =C2=A0\let\unexpanded\normalunexpanded
=C2=A0 =C2=A0 =C2=A0\input xstring.tex
=C2=A0 =C2=A0 =C2=A0\let\unexpanded\protected
but the internals of the package will probably be comprimised by the
misuse of (ConTeXt) \unexpanded.

Phelype

On Tue, Jul 7, 2020 at 3:40 PM Jairo A. del Rio <jairoadelrio6@gmail.com> wrote= :
>
> Reading about macro bundles meant to be generic (format agnostic), som= e of them work in plain/LaTeX, but crash when loaded on ConTeXt. The follow= ing happens with xstring.tex
>
> tex error > tex error on line 372 in file xstring.tex: ! Illegal pa= rameter number in definition of \xs_reserved_C
>
>
> <to be read again>
>
> 1
>
> \xs_newlines ->\unexpanded {}\xs_def \xs_arg_i {##1
>
> }
>
> \xs_newmacro_ ...name \xs_myarg }\edef \xs_reserved_C {\unexpanded \ex= pandafter {\xs_newlines
>
> }\edef \noexpand \xs_call }\edef \xs_reserved_D {...
>
> l.372 \xs_newmacro\StrRemoveBraces{}{1}{1}
>
> {%
>
>
> <empty file>
>
>
> You meant to type ## instead of #, right? Or maybe a } was forgotten s= omewhere
>
> earlier, and things are all screwed up? I'm going to assume that y= ou meant ##.
>
> I've tried changing the catcode regime, but with no effect.
>
> Don't misunderstand me. I'm aware of ConTeXt capabilities and = string manipulation via Lua. My question is more like: "Why doesn'= t xstring.tex?"
>
> Sorry if my question is outside the scope of ConTeXt developers/mainta= iners. Thank you very much.
>
> Jairo :)
>
> ______________________________________________________________________= _____________
> If your question is of interest to others as well, please add an entry= to the Wiki!
>
> maillist : ntg= -context@ntg.nl / http://www.ntg.nl/mailman/listin= fo/ntg-context
> webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.ne= t
> archive=C2=A0 : https://bitbucket.org/phg/cont= ext-mirror/commits/
> wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
> ______________________________________________________________________= _____________
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--00000000000035d05305a9df8fa5-- --===============4412435863360372653== 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== --===============4412435863360372653==--