I'm making my own document class. In this class, I want to print a page according to some information provided by the user of the class. This is very similar to the '\maketitle' command that retrieves information set by commands such as '\title' or '\author'.
Since there is a lot of information that can be set by the user of the class, I need to declare as much variables. To spare me the time of writing numerous times the necessary calls to '\def' and '\gdef' commands, I'm trying to write a new command that does it for me.
Here is what I came up with:
Code: Select all
\newcommand{\defvar}[2]{\def#1##1{\gdef#2{##1}}#1{}}
Code: Select all
\defvar{\name}{\getname}
Here is my question: is there a way to make it even shorter, like this:
Code: Select all
\defvar{name}
Any other solution that could give the same result is of course welcome.
Regards.