\newcommand{\iitthesis@thesisdatafield}[2]{%
\@namedef{iitthesis@#1}{#2}}
With
\iitthesis@thesisdatafield{authorEnglish}{Name of Author}
you'd define \iitthesis@authorEnglish
to expand to "Name of Author", that is, you'd have issued the equivalent of
\def\iitthesis@authorEnglish{Name of Author}
This wouldn't check for the defined command to be previously undefined. If you want also this check, do
\newcommand{\iitthesis@thesisdatafield}[2]{%
\expandafter\@ifdefinable\csname iitthesis@#1\endcsname
{\@namedef{iitthesis@#1}{#2}}}
but for internal commands this isn't usually done.
In your motivation I don't see any need of defining the new command with an argument. If you need also to define a user level command, you can do with the same technique:
\newcommand{\iitthesis@thesisdatafield}[1]{%
\long\@namedef{#1}##1{\@namedef{iitthesis@#1}{##1}}}
In this case saying
\iitthesis@thesisdatafield{authorEnglish}
would define the command \authorEnglish
so that if the user types
\authorEnglish{A. U. Thor}
the effect would be as if doing
\def\iitthesis@authorEnglish{A. U. Thor}
The \long
prefix to \@namedef
causes \long\def
to be executed, so the argument can span one or more paragraphs.
This technique is employed by the LaTeX kernel, where \author{A. U. Thor}
actually defines \@author
expanding eventually to "A. U. Thor".
Use four #
s in the second nesting level:
\documentclass{article}
\begin{document}
\newcommand{\one}[1]{%
\newcommand{\two}[1]{%
\newcommand{\three}[1]{#1, ##1, ####1}%
}
}
\one{a}
\two{b}
\three{c}
\end{document}
The following quote from TeX by Topic gives an explanation (further details in section 11.5.5 The macro parameter character):
When TEX’s input processor scans a macro definition text, it inserts a
parameter token for any occurrence of a macro parameter character
followed by a digit. In effect, a parameter token in the replacement
text states ‘insert parameter number such and such here’. Two
parameter characters in a row are replaced by a single one.
Best Answer
There are a number of ways to achieve this:
\deffunA
uses a pure TeX way of defining a macro, while\deffunB
is a LaTeX-related way of doing it.\deffunC
usesetoolbox
which provides a neat interface for defining macros. See section 3.1.1 Macro Definitions of the documentation. In fact,\csdef
uses the LaTeX-defined\@namedef
... yet another way of achieving what you're after.