[NTG-context] A question about \define vs. \def

2010-04-18 Thread Vyatcheslav Yatskovsky

Hello,

Patrick posed a good question on wiki at

http://wiki.contextgarden.net/Reference/en/define

is there any bonus when I use \define instead of \def?

Regards,
Vyatcheslav
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] A question about \define vs. \def

2010-04-18 Thread Wolfgang Schuster

Am 18.04.10 21:12, schrieb Vyatcheslav Yatskovsky:

Hello,

Patrick posed a good question on wiki at

http://wiki.contextgarden.net/Reference/en/define

is there any bonus when I use \define instead of \def?

1. \define checks if the command you try to create already exists,
   if this is the case no new command is created but you get a message
   on the terminal

2. you can give the number of arguments as a number (e.g. \define[2]\...{})
   while \def expects them with the hash (e.g. \def\...#1#2{...})

3. depending on your style you can avoid one '%' at the end of the first 
line


   \def\...#1#2%
 {...}

   vs.

   \define[2]\...
 {...}

4. a disadvantage is that you can't create commands with optional arguments,
   Hans showed a different which made this possible in mkiv but it made it
   in the official version of \define

5. the wiki page mentions you can create \long macros with \define but
   this isn't the case in mkiv because each macro is no \long

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___