I have a macro \mymacro@i
that I want to "feed" with the expansion of another \test
. With \expandafter\mymacro@i\test
, it works.
Now, the \test
macro can be defined by using \csname
, say a /test
macro. I can't find the combination of \expandafter
to make it work the same way as with \test
. How can I do?
\documentclass{standalone}
\makeatletter
\expandafter\def\csname /test\endcsname{%
\foo{bar}}
\def\mymacro#1{%
\expandafter\mymacro@i\csname/#1\endcsname}
\def\mymacro@i\foo#1{%
\def\temp{#1}%
\show\temp}
\mymacro{test}
% Error: Use of \mymacro@i doesn't match its definition.
%
\def\test{\foo{bar}}
\def\mymacro#1{%
\expandafter\mymacro@i\test}
\def\mymacro@i\foo#1{%
\def\temp{#1}%
\show\temp}
\mymacro{test}
\begin{document}
\end{document}