Thank, Wolfgang! Both methods work, but both fail with the following example:

\input xstring

The log says:

tex error > tex error on line 6 in file ./tests.tex: ! This can't happen (prefixed command)

<argument> \unexpanded {


\xs_execfirst #1#2->#1

However, some others work.

El mar., 7 de jul. de 2020 a la(s) 15:20, Wolfgang Schuster ( 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

\input xstring

If your question is of interest to others as well, please add an entry to the Wiki!

maillist : /
webpage  : /
archive  :
wiki     :