Is any posssibility create similar structured macro? For example, in MWE I have a \creator
and I want create same defined macro \lecturer
, so it possible via replacing word creator
to lecturer
. And if I have many identical same macro it is boring. I need to somehow define the listing at the program level, such creator, lecturer,practicer
and then multiply the user level macros \creator
, \lecturer,
\practicer`...
\documentclass{article}
\ExplSyntaxOn
\int_new:N \l_creator_int
\NewDocumentCommand\creator{ O{} m}
{
\int_incr:N \l_creator_int
\cs_new_protected:cpn {creator\int_use:N\l_creator_int}{#2}
\tl_if_empty:nTF {#1} {} {\cs_new_protected:cpn {creator\int_use:N\l_creator_int email}{#1}}
}
%\int_new:N \l_lecturer_int
%\NewDocumentCommand\creator{ O{} m}
%{
% \int_incr:N \l_lecturer_int
% \cs_new_protected:cpn {lecturer\int_use:N\l_lecturer_int}{#2}
% \tl_if_empty:nTF {#1} {} {\cs_new_protected:cpn {lecturer\int_use:N\l_lecturer_int email}{#1}}
%
%}
%...
% same for \practicer and other
\ExplSyntaxOff
\begin{document}
\creator[]{First}
\creator{Second}
\creator[mail@internet.com]{Third}
\end{document}
\cs_new...
) but token list variables for this purpose. – egreg Dec 5 '20 at 23:02