ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Jairo A. del Rio" <jairoadelrio6@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: About xstring and ConTeXt
Date: Tue, 7 Jul 2020 15:08:37 -0500	[thread overview]
Message-ID: <CAKyqqaZ8zZ2M-FZhQUZAw0n7a_3aPbQtny3TYntYSFW_gLRnng@mail.gmail.com> (raw)
In-Reply-To: <CANfjC0_Vzd5D5c7aFCqbytq5ZSAedHoRzcmpL_Le9O9vumVwoA@mail.gmail.com>


[-- 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
___________________________________________________________________________________

  reply	other threads:[~2020-07-07 20:08 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 [this message]
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

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=CAKyqqaZ8zZ2M-FZhQUZAw0n7a_3aPbQtny3TYntYSFW_gLRnng@mail.gmail.com \
    --to=jairoadelrio6@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).