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: Characters allowed in macro names
Date: Sun, 22 Apr 2018 18:04:28 +0200	[thread overview]
Message-ID: <96243afc-07ec-d4eb-bcf4-2bb4bc6de79f@xs4all.nl> (raw)
In-Reply-To: <87r2n7e03v.fsf@gmail.com>

On 4/22/2018 5:23 PM, N. Raghavendra wrote:
> I was wondering if it is alright to use underscores in the names of
> macros, e.g, as in the following file.  It looks like \startsetups, and
> \def accept names with hyphens, underscores, and numerals, but
> \starttexdefinition doesn't tolerate any of them.
> 
> 1. In general, what characters are allowed in macro names?  Are Unicode
>     characters admissible?

letters are (and _ is not a letter, unless we're in unprotected mode)

> 2. Apart from the fact that one can use whitespace freely in
>     \starttexdefinition, is there any reason to prefer it over \def?

depends ... sometimes more readble ... spaces are ignores ... you can 
use named parameters

> Thanks,
> Raghu.
> 
> ------------------------------------------------------------
> \starttext
> 
> \startsetups [hello-world_1]
>    Hello, world 1!
> \stopsetups
> 
> \setups [hello-world_1]
> 
> \def\hello-world_2{Hello, world 2!}
> 
> \hello-world_2
> 
> \starttexdefinition helloWorld
>    Hello, world!
> \stoptexdefinition
> 
> \helloWorld
> 
> %% Doesn't work
> %% \starttexdefinition fooBar1
> %%   Foo, bar 1!
> %% \stoptexdefinition
> %%
> %% \fooBar1
> 
> %% Doesn't work
> %% \starttexdefinition foo_bar
> %%   Foo, bar!
> %% \stoptexdefinition
> %%
> %% \foo_bar
> 
> %% Doesn't work
> %% \starttexdefinition foo-bar
> %%   Foo, bar!
> %% \stoptexdefinition
> %%
> %% \foo-bar
> 
> \stoptext
> ------------------------------------------------------------
> --
> N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
> Harish-Chandra Research Institute, http://www.hri.res.in/
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           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:[~2018-04-22 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 15:23 N. Raghavendra
2018-04-22 16:04 ` Hans Hagen [this message]
2018-04-22 18:19   ` N. Raghavendra
2018-04-22 18:08 ` Wolfgang Schuster
2018-04-22 18:22   ` N. Raghavendra

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=96243afc-07ec-d4eb-bcf4-2bb4bc6de79f@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).