Apologized for my unclear description. I wish I could explain my problem more clearly.
In document, I wish I can just write something as
"how to use \cmd \mbox in xxx" or "what is \cmd minipage xxx".
The string with/without \ is the argument of \cmd. \cmd reads
token until meeting space or .,; (any char except a-zA-Z)
Following \def taking next word as argument? I can try to do this.
Next, in the definition of \cmd, I wish there's a variable to store the string (without \), that is, \def\cmd#1{\def\A{} xxx}, then \A would store {mbox} (without \) or {minipage}. So I can use \A in index/toc/ etc.
I'm trying to write a manual of some commands of LaTeX (in Chinese). So, it's more easily to maintain the code by this way. (I use \verb and others to do this. But it becomes more and more difficult to maintain the code now).
So, I hope I can just type
"even though you specify \cmd \pagestyle to force an empty xxx"
rather than "even though you specify \bscmd{mbox} to force xxx"
(\bs for backslash) and "even though you specify \cmd{minipage} to
force xxx" (\cmd for normal none-backslash)
Then, because of index/hyperref/footnote/etc, so I need something stores \mbox or minipage.

Thanks again!
– Kuang-Li Huang Mar 04 '11 at 06:30\cmd{\raisebox},\cmdnameisraisebox, not\raisebox, so changing\index{\cmdname}into\index{\cmdname @\textbackslash\cmdname}should do what you want (if I understood correctly). – Philippe Goutet Mar 04 '11 at 12:39docpackage does. Perhaps you could check its code to see how it deals with the problem. – Andrey Vihrov Mar 05 '11 at 08:54\cmdname, all the@into"@. The most user-friendly way of doing this is probably using the xstring package. – Philippe Goutet Mar 05 '11 at 10:08