Is there a way to define TeX commands with names containing (almost) arbitrary characters, like :, -, _, numbers etc., perhaps even spaces? These are the characters I shall need apart from the standard letters, but of course, if it can be made to support more characters, that wouldn't hurt.
What I want is a command like \newmycommand that works a bit like in the following code. Preferably, it should be possible to use it also outside the preamble. I don't need the commands it defines to support arguments, but if it does not make everything harder, I suggest that you include it in an answer for the sake of other people who may need this.
\documentclass{memoir}
\def\newmycommand#1#2{%define a new command as #1 with code #2
}
\def\usemycommand#1{%apply command #1
}
\newmycommand{my-first-command:day-one}{Day one is a great day}%defines the command "my-first-command:day-one" to be the text "Day one is a great day"
\begin{document}
\usemycommand{my-first-command:day-one}%use the command defined above
\newmycommand{my-second-command}{Last command}%define another command inside the document
\usemycommand{my-second-command}%use this command
\end{document}
\@namedefand\@nameusedo exactly this – David Carlisle Jul 17 '14 at 12:12