From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
"Jairo A. del Rio" <jairoadelrio6@gmail.com>
Subject: Re: About xstring and ConTeXt
Date: Wed, 8 Jul 2020 12:15:07 +0200 [thread overview]
Message-ID: <a81855fa-b2f7-98ad-9bfa-7f4a12fb141f@xs4all.nl> (raw)
In-Reply-To: <CAKyqqaYQpb0yB5=WqTRMiXj60QHEZf_4d2eiG78SnLvvmn_pkg@mail.gmail.com>
On 7/8/2020 12:00 AM, Jairo A. del Rio wrote:
> Yep, now it finally works. Certainly it requires a few more lines. I was
> going to rewrite some TikZ code which was too dependent on LaTeX and
> xstring was the last stone on the shoe. Thank you a lot, Phelype and
> Wolfgang (I didn't know about push/popmacro either and now it's in my
> to-do readings).
We can have a module that takes care of some things, like
\usemodule[system-aliasing]
\registeralias\unexpanded\normalunexpanded % preset
\registeralias\expanded \normalexpanded % preset
\registeraliasfile{rubish.tex} % any file with that name
\registeraliasfile{generic/*.tex} % a bit more explicit
after which
\input rubish.tex
\input generic/foo.tex
(or whatever way it's loaded) will (hopefully) work ok. But as a module,
not in the core, because we don't want additional overhead for third
party stuff, but ok on user demand. Of course one cannot expect the
context dev to keep a list of files that need such a treatment.
Hans
> Jairo :D
>
> El mar., 7 de jul. de 2020 a la(s) 16:31, Phelype Oleinik
> (phe.h.o1@gmail.com <mailto:phe.h.o1@gmail.com>) escribió:
>
> On Tue, Jul 7, 2020 at 6:21 PM Jairo A. del Rio
> <jairoadelrio6@gmail.com <mailto:jairoadelrio6@gmail.com>> wrote:
> >
> > 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.
>
> As I said, the internals of `xstring` still use \unexpanded which, after
> you do \popmacro\unexpanded, will mean e-TeX's \protected, rather than
> \unexpanded, which are quite different. To be on the safe side, you'd
> need to wrap every `xstring` command in
> \pushmacro\unexpanded
> \let\unexpanded\normalunexpanded
> <xstring stuff>
> \popmacro\unexpanded
> to make sure that \unexpanded means what `xstring` expects.
>
> The *proper* way to make `xstring` work in ConTeXt would be something
> like Circuitikz does:
> \ifcsname normalunexpanded\endcsname
> \let\pgfcircutil@unexpanded\normalunexpanded
> \else
> \let\pgfcircutil@unexpanded\unexpanded
> \fi
> then use \pgfcircutil@unexpanded in the code, which will always have the
> same meaning. That, of course, requires an update to `xstring`.
>
> Phelype
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl <mailto: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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2020-07-08 10:15 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
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 [this message]
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=a81855fa-b2f7-98ad-9bfa-7f4a12fb141f@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=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).