Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Christoph Reller
On Thu, 24 May 2018 14:50:36 +0200, Hans Hagen wrote: > On 5/24/2018 11:21 AM, Christoph Reller wrote: >> On Wed, 23 May 2018 16:01:05 +0200, Hans Hagen wrote: >>> On 5/23/2018 3:39 PM, Christoph Reller wrote: What is the right way to define a

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Alan Braslau
On Thu, 24 May 2018 11:24:34 +0200 Christoph Reller wrote: > Thank you Hraban for pointing me to the wiki. I was aware of this page > but it contains only the case of mandatory arguments in curly braces > {} not in brackets []. One must *not* confuse with the LaTeX

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Taco Hoekwater
Hi, > Arguments in brackets are always optional (if I don’t misunderstand), > depending on your own logic (\if*argument, \ifempty etc.) The original intent was for user-level commands to have square brackets for arguments setting things up, and curly braces for arguments that are actually

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Henning Hraban Ramm
Am 2018-05-24 um 11:24 schrieb Christoph Reller : > On Wed, 23 May 2018 17:54:39 +0200, Henning Hraban Ramm > wrote: What is the right way to define a command with both mandatory and optional arguments, e.g: >>> i'm not sure wht happens at

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Hans Hagen
On 5/24/2018 11:21 AM, Christoph Reller wrote: On Wed, 23 May 2018 16:01:05 +0200, Hans Hagen wrote: On 5/23/2018 3:39 PM, Christoph Reller wrote: Hi, What is the right way to define a command with both mandatory and optional arguments, e.g:

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Christoph Reller
On Wed, 23 May 2018 17:54:39 +0200, Henning Hraban Ramm <te...@fiee.net> wrote: > Date: Wed, 23 May 2018 17:54:39 +0200 > From: Henning Hraban Ramm <te...@fiee.net> > To: mailing list for ConTeXt users <ntg-context@ntg.nl> > Subject: Re: [NTG-context]

[NTG-context] Defining command with optional and mandatory arguments

2018-05-24 Thread Christoph Reller
On Wed, 23 May 2018 16:01:05 +0200, Hans Hagen wrote: > > On 5/23/2018 3:39 PM, Christoph Reller wrote: >> Hi, >> >> What is the right way to define a command with both mandatory and >> optional arguments, e.g: >> >> \MyCommand[optional][mandatory] >> >> Consider the following

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-23 Thread Henning Hraban Ramm
Am 2018-05-23 um 16:01 schrieb Hans Hagen : > On 5/23/2018 3:39 PM, Christoph Reller wrote: >> Hi, >> What is the right way to define a command with both mandatory and >> optional arguments, e.g: > i'm not sure wht happens at your end but this is the best way: Also, there’s

Re: [NTG-context] Defining command with optional and mandatory arguments

2018-05-23 Thread Hans Hagen
On 5/23/2018 3:39 PM, Christoph Reller wrote: Hi, What is the right way to define a command with both mandatory and optional arguments, e.g: \MyCommand[optional][mandatory] Consider the following MWE: \unexpanded\def\MyCommand[#1]{ \dosingleempty{\doMyCommand[#1]}}

[NTG-context] Defining command with optional and mandatory arguments

2018-05-23 Thread Christoph Reller
Hi, What is the right way to define a command with both mandatory and optional arguments, e.g: \MyCommand[optional][mandatory] Consider the following MWE: \unexpanded\def\MyCommand[#1]{ \dosingleempty{\doMyCommand[#1]}} \def\doMyCommand[#1][#2]{ \doifsomething{#1}{number 1: #1\par}