ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau <braslau.list@comcast.net>
To: Christoph Reller <christoph.reller@gmail.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Defining command with optional and mandatory arguments
Date: Thu, 24 May 2018 10:07:19 -0600	[thread overview]
Message-ID: <20180524100719.43e267a8@poo.hsd1.co.comcast.net> (raw)
In-Reply-To: <CAO8LnPFAOohZp3-ZLGDSRhrPQYtC1=OwC9S613jK1sV=G1Cqiw@mail.gmail.com>

On Thu, 24 May 2018 11:24:34 +0200
Christoph Reller <christoph.reller@gmail.com> 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 convention where "mandatory"
arguments are contained in curly braces and brackets indicate
"optional" arguments.

As Taco states below, curly braces not only give grouping but generally
are used for objects to be typeset, as for \in{Figure}{a} [fig:ref].

For new users, it is worth repeating here that arguments within braces
can be either a comma-separated list of words OR a comma-separated
list of keyword=value pairs, BUT NOT A MIXTURE OF BOTH. Generally, a
keyword=value exists for all words, for example \cite[authoryear][ref]
and \cite[alternative=authoryear,reference=ref]

values can be grouped using curly braces, as in
\cite[alternative=authoryear,lefttext={{see },}][ref1,ref2] where the
lefttext is associated with the first cite reference (and none with the
second). This can be tricky but is in fact rather straight-forward.

Alan

P.S. The wiki is only as good as users make it; some pages have not
been changed since mkii...


On Thu, 24 May 2018 15:43:27 +0200
Taco Hoekwater <taco@elvenkind.com> wrote:

> 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 typeset. That is where commands like \in
> come from, where the braced part is optional and the bracketed part
> required.

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2018-05-24 16:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  9:24 Christoph Reller
2018-05-24 13:17 ` Henning Hraban Ramm
2018-05-24 13:43   ` Taco Hoekwater
2018-05-24 16:07 ` Alan Braslau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-25  5:08 Christoph Reller
2018-05-24  9:21 Christoph Reller
2018-05-24 12:50 ` Hans Hagen
2018-05-23 13:39 Christoph Reller
2018-05-23 14:01 ` Hans Hagen
2018-05-23 15:54   ` Henning Hraban Ramm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180524100719.43e267a8@poo.hsd1.co.comcast.net \
    --to=braslau.list@comcast.net \
    --cc=christoph.reller@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).