I have the following package
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mypkg}
\providecommand*\@mycmd{No {\MakeUppercase Mycmd} defined}
\newcommand*\Mycmd[1]{\renewcommand*\@mycmd{#1}}
\newcommand*\showDF[1]{\csname @#1\endcsname}
\endinput
It provides the user the command \Mycmd{} to renew \@mycmd, and \showDF{mycmd} to show it's content:
\documentclass[a4paper,titlepage,11pt,twoside,openright]{report}
\usepackage{mypkg}
\begin{document}
\showDF{mycmd}\par
\Mycmd{Test}
\showDF{mycmd}
\end{document}
I'd like to have the first two commands defined with a macro, in order to generate several cmd pairs.
\@newDF{mycmd}{Mycmd}
I've tried with
\newcommand*\@newDF[2]{
\providecommand*\csname @#1\endcsname{No {\MakeUppercase #2} defined}
\newcommand*\csname #2\endcsname[1]{\renewcommand\csname @#1\endcsname{##1}}
}
but it won't run.
\newcommand*\newDF[2]{
\expandafter\providecommand\expandafter*\csname @#1\endcsname{No {\MakeUppercase #2} defined}
\expandafter\newcommand\expandafter*\csname #2\endcsname[1]{\renewcommand\csname @#1\endcsname{##1}}
}
compiles, but I really don't know why I put those \expandafter there, and anyway \MakeUppercase is ignored when \showDF{mycmd} is executed, and \Mycmd{Hi} has no effect. Replacing \csname @#1\endcsname with either @nameuse{@#1} or \csuse{@#1} neither works. What am I missing?

\MycmdI thoughtMycmdwas better but I have edited my post so that MYCMD is printed -- this just requires `\MakeUppercase{#1#1}. – Sep 25 '14 at 05:37\forcsvlist, can a command be explicitly defined, instead of passing a token? I mean doing something like\forcsvlist{\expandafter\newdimen\csname dim@##1\endcsname}{left,right,top,bottom}instead of\newcommand\mynewdimen[1]{\expandafter\newdimen\csname dim@#1\endcsname}and\forcsvlist{\mynewdimen}{left,right,top,bottom}? In the documentation it is only said to accept taking the argument last implicitly. It's just curiosity. – umarcor Sep 27 '14 at 04:20