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
___________________________________________________________________________________