To answer our updates question:
What is the difference between the two following lines?
\def\myname#1{\gdef\@myname{#1}}
\newcommand*{\myname}[1]{\gdef\my@myname{#1}}
See, \def is a TeX primitive, i.e. a macro which isn't defined using other macros but which executes a certain pre-defined, hard-coded function (however the names of the primitives can be redefined to user macros). Here \def sets the definition of \myname to \gdef\@myname{#1}. A primitive is to a macro like an axiom to a proof. Proofs depend on other proofs with depend on other proofs which finaly depend on a few axioms. It's the same with macros, they are defined as other macros (actually as other tokens) which can be defined again as other macros, which then finally end in primitives.
While TeX gives your access to the lower level, LaTeX gives you a neat user-interface. One drawback of \def is that it simply sets the definition of the macro, i.e. it defines or redefines it without checking if it was already defined before. If all or most LaTeX macros were defined using \def, packages could overwrite macros of other packages without warning which would leads pretty fast to a mess. Debugging such a scenario would be very difficult.
Therefore LaTeX gives you \newcommand which checks if the macro was already defined and triggers an error if so. It also allows you to simply give you the number of arguments as number (e.g. [3]), instead of writing e.g. #1#2#3. After all the checks (there are a few more) it uses \def internally to finally define the macro.
So, \newcommand is safer but slower (not that it matters much), while \def gives you the additional benefit of defining a parameter list. You can for example say:
\def\mymacro(#1,#2){...}
to define a macro which awaits (<something>,<something more>) and gives you this two values as #1 and #2. If the patterns doesn't match an error is triggered. The optional arguments [ ] are implemented very similar. More complex syntax like the one used in TikZ would not be possible if all macros would be defined using \newcommand.
\mynameis a user macro but\my@nameis an internal macro. I am not sure what you mean, when you ask "are they equivalent"? equivalent in what sense? Also this is already answered on parsilatex and there is no point in repeating questions. – IRAN Feb 14 '11 at 18:23\@mynamelooks like a command defined in LaTeX kernel, while\my@mynameis likely about the prefixmy. – Leo Liu Feb 14 '11 at 18:43