2012-09-27 Sietse Brouwer <sbbrou...@gmail.com>:

Hi Sietse,

> As I understand it, \define[2] is preferred over \def#1#2 because it
> refuses to overwrite existing commands.

\define overwrites existing commands with pleasure. In contrast to
\def it prints a message to the log file: “\mycommand is already
defined”.

> Can I use \define, or a related command, to define a command that
> takes square-bracket arguments, like so:
> \mycommand[...][...]

\def\mycommand
  {\dodoubleempty\domycommand}

\def\domycommand [#1][#2]
  {first: #1, second: #2}

\mycommand [foo] [bar]
\mycommand [foo][bar]
\mycommand [foo]

Question for the others: What's the difference of \dodoubleargument
and \dodoubleempty? I expected \dodoubleargument to throw an error
since the arguments are supposed to be mandatory.


Marco

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

Reply via email to