I'm not sure exactly what terminology to use to ask this question.
What I want to do is define a command pluralize such that I can do this:
\newcommand{\individual}{individual\xspace}
\pluralize{\individual}
the \individual with the \individuals
and then get
the individual with the individuals
The reason I want to do this is because I might change terminology like:
\newcommand{\individual}{name\xspace}
\pluralize{\individual}
the \individual with the \individuals
and then get
the name with the names
Currently what I'm doing is explicitly writing out the plural version of each command like:
\newcommand{\individual}{individual\xspace}
\newcommand{\individuals}{\individual{}s\xspace}
But it seems like I should be able to turn this into a macro for simple pluralizations.
I have tried three things so far that do not work. First I tried what I thought may work:
\newcommand{\pluralize}[1]{\newcommand{\#1}{\#1{}s\xspace}
Then I looked online. I tried following the guidelines in Defining a newcommand, with variable name, inside another newcommand I came up with
\makeatletter
\newcommand{\pluralize}[1]{%
\expandafter\newcommand\csname #1s\endcsname{#1{}s\xspace}%
}
\makeatother
and
\makeatletter
\newcommand{\pluralize}[1]{%
\@namedef{#1s}{\\#1s\xspace}
}
\makeatother
\expandafter\newcommand\csname #1s\endcsname{#1{}s}%
but I either get a compile error, or an error if I use the macro. I'm not really sure what the @namedef, \expandafter, or \csname commands do either.
How can I correctly define the pluralize command?