TeX sets the category code of a character when it is tokenized. That means that if we have code using a 'letter' from outside a-zA-Z, we only need to worry about what's happening where the catcode is set. Thus for example in expl3
:
\cs_new:Npn \foo #1 { \__mypkg_internal_foo:n {#1} }
defines \foo
, which will use \__mypkg_internal_foo:n
even if we have changed the catcode of _
.
The only issue in normal TeX usage with _
begin a 'letter' is that it's used for subscripts. So if we want to produce a subscript within expl3
code we need to 'generate' the correct character token: \char_generate:nn { `\_ } { 8 }
We could do the same with other chars: the obvious one is @
, used by plain TeX and LaTeX2e. Using -
is more 'interesting' as in an expression such as \count10=-5\relax
, TeX requires -
is 'other'. That is a real issue, and is one reason in expl3
we've not yet found a way to 'set' the catcode of all potentially-active chars.
-
is.-
is part of the syntax of a number._
has been used in l3 code since about 1990 we really do have a lot of experience here\alpha_1, \alpha_2,...
requires_
not to be a letter or it is the undefined command\alpha_
not a subscript.\ExplSyntaxOff
(i.e. disallowing_
) is primarily meant for making the entering of math commands in documents easier.^
and_
goes back to the mid 70's it's theoretically changeable but not if you want end users to recognise the syntax as tex.