Hi,
I'm new to the forum and I hope I'm posting it in the right place.
I'm looking for a way to define a general command that will generate other macros. For example create a command called
"\newAnimal" that receives 2 arguments name and description and for the following input "\newAnimal{CAT}{9 souls animal}" generates the following macros \animalCAT which writes "CAT" in blue and \descriptionCAT writes "9 souls animal"
Thanks
Gaby
General ⇒ custom macros
NEW: TikZ book now 40% off at Amazon.com for a short time.

custom macros
That's possible with \csname. The etoolbox package provides a simple wrapper for some of these tasks:
Code: Select all
\usepackage{etoolbox}
\newrobustcmd*{\newAnimal}[2]{%
\csdef{animal#1}{\textcolor{blue}{#1}}%
\csdef{description#1}{#2}%
}