* About xstring and ConTeXt
@ 2020-07-07 18:40 Jairo A. del Rio
2020-07-07 18:53 ` Phelype Oleinik
0 siblings, 1 reply; 10+ messages in thread
From: Jairo A. del Rio @ 2020-07-07 18:40 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]
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
<to be read again>
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}
{%
<empty file>
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 :)
[-- Attachment #1.2: Type: text/html, Size: 2415 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 18:40 About xstring and ConTeXt Jairo A. del Rio
@ 2020-07-07 18:53 ` Phelype Oleinik
2020-07-07 20:08 ` Jairo A. del Rio
2020-07-07 20:19 ` Wolfgang Schuster
0 siblings, 2 replies; 10+ messages in thread
From: Phelype Oleinik @ 2020-07-07 18:53 UTC (permalink / raw)
To: mailing list for ConTeXt users
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 <jairoadelrio6@gmail.com> 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
>
>
> <to be read again>
>
> 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}
>
> {%
>
>
> <empty file>
>
>
> 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 18:53 ` Phelype Oleinik
@ 2020-07-07 20:08 ` Jairo A. del Rio
2020-07-07 20:19 ` Wolfgang Schuster
1 sibling, 0 replies; 10+ messages in thread
From: Jairo A. del Rio @ 2020-07-07 20:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 3759 bytes --]
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ó:
> 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 <jairoadelrio6@gmail.com>
> 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
> >
> >
> > <to be read again>
> >
> > 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}
> >
> > {%
> >
> >
> > <empty file>
> >
> >
> > 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
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 5407 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 18:53 ` Phelype Oleinik
2020-07-07 20:08 ` Jairo A. del Rio
@ 2020-07-07 20:19 ` Wolfgang Schuster
2020-07-07 20:25 ` Phelype Oleinik
2020-07-07 21:21 ` Jairo A. del Rio
1 sibling, 2 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2020-07-07 20:19 UTC (permalink / raw)
To: mailing list for ConTeXt users, Phelype Oleinik
Phelype Oleinik schrieb am 07.07.2020 um 20:53:
> 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.
Bad idea because ConTeXt also changes the meaning of \protected (you can
use \normalprotected to get the primitve).
A better version is
\pushmacro\unexpanded
\let\unexpanded\normalunexpanded
\input xstring
\popmacro\unexpanded
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 20:19 ` Wolfgang Schuster
@ 2020-07-07 20:25 ` Phelype Oleinik
2020-07-07 21:21 ` Jairo A. del Rio
1 sibling, 0 replies; 10+ messages in thread
From: Phelype Oleinik @ 2020-07-07 20:25 UTC (permalink / raw)
To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users
On Tue, Jul 7, 2020 at 5:19 PM Wolfgang Schuster
<wolfgang.schuster.lists@gmail.com> wrote:
>
> Bad idea because ConTeXt also changes the meaning of \protected (you can
> use \normalprotected to get the primitve).
Oops, forgot about that one.
> A better version is
>
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> \input xstring
> \popmacro\unexpanded
Nice, didn't know about \push/\popmacro. Thanks!
Phelype
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 20:19 ` Wolfgang Schuster
2020-07-07 20:25 ` Phelype Oleinik
@ 2020-07-07 21:21 ` Jairo A. del Rio
2020-07-07 21:30 ` Phelype Oleinik
1 sibling, 1 reply; 10+ messages in thread
From: Jairo A. del Rio @ 2020-07-07 21:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 2393 bytes --]
Thank, Wolfgang! Both methods work, but both fail with the following
example:
\pushmacro\unexpanded
\let\unexpanded\normalunexpanded
\input xstring
\popmacro\unexpanded
\starttext
\StrGobbleLeft{bcdef}{4}
\stoptext
The log says:
tex error > tex error on line 6 in file ./tests.tex: ! This can't happen
(prefixed command)
<argument> \unexpanded {
f}
\xs_execfirst #1#2->#1
However, some others work.
El mar., 7 de jul. de 2020 a la(s) 15:20, Wolfgang Schuster (
wolfgang.schuster.lists@gmail.com) escribió:
> Phelype Oleinik schrieb am 07.07.2020 um 20:53:
> > 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.
>
> Bad idea because ConTeXt also changes the meaning of \protected (you can
> use \normalprotected to get the primitve).
>
> A better version is
>
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> \input xstring
> \popmacro\unexpanded
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 3816 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 21:21 ` Jairo A. del Rio
@ 2020-07-07 21:30 ` Phelype Oleinik
2020-07-07 22:00 ` Jairo A. del Rio
0 siblings, 1 reply; 10+ messages in thread
From: Phelype Oleinik @ 2020-07-07 21:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, Jul 7, 2020 at 6:21 PM Jairo A. del Rio <jairoadelrio6@gmail.com> wrote:
>
> Thank, Wolfgang! Both methods work, but both fail with the following example:
>
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> \input xstring
> \popmacro\unexpanded
> \starttext
> \StrGobbleLeft{bcdef}{4}
> \stoptext
>
> The log says:
>
> tex error > tex error on line 6 in file ./tests.tex: ! This can't happen (prefixed command)
>
>
> <argument> \unexpanded {
>
> f}
>
> \xs_execfirst #1#2->#1
>
> However, some others work.
As I said, the internals of `xstring` still use \unexpanded which, after
you do \popmacro\unexpanded, will mean e-TeX's \protected, rather than
\unexpanded, which are quite different. To be on the safe side, you'd
need to wrap every `xstring` command in
\pushmacro\unexpanded
\let\unexpanded\normalunexpanded
<xstring stuff>
\popmacro\unexpanded
to make sure that \unexpanded means what `xstring` expects.
The *proper* way to make `xstring` work in ConTeXt would be something
like Circuitikz does:
\ifcsname normalunexpanded\endcsname
\let\pgfcircutil@unexpanded\normalunexpanded
\else
\let\pgfcircutil@unexpanded\unexpanded
\fi
then use \pgfcircutil@unexpanded in the code, which will always have the
same meaning. That, of course, requires an update to `xstring`.
Phelype
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 21:30 ` Phelype Oleinik
@ 2020-07-07 22:00 ` Jairo A. del Rio
2020-07-08 10:15 ` Hans Hagen
2020-07-08 17:47 ` Hans Hagen
0 siblings, 2 replies; 10+ messages in thread
From: Jairo A. del Rio @ 2020-07-07 22:00 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 2432 bytes --]
Yep, now it finally works. Certainly it requires a few more lines. I was
going to rewrite some TikZ code which was too dependent on LaTeX and
xstring was the last stone on the shoe. Thank you a lot, Phelype and
Wolfgang (I didn't know about push/popmacro either and now it's in my to-do
readings).
Jairo :D
El mar., 7 de jul. de 2020 a la(s) 16:31, Phelype Oleinik (
phe.h.o1@gmail.com) escribió:
> On Tue, Jul 7, 2020 at 6:21 PM Jairo A. del Rio <jairoadelrio6@gmail.com>
> wrote:
> >
> > Thank, Wolfgang! Both methods work, but both fail with the following
> example:
> >
> > \pushmacro\unexpanded
> > \let\unexpanded\normalunexpanded
> > \input xstring
> > \popmacro\unexpanded
> > \starttext
> > \StrGobbleLeft{bcdef}{4}
> > \stoptext
> >
> > The log says:
> >
> > tex error > tex error on line 6 in file ./tests.tex: ! This can't happen
> (prefixed command)
> >
> >
> > <argument> \unexpanded {
> >
> > f}
> >
> > \xs_execfirst #1#2->#1
> >
> > However, some others work.
>
> As I said, the internals of `xstring` still use \unexpanded which, after
> you do \popmacro\unexpanded, will mean e-TeX's \protected, rather than
> \unexpanded, which are quite different. To be on the safe side, you'd
> need to wrap every `xstring` command in
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> <xstring stuff>
> \popmacro\unexpanded
> to make sure that \unexpanded means what `xstring` expects.
>
> The *proper* way to make `xstring` work in ConTeXt would be something
> like Circuitikz does:
> \ifcsname normalunexpanded\endcsname
> \let\pgfcircutil@unexpanded\normalunexpanded
> \else
> \let\pgfcircutil@unexpanded\unexpanded
> \fi
> then use \pgfcircutil@unexpanded in the code, which will always have the
> same meaning. That, of course, requires an update to `xstring`.
>
> Phelype
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 3466 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 22:00 ` Jairo A. del Rio
@ 2020-07-08 10:15 ` Hans Hagen
2020-07-08 17:47 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2020-07-08 10:15 UTC (permalink / raw)
To: mailing list for ConTeXt users, Jairo A. del Rio
On 7/8/2020 12:00 AM, Jairo A. del Rio wrote:
> Yep, now it finally works. Certainly it requires a few more lines. I was
> going to rewrite some TikZ code which was too dependent on LaTeX and
> xstring was the last stone on the shoe. Thank you a lot, Phelype and
> Wolfgang (I didn't know about push/popmacro either and now it's in my
> to-do readings).
We can have a module that takes care of some things, like
\usemodule[system-aliasing]
\registeralias\unexpanded\normalunexpanded % preset
\registeralias\expanded \normalexpanded % preset
\registeraliasfile{rubish.tex} % any file with that name
\registeraliasfile{generic/*.tex} % a bit more explicit
after which
\input rubish.tex
\input generic/foo.tex
(or whatever way it's loaded) will (hopefully) work ok. But as a module,
not in the core, because we don't want additional overhead for third
party stuff, but ok on user demand. Of course one cannot expect the
context dev to keep a list of files that need such a treatment.
Hans
> Jairo :D
>
> El mar., 7 de jul. de 2020 a la(s) 16:31, Phelype Oleinik
> (phe.h.o1@gmail.com <mailto:phe.h.o1@gmail.com>) escribió:
>
> On Tue, Jul 7, 2020 at 6:21 PM Jairo A. del Rio
> <jairoadelrio6@gmail.com <mailto:jairoadelrio6@gmail.com>> wrote:
> >
> > Thank, Wolfgang! Both methods work, but both fail with the
> following example:
> >
> > \pushmacro\unexpanded
> > \let\unexpanded\normalunexpanded
> > \input xstring
> > \popmacro\unexpanded
> > \starttext
> > \StrGobbleLeft{bcdef}{4}
> > \stoptext
> >
> > The log says:
> >
> > tex error > tex error on line 6 in file ./tests.tex: ! This can't
> happen (prefixed command)
> >
> >
> > <argument> \unexpanded {
> >
> > f}
> >
> > \xs_execfirst #1#2->#1
> >
> > However, some others work.
>
> As I said, the internals of `xstring` still use \unexpanded which, after
> you do \popmacro\unexpanded, will mean e-TeX's \protected, rather than
> \unexpanded, which are quite different. To be on the safe side, you'd
> need to wrap every `xstring` command in
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> <xstring stuff>
> \popmacro\unexpanded
> to make sure that \unexpanded means what `xstring` expects.
>
> The *proper* way to make `xstring` work in ConTeXt would be something
> like Circuitikz does:
> \ifcsname normalunexpanded\endcsname
> \let\pgfcircutil@unexpanded\normalunexpanded
> \else
> \let\pgfcircutil@unexpanded\unexpanded
> \fi
> then use \pgfcircutil@unexpanded in the code, which will always have the
> same meaning. That, of course, requires an update to `xstring`.
>
> Phelype
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl <mailto: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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: About xstring and ConTeXt
2020-07-07 22:00 ` Jairo A. del Rio
2020-07-08 10:15 ` Hans Hagen
@ 2020-07-08 17:47 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2020-07-08 17:47 UTC (permalink / raw)
To: mailing list for ConTeXt users, Jairo A. del Rio
On 7/8/2020 12:00 AM, Jairo A. del Rio wrote:
> Yep, now it finally works. Certainly it requires a few more lines. I was
> going to rewrite some TikZ code which was too dependent on LaTeX and
> xstring was the last stone on the shoe. Thank you a lot, Phelype and
> Wolfgang (I didn't know about push/popmacro either and now it's in my
> to-do readings).
Just wondering ... are there specific low level hel;pers (wrt strings)
that you need in context?
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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-07-08 17:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 18:40 About xstring and ConTeXt Jairo A. del Rio
2020-07-07 18:53 ` Phelype Oleinik
2020-07-07 20:08 ` Jairo A. del Rio
2020-07-07 20:19 ` Wolfgang Schuster
2020-07-07 20:25 ` Phelype Oleinik
2020-07-07 21:21 ` Jairo A. del Rio
2020-07-07 21:30 ` Phelype Oleinik
2020-07-07 22:00 ` Jairo A. del Rio
2020-07-08 10:15 ` Hans Hagen
2020-07-08 17:47 ` Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).