ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Phelype Oleinik <phe.h.o1@gmail.com>
Subject: Re: About xstring and ConTeXt
Date: Tue, 7 Jul 2020 22:19:52 +0200	[thread overview]
Message-ID: <60da2635-f431-79fb-cacc-91847903a826@gmail.com> (raw)
In-Reply-To: <CANfjC0_Vzd5D5c7aFCqbytq5ZSAedHoRzcmpL_Le9O9vumVwoA@mail.gmail.com>

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
___________________________________________________________________________________

  parent reply	other threads:[~2020-07-07 20:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 18:40 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60da2635-f431-79fb-cacc-91847903a826@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=phe.h.o1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).