ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: Re: missing space after \date[] (was: printing the current date)
Date: Sat, 13 Mar 2021 10:08:39 +0100	[thread overview]
Message-ID: <f6e84641-e1fb-7b73-ab38-82b831aec560@xs4all.nl> (raw)
In-Reply-To: <87ft10t1cd.fsf_-_@a16n.net>

On 3/13/2021 12:10 AM, Peter Münster wrote:
> On Wed, Jan 27 2021, Wolfgang Schuster wrote:
> 
>> When not all optional arguments are used the space after the last
>> given argument is gobbled. This was normal behavior for a long time
>> until you changed the code in MkIV to keep them.
> 
> Hi,
> 
> What does that mean? Is that going to be changed?
> How should \date[] be used now in the text?
> For now, I do it like "bla \date[d=3]\ bla".
> Is there a nicer way?
> 
> TIA for any hints,
The problem with an interface with optional arguments is that it has to 
look ahead. There are actually some macros that use this feature to get 
rid of upcoming spaces (picking up two optional arguments where one is 
needed). So, no matter what solution is chosen: push back a space or 
not, it has some unpredictable character.

This is why I always am explicit, as in \date[d=3]\ bla because no 
matter what happens bvehind the screens, the \ terminates the argument 
check so it will stay. (I admit that i'm mnore often bitten by the 
pushed back one than the gobbled one so i make it a habit to be explicit 
about spaces, like like i use \removeunwantedspaces when i'm not sure
when there can be spaces that crept in).

We can of course in lmtx bring back the 'push back a space' behaviour 
but we then also introduce some fuzzyness. Now we have "we scan upto n 
arguments and gobble spaces when doing so".

Btw, there is also another aspect: when looking for optional arguments 
the next token gets looked at and that one can be in an upcoming macro 
or content.

\startfoo[a][b]
    content
\stopfoo

\startfoo[a]
    [ that starts content
\stopfoo

so sometimes one needs

\startfoo[a]
    \relax [ that starts content
\stopfoo

to abort the scanning.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2021-03-13  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 18:23 printing the current date Peter Münster
2021-01-10 18:25 ` Fabrice L
2021-01-10 19:26   ` Peter Münster
2021-01-27 17:28 ` Peter Münster
2021-01-27 21:31   ` Hans Hagen
2021-01-27 22:48     ` Wolfgang Schuster
2021-03-12 23:10       ` missing space after \date[] (was: printing the current date) Peter Münster
2021-03-13  9:08         ` Hans Hagen [this message]

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=f6e84641-e1fb-7b73-ab38-82b831aec560@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --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).