I'm not sure I understand what you want. Do you want to define a command
\foomycmd
and then
\foo\mycmd
shall expand to it?
This is possible but you need to define
\foo
also.
Code: Select all
\documentclass{article}
\usepackage{expl3}
\newcommand*\foomycmd{football}
\newcommand*\barmycmd{soccer}
\ExplSyntaxOn
\cs_new:Npn \foo #1
{
\tl_clear:N \l_tmpa_tl
\tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 }
\use:c { foo \tl_tail:N \l_tmpa_tl }
}
\cs_set:Npn \bar #1
{
\tl_clear:N \l_tmpa_tl
\tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 }
\use:c { bar \tl_tail:N \l_tmpa_tl }
}
\ExplSyntaxOff
\begin{document}
\foo\mycmd \\
\bar\mycmd
\end{document}
The command
\foo
takes
\mycmd
as an argument, strips the backslash and then calls
\foomycmd
.
\foo\othercmd
would call
\fooothercmd
.
If that isn't what you want maybe you can show the real application you have in mind, an actual usage?
Regards