Command/dodoubleempty
Jump to navigation
Jump to search
\dodoubleempty
Syntax
\dodoubleempty\commmand |
Description
\dodoubleempty is used to write commands that can take zero, one, or two square-bracketed arguments: if the user specifies less than two arguments, it adds empty arguments at the end to make up the missing numbers.
So, \dodoubleempty\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:
- \dosingleempty
- \dodoubleempty
- \dotripleempty
- \doquadrupleempty
- \doquintupleempty
- \dosixtupleempty
- \doseventupleempty
Example
This is the standard pattern for writing a command that takes an optional number of arguments:
See also
- Commands with optional arguments
- syst-aux.mkiv
- \dodoublegroupempty to supply optional arguments in braces
Help from ConTeXt-Mailinglist/Forum
All issues with: