[NTG-context] About xstring and ConTeXt

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Tue Jul 7 22:19:52 CEST 2020

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 at unexpanded\normalunexpanded
> and
>      \let\xstring at unexpanded\unexpanded
> in Plain and LaTeX loaders, then then use \xstring at 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


More information about the ntg-context mailing list