## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

 Subject: Rescanning an argument with a special catcode for the colon From: "Julien RIVAUD (_FrnchFrgg_)" <[log in to unmask]> Reply To: Mailing list for the LaTeX3 project <[log in to unmask]> Date: Thu, 3 Dec 2009 14:08:37 +0100 Content-Type: text/plain Parts/Attachments: text/plain (69 lines)
Hi,

I'm not sure this ML is the right place to be asking my question, so

I consider myself rather intimate with TeX (for instance I once
reimplemented a key-val interface because the keyval package gobbled to
much braces, and because I wanted more unknown key/unknown value
facilities; nowadays I just use l3kv or l3keys), and I have been playing
with expl3 for half a year.

I really like the approach you have taken, and have begun the process to
rewrite my custom (ad-hoc) packages to take advantage of expl3; I could
get rid of a lot of my packages since the functionnality is now directly
included (probably better done than I could ever do myself), so thanks a
lot for that.

The transision to expl3 is smooth until now, but I have one package that
I have difficulty in translating: In my thesis, I use a kind of thing
whose textual representation is some circles and squares intertwinned
with integers. To type that, I like to use for instance `.8:3.9:5.9:0.'
where a dot would be replaced by a circle and a colon by a square. I
currently have a macro \chemin which typesets its argument in a new
catcode regime where . is essentially \bullet and : is \square.

\chemin is defined like this:

\begingroup
\catcode`\:=13\catcode`\.=13\relax
\gdef\chemin#1{%
\begingroup
\catcode`\:=13\catcode`\.=13\relax
\let.\cheminsommet
\let:\cheminface
\endlinechar=-1\everyeof{}%
\scantokens{#1}%
\endgroup
}
\endgroup

I'm sure there is a way to define this in a beautiful expl3 manner, but
I didn't find any satisfying definition. Of course I can basically use
expl3 names and functions like \char_make_active:N, and using
\cs_set_eq:NN to cheat and alias the functions I need to names without a
colon, but that's hardly good looking.

Can you be of some help ? Or is there no beautiful way to solve this ?
In which case, should there be an expl3 function akin to

\tl_rescan_with_active_char:nn { <char>=<token>, <char>=<token>, ...}{
<token list> }

where the <token>s in the first arg wouldn't be rescanned so that I
could say

\tl_rescan_with_active_char:nn { :=\module_do_something:n,
.=\module_do_another: } { #1 }
and it wouldn't complain about a non existent macro \module_do_something

I tried to play with \tl_[set_]rescan and didn't succeed in writing such
a \tl_rescan_with_active_char:nn

Cheers,

Julien RIVAUD