From Wiki
< Command
Revision as of 16:22, 11 November 2019 by Usonianhorizon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Syntax (autogenerated)





\dodoublegroupempty is used to write commands that can take zero, one, or two arguments in braces: if the user specifies less than two arguments, it adds empty arguments at the end to make up the missing numbers.

So, \dodoublegroupempty\command leads to:

\command{#1}{#2} % or
\command{#1}{}   % or
\command{}{}     %    ,

depending on the generosity of the user. Afterwards one can use the \iffirstargument, \ifsecondargument, ... tests to determine how many arguments were actually passed.

There are variants of this command that will supply anywhere up to seven optional arguments:

  • \dosinglegroupempty
  • \dodoublegroupempty
  • \dotriplegroupempty
  • \doquadruplegroupempty
  • \doquintuplegroupempty


This is the standard pattern for writing a command that takes an optional number of arguments in braces:

% This command accepts two optional arguments

% This command looks at how many non-empty arguments 
% are supplied, and acts accordingly
       Ms. #2 (first name #1)%
       Ms. #1%
       No name supplied.%

\writename{Snow}{White} \par
\writename{White} \par

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: