Search found 4 matches

by bumbolol
Wed Jan 25, 2012 12:50 pm
Forum: General
Topic: New Command to define a Variable
Replies: 5
Views: 5768

Re: New Command to define a Variable

Done.
by bumbolol
Wed Jan 25, 2012 11:49 am
Forum: General
Topic: New Command to define a Variable
Replies: 5
Views: 5768

New Command to define a Variable

Reply to myself: just use '\@nameuse' at the end of the newcommand. In the end, it looks like this:

Code: Select all

\newcommand\DefVar*[1]{\@namedef{#1}##1{\global\@namedef{get#1}{##1}}\@nameuse{#1}{}}
Problem solved, thanks again Clemens. Is there a need to put 'SOLVED' in the title of the thread now ?

Regards.
by bumbolol
Wed Jan 25, 2012 11:41 am
Forum: General
Topic: New Command to define a Variable
Replies: 5
Views: 5768

New Command to define a Variable

Thanks Clemens, that seems to be a better solution than mine. I have a tiny problem though. With my newcommand, setting a variable was optional. For example, if I don't use '\Haus' then '\getHaus' would just equals to '\empty' (which can be tested). With your newcommand, I get an 'Undefined control ...
by bumbolol
Tue Jan 24, 2012 4:28 pm
Forum: General
Topic: New Command to define a Variable
Replies: 5
Views: 5768

New Command to define a Variable

Hi,

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 ...