Aditya Mahajan wrote:
On Sun, 27 May 2007, Elliot Clifton wrote:
Hi Peter,
Thanks for your reply. I think I may have misunderstood the variable section on the wiki. I been using \setvariable to both declare and assign variables from my component files. When I should have been declaring them in the environment file first, right? \setvariable[namespace][key=DefaultValue], right? So how do I test for a (Default)Value? Sorry, I'm just beginning TeX programming I don't understand how to do this.
Elliot,
You can use \doif{\getvalue{set}{var}}{value} for simple string comparisons. See http://wiki.contextgarden.net/System_Macros for basic flow control features of ConTeXt.
It may also be possble to see if variables have changed using setups http://wiki.contextgarden.net/Inside_ConTeXt#Using_setups_for_namespaces but I have never personally used that.
these test if the variable has been set (defined test): \doifelsevariable#1#2 \doifvariable#1#2 \doifnotvariable#1#2 (is not the same as test for empty) there is also: \getvariabledefault#1#2#3 with #3 being a default value for when undefined Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------