Re: [NTG-context] How to extend an existing macro to take optional parameters?

2023-03-14 Thread Bruce Horrocks via ntg-context


> On 14 Mar 2023, at 02:08, Alan Braslau via ntg-context  
> wrote:
> 
> Designating "optional" parameters within [...] is a LaTeX notion.
> ConTeXt handles parameters differently.
> 
> Alan

Thanks Alan but I've never used LaTeX so I've no idea what the philosophical 
differences are.

I wanted three mandatory and two optional params. One of those optional params 
is not typeset so I assumed it should be [ ] delimited and not { }.

> 
>>> and I'd like to be able to extend it so that any of the following
>>> can be used:
>>> 
>>>   \mycommand{aa}{bb}{cc}
>>>   \mycommand{aa}{bb}{cc}{dd}
>>>   \mycommand{aa}{bb}{cc}{dd}[ee]
>>> 
>>> or
>>> 
>>>   \mycommand[ee]{aa}{bb}{cc}{dd}  % if this is more the ConTeXt way
>>> 
>>> where {dd} is the optional extra parameter and, if it is present,
>>> then [ee] can also be optionally added (because it controls how
>>> {dd} is printed).

—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] How to extend an existing macro to take optional parameters?

2023-03-14 Thread Bruce Horrocks via ntg-context


> On 13 Mar 2023, at 21:39, Hans Hagen via ntg-context  
> wrote:
> 
> On 3/12/2023 2:24 PM, Bruce Horrocks via ntg-context wrote:
>> I have an existing macro that I'd like to extend.
>> The current definition is \define[3]\mycommand{...} which I'd like to extend 
>> to take an optional 4th parameter plus an optional setup parameter.
>> Thus I currently invoke it as:
>>   \mycommand{aa}{bb}{cc}
>> and I'd like to be able to extend it so that any of the following can be 
>> used:
>>   \mycommand{aa}{bb}{cc}
>>   \mycommand{aa}{bb}{cc}{dd}
>>   \mycommand{aa}{bb}{cc}{dd}[ee]
>> or
>>   \mycommand[ee]{aa}{bb}{cc}{dd}  % if this is more the ConTeXt way
>> where {dd} is the optional extra parameter and, if it is present, then [ee] 
>> can also be optionally added (because it controls how {dd} is printed).
>> If it helps, the actual body of the macro can easily be a call to Lua so 
>> it's fine if the function takes 5 params where 4 and 5 can be nil or empty 
>> strings.
>> I've trawled through syst-aux.mkiv but it only covers optional numbers of [ 
>> ] or { } but not combinations of both (which given the vast numbers of 
>> combinations is perhaps not surprising!). Have I missed something obvious 
>> that would help me?
> So, four optional with mandate {} plus a fallback to an optional []
> 
> \starttext
> 
> \tolerant\def\mycommand#=#=#=#=#:[#5]%
>  {\ifparameter#1\or(1:#1)\fi
>   \ifparameter#2\or(2:#2)\fi
>   \ifparameter#3\or(3:#3)\fi
>   \ifparameter#4\or(4:#4)\fi
>   \ifparameter#5\or[5:#5]\fi}
> 
> \startbuffer
> \mycommand{aa}{bb}{cc}
>  \mycommand{aa}{bb}{cc}{dd}
>  \mycommand{aa}{bb}{cc}{dd}[ee]
> \mycommand{aa}{bb}{cc}
>  \mycommand{aa}{bb}{cc}{dd}
>  \mycommand{aa}{bb}{cc}{dd}[ee]
> \stopbuffer
> 
> \typebuffer
> 
> \startlines \getbuffer \stoplines
> 
> \stoptext
> 
> I'm not saying that it's the best solution, you can add \protected in front 
> of the \def if needed.
> 
> Hans

Thanks Hans,

This works well. I'll try and add something to the Wiki but I don't understand 
how #: does what it does.

Regards,
—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 3:32 PM, Hans Hagen via ntg-context  
wrote:
> On 3/14/2023 7:14 PM, Alan Braslau via ntg-context wrote:
>> On Tue, 14 Mar 2023 12:03:23 -0600
>> Gavin  wrote:
>>> I’d really like one of the acceptable forms to be the form prescribed
>>> by Le Système international d'unités
> 
> Maybe the french title is one of the reasons for the USA not picking up on 
> these units? (So let me threaten once again to kick the "in" unit out of 
> context.)
> 
>> I believe that this point is essential,….

Alan and I will come up with a scheme that fastidiously follows the SI, and 
release it as a “North American localization.” That should leave everyone 
sufficiently puzzled, annoyed, or amused.

Signing off of this subject until 27 May. Thanks for all your help!

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 7:14 PM, Alan Braslau via ntg-context wrote:

On Tue, 14 Mar 2023 12:03:23 -0600
Gavin  wrote:


I’d really like one of the acceptable forms to be the form prescribed
by Le Système international d'unités


Maybe the french title is one of the reasons for the USA not picking up 
on these units? (So let me threaten once again to kick the "in" unit out 
of context.)



I believe that this point is essential, regardless of history of use of
the \unit{} command. Non-standard use of units can be *tolerated* as
long as they do not conflict with the SI and do not impose non-standard
syntax.

Alan

P.S. It is our guarded secret that the weather is nice here in
Colorado. I do not know of any other place that has real seasons AND
where it is (almost) always sunny! :-)
Here it fluctuates from zero to 15 (and behind the single pane glass in 
the office room with sun on it then 18 or more). Now of course, given 
units, you have to guess how much that is becuase you're with your 
French foot in Celsius, and the English one in Farhenheit and with both 
feet in Kelvin (for your book).


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 7:03 PM, Gavin via ntg-context wrote:


I’d like to better understand how the \unit{} command works and why those 
choices were made. Some of the choices seem to be “asking for troubles,” but 
perhaps they are essential for some users.


I wonder if Alan was using context when the first unit module showed up 
in (what wasn't even call;ed mkii) because it is one of the oldest 
context modules and we use(d) for typesetting education related 
documents. Among the reasons for it was that in the pre-unicode times 
one had to compromise on a math / text mixture due to the way fonts and 
input was handled.



I’m happy to have the unit command accept a variety of different forms for the 
unit, but I’d really like one of the acceptable forms to be the form prescribed 
by Le Système international d'unités, so that “m s” is a meter second and “ms” 
is a millisecond. However, I’m not sure if this goal conflicts with other 
important goals.

Would you like to explore \unit{} this summer to see if we can find a 
consistent solution? Perhaps we can produce a plan for \unit{} that does not 
conflict with other \unit{} features, or perhaps we can make a module that 
lacks some of the features of \unit{} but conforms to the SI for input as well 
as output. I would be happy with either.


In principle one can think of different schemes (for different purposes 
even), after all everything is in tables; that is probably easier than 
tring to come up with some complex compromise. There can be instances of 
unit with different properties.


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Alan Braslau via ntg-context
On Tue, 14 Mar 2023 12:03:23 -0600
Gavin  wrote:

> I’d really like one of the acceptable forms to be the form prescribed
> by Le Système international d'unités

I believe that this point is essential, regardless of history of use of
the \unit{} command. Non-standard use of units can be *tolerated* as
long as they do not conflict with the SI and do not impose non-standard
syntax.

Alan

P.S. It is our guarded secret that the weather is nice here in
Colorado. I do not know of any other place that has real seasons AND
where it is (almost) always sunny! :-)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 10:08 AM, Alan Braslau via ntg-context  
wrote:
> Right now, \unit{1 mm-1} and \unit{1 m m-1} give the same result:
> inverse millimeters (whereas the second should be m•m^{-1}…)
> 
> Alan

Alan,

I’d like to better understand how the \unit{} command works and why those 
choices were made. Some of the choices seem to be “asking for troubles,” but 
perhaps they are essential for some users.

I’m happy to have the unit command accept a variety of different forms for the 
unit, but I’d really like one of the acceptable forms to be the form prescribed 
by Le Système international d'unités, so that “m s” is a meter second and “ms” 
is a millisecond. However, I’m not sure if this goal conflicts with other 
important goals.

Would you like to explore \unit{} this summer to see if we can find a 
consistent solution? Perhaps we can produce a plan for \unit{} that does not 
conflict with other \unit{} features, or perhaps we can make a module that 
lacks some of the features of \unit{} but conforms to the SI for input as well 
as output. I would be happy with either.

I’d also like to work on the luagraph module this summer. I’m getting a lot 
better at MetaPost programming!

I can’t approach either issue in a comprehensive way until the summer, because 
I have a lot of content to produce for our physics class. This year we kept on 
schedule – for the first time ever! – and that means we will be studying a 
couple of topics that I haven’t prepared yet. 

Obviously, anyone else interested in \unit{} or luagraph would be welcome to 
join us, either remotely or here in sunny Fort Collins, Colorado. (School ends 
here on May 26.)

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 5:33 PM, Gavin via ntg-context wrote:


Hi Alan, Hans, and List,


On Mar 13, 2023, at 8:10 PM, Alan Braslau via ntg-context  
wrote:
On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context  
wrote:

you can look at phys-dim and see plenty of short and long keys and
making all case insensitive is asking for troubles


Indeed, I would like to make NONE of them case insensitive. But
currently, when I register an upper case key (C=coulomb) it messes up
the lower case prefix (“cm" gets typeset as C•m). I was expecting the
parser to distinguish between the “C” and “c”, but it doesn’t. Is
that intended?


Indeed, \unit{} should allow (and presently does not) K, C, etc.


I agree. I added the following lines to phys-dim.lua, following line 461

 C  = "coulomb",
 K  = "kelvin",
 N  = "newton",

This provided the desired capital shortcuts without compromising the lowercase 
prefixes. Hans, could we get those added to phys-dim.lua in the distribution? I 
would be happy to do a more comprehensive search for shortcuts to add, but 
those are the three I and my collaborators are using now.


maybe, when there are no conflicts


Looking at why my \registerunit attempt failed, I found that when you register 
a unit, both your capitalization, and an all lowercase version are registered. 
Here is an example, where I register “ReTeM” but \unit{1 retem} also works.

\starttext

\registerunit[unit][ReTeM=myunit]
\setupunittext[myunit=reTeM]

\startformula
   \unit{1 ReTeM} = \unit{1 retem} \neq \unit{1 reteM}
\stopformula

\stoptext

The results are case sensitive, so \unit{1 reteM} does not work. The lowercase 
version is produced for all “long” units, but not for shortcuts. (See phys-dim.lua, 
lines 766-771 where the Lua string function “lower” is used.) Perhaps we could use a 
\registershortcut command that does not get the “lower" treatment. I will look 
into it some more.


see previous mail, i already added that but no upload yet


P.S. I think there is a spelling error in phys-dim.lua, lines 974-981.

local mapping = {
 prefix   = "prefixes",
 unit = "units",
 operator = "operators",
 suffixe  = "suffixes",
 symbol   = "symbols",
 packaged = "packaged",
}

The key “suffixe” should probably be “suffix”.

indeed, i noticed that when extending

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] natural table oddities

2023-03-14 Thread Henning Hraban Ramm via ntg-context
Working on the documentation for “natural tables” I stumbled upon a few 
oddities/problems.
I’d like to know if there are misunderstandings on my part or if the 
behavior is intentional.


BTW enattab.pdf is missing in the LMTX distribution.

## Options

* before/after/inbetween values don’t appear anywhere.
* spaceinbetween should insert between rows, but nothing happens.
* splitoffset doesn’t seem to change anything.
* What’s samepage for?


## Addressing cells

* It’s not possible to address single cells with \setupTABLE, or is it?

* There’s \setupTABLE[header], but not "footer" (or "section"); since we 
have TABLEhead and TABLEfoot, IMO "head" and "foot" would make sense.


* Row 1 is the first row of TABLEbody. I couldn’t find how to address 
the first line of TABLEbody.


* Is it possible, and how, to use odd/even only for the body?

* If I format a column, e.g. \setupTABLE[c][-1][color=red], body and 
foot are formatted, but not the same column in header. (I found out, if 
I use TD instead of TH in the header, it works.)


* I don’t understand the addressing options "start" and "one".


## Formatting

* maxwidth doesn’t seem to have an effect, neither on the whole table 
nor on a column.

* textwidth works only for the whole table.
* width gets stretched if option=stretch; i.e. you can’t fix the width 
of single cells or columns.



## Page breaking

* What’s the difference between [split=repeat] and 
[split=yes,header=repeat], i.e. which sense makes the header option)?


* Is there an option to repeat the footer (as the last line of each 
page)? (I’d imagine to use it in an invoice or similar calculation for a 
subtotal – that would imply some more magic…)



Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
I wrote 

> Perhaps we could use a \registershortcut command that does not get the 
> “lower" treatment.

without seeing that Hans had already read my mind and provided:

\registerunitshortcut
[unit]
[C=coulomb]

That should work great.

Thanks!
Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context

Hi Alan, Hans, and List,

> On Mar 13, 2023, at 8:10 PM, Alan Braslau via ntg-context 
>  wrote:
> On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context  
> wrote:
>>> you can look at phys-dim and see plenty of short and long keys and
>>> making all case insensitive is asking for troubles  
>> 
>> Indeed, I would like to make NONE of them case insensitive. But
>> currently, when I register an upper case key (C=coulomb) it messes up
>> the lower case prefix (“cm" gets typeset as C•m). I was expecting the
>> parser to distinguish between the “C” and “c”, but it doesn’t. Is
>> that intended?
> 
> Indeed, \unit{} should allow (and presently does not) K, C, etc.

I agree. I added the following lines to phys-dim.lua, following line 461

C  = "coulomb",
K  = "kelvin",
N  = "newton",

This provided the desired capital shortcuts without compromising the lowercase 
prefixes. Hans, could we get those added to phys-dim.lua in the distribution? I 
would be happy to do a more comprehensive search for shortcuts to add, but 
those are the three I and my collaborators are using now.

Looking at why my \registerunit attempt failed, I found that when you register 
a unit, both your capitalization, and an all lowercase version are registered. 
Here is an example, where I register “ReTeM” but \unit{1 retem} also works.

\starttext

\registerunit[unit][ReTeM=myunit]
\setupunittext[myunit=reTeM]

\startformula
  \unit{1 ReTeM} = \unit{1 retem} \neq \unit{1 reteM}
\stopformula

\stoptext

The results are case sensitive, so \unit{1 reteM} does not work. The lowercase 
version is produced for all “long” units, but not for shortcuts. (See 
phys-dim.lua, lines 766-771 where the Lua string function “lower” is used.) 
Perhaps we could use a \registershortcut command that does not get the “lower" 
treatment. I will look into it some more.

Thanks!
Gavin


P.S. I think there is a spelling error in phys-dim.lua, lines 974-981.

local mapping = {
prefix   = "prefixes",
unit = "units",
operator = "operators",
suffixe  = "suffixes",
symbol   = "symbols",
packaged = "packaged",
}

The key “suffixe” should probably be “suffix”.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Alan Braslau via ntg-context
On Tue, 14 Mar 2023 15:36:37 +0100
Hans Hagen via ntg-context  wrote:

> > Indeed, I would like to make NONE of them case insensitive. But
> > currently, when I register an upper case key (C=coulomb) it messes
> > up the lower case prefix (“cm" gets typeset as C•m). I was
> > expecting the parser to distinguish between the “C” and “c”, but it
> > doesn’t. Is that intended?  
> I added an option and an extra registers but it's up to you to decide 
> hwo to use it (and how to deal with conflicts in definitions).

There should not be conflicts, for, formally,
c should be 1/100
C should be Coulomb

k should be 1000
K should be Kelvin

n should be 10^{-9}
N should be Newton

m should be meter
M should be 10^6
(but m also means 10^{-3})

etc.

The problems arise as \unit{} presently accepts

Kelvin and kelvin
Newton and newton
Coulomb and coulomb
Watt and watt
etc.

also, mm could be millimeters, or it could be m•m (m^2).

Right now, \unit{1 mm-1} and \unit{1 m m-1} give the same result:
inverse millimeters (whereas the second should be m•m^{-1}, also known
as radians! ;-)

I suggest that it be limited to formal (and well-defined) unit names,
respecting casing.

I also suggest that unrecognized units either give an error message in
stdout and in the log file and show up in the output (as {\tt } to
be coherent with other subsystems), rather than to be simply ignored.

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] extra lines in PDF annotations

2023-03-14 Thread Pablo Rodriguez via ntg-context
On 3/13/23 22:32, Hans Hagen via ntg-context wrote:
>> [...]
>> I hope EOLs are fine now.
> dunno ... no full example so ...
Sorry, Hans, the full example reads:

  \startbuffer[text]
  
  
  
  \stopbuffer

  \savebuffer[text][sample-text.xml, prefix=no]

  \setupinteraction[state=start]

  \startxmlsetups xml:text
\xmlsetsetup{\xmldocument}
  {pre}
  {xml:copy:html}
  \stopxmlsetups

  \xmlregistersetup{xml:text}

  \startxmlsetups xml:copy:html
\xmltobuffer{#1}{.}{text}
\comment[location=inmargin,buffer=text]{}
  \stopxmlsetups

  \setuppapersize[A9]

  \starttext
\section{one\xmlprocessbuffer{main}{text}{}}

\section{two\xmlprocessfile{main}{sample-text.xml}{}}
  \stoptext

It requires that the source is saved with CRLF line endings (so that
\savebuffer will save that way too), otherwise both \comment will be
exactly the same.

I hope it is clearer now.

Many thanks for your help,

Pablo

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/13/2023 10:55 PM, Gavin wrote:




On Mar 13, 2023, at 3:44 PM, Hans Hagen via ntg-context  
wrote:

On 3/9/2023 2:04 PM, Gavin via ntg-context wrote:

\startformula
   \unit{3 meter} \qquad
   \unit{6 Meter} \qquad
   \unit{3 mEtEr} \qquad
\stopformula
Units with lowercase prefixes (c, k, n).
\startformula
   \unit{3cm} \qquad
   \unit{6kg} \qquad
   \unit{3ns} \qquad
\stopformula
Units with capital letters, called with names (coulomb, kelvin, newton).
\startformula
   \unit{3 coulomb} \qquad
   \unit{6 kelvin} \qquad
   \unit{3 newton} \qquad
\stopformula


you can look at phys-dim and see plenty of short and long keys and making all 
case insensitive is asking for troubles


Indeed, I would like to make NONE of them case insensitive. But currently, when I 
register an upper case key (C=coulomb) it messes up the lower case prefix (“cm" 
gets typeset as C•m). I was expecting the parser to distinguish between the “C” and 
“c”, but it doesn’t. Is that intended?
I added an option and an extra registers but it's up to you to decide 
hwo to use it (and how to deal with conflicts in definitions).


\registerunit
  [unit]
  [Point=PT,
   point=pt,
   Basepoint=BP,
 % basepoint=bp,
   ]

\registerunitshortcut
  [unit]
  [C=coulomb]

\startlines
10 \unit {square meter per second}
10 \unit {square Meter per Second}
10 \unit {point}
10 \unit {Point}
10 \unit {basepoint}
10 \unit {Basepoint}
10 \unit {C}
\stoplines

\setupunit[unit][option=keep]

\startlines
10 \unit {square meter per second}
10 \unit {square Meter per Second}
10 \unit {point}
10 \unit {Point}
10 \unit {basepoint}
10 \unit {Basepoint}
10 \unit {C}
\stoplines


-
  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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___