ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A question about \define vs. \def
       [not found] <mailman.0.1271584801.24522.ntg-context@ntg.nl>
@ 2010-04-18 19:12 ` Vyatcheslav Yatskovsky
  2010-04-18 19:25   ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Vyatcheslav Yatskovsky @ 2010-04-18 19:12 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A question about \define vs. \def
  2010-04-18 19:12 ` A question about \define vs. \def Vyatcheslav Yatskovsky
@ 2010-04-18 19:25   ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2010-04-18 19:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-18 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.0.1271584801.24522.ntg-context@ntg.nl>
2010-04-18 19:12 ` A question about \define vs. \def Vyatcheslav Yatskovsky
2010-04-18 19:25   ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).