(Please take the following question rather for a moot point than for an everyday-problem.)
Is there an expandable method for distinguishing an arbitrary explicit non-active character token from its active pendant while the active pendant is let equal to the arbitrary explicit non-active character token in question?
In other words:
Assume, you have, e.g.,
\catcode`\A=11\relax
\let\Mytemp=A
\catcode`\A=13\relax
\let A=\Mytemp
Is there an expandable method for in such circumstances distinguishing, e.g., an A of catcode 11(letter) from an A of catcode 13(active)?
The method should also work out in pure expansion contexts, e.g., within \csname..\endcsname, within \edef, ...
The method should also work out in situations where Lua-extensions are not available.
The method should also work out in situations where eTeX-extensions are not available.
The method should also work out in situations where pdfTeX-extensions are not available.
The method should also work out in situations where you cannot rely on \escapechar or the like parameters having specific values.
The method should also work out with unicode-based TeX-engines like XeTeX or LuaTeX.
The method should also work out with arbitrary explicit character tokens, not just with A.
(If the character in question was specified at the time of implementing the routine, you could use delimited arguments for the check.
With 8bit-encoding-based engines where you have 256 code points, you could probably have 256 macros, each of these macros having another active character as argument-delimiter...
I doubt this is feasible with unicode-based/utf8-encoding-based engines where you have 1114112 possible code-points and thus would need 1114112 macros, each of these macros having another active character as argument-delimiter...)
Another similar problem:
\escapechar=-1
\catcode`\A=11
\catcode`\B=11
\let\A=A
\let\B=B
How to expandably distinguish \A from A?
How to expandably distinguish \B from B?
(Same requirements as in the previous question.)
\foobarafter\let\foobar=X... – Ulrich Diez Aug 26 '18 at 23:44éis in utf-8 ? – Aug 29 '18 at 08:53