# Macro defining macro

I have the following:

\newcommand{\makeWord}[1]{%
\newcommand{\#1}{\textrm{#1}}}



Unfortunately, I did not properly define the makeWord macro. How do I fix this?

-

\newcommand{\makeWord}[1]{%
\newcommand{\#1}{\textrm{#1}}}


\#1 is the two tokens \# (which would typeset a #) and 1 so is a syntax error as the first argument of \newcommand.

Try

\newcommand{\makeWord}[1]{%
\expandafter\newcommand\csname#1\endcsname{\textrm{#1}}}


Note this will make a mathord token if used in math. If you want to make an operator like \log it needs to be

\newcommand{\makeWord}[1]{%
\expandafter\newcommand\csname#1\endcsname{\mathop{\mathrm{#1}}}}


or use the amsopn \DeclareMathOperator command.

-