From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Gavin via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: Re: \unit parser ignoring case, in some cases.
Date: Tue, 14 Mar 2023 17:56:22 +0100 [thread overview]
Message-ID: <9640ff44-5280-04bf-d39f-a4e9a4c25303@freedom.nl> (raw)
In-Reply-To: <5BBAAB98-8AA9-460D-9653-AC189A7E8B43@comcast.net>
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 <ntg-context@ntg.nl> wrote:
>> On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context <ntg-context@ntg.nl> 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
___________________________________________________________________________________
next prev parent reply other threads:[~2023-03-14 16:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 13:04 Gavin via ntg-context
2023-03-13 21:44 ` Hans Hagen via ntg-context
2023-03-13 21:55 ` Gavin via ntg-context
2023-03-14 2:10 ` Alan Braslau via ntg-context
2023-03-14 16:33 ` Gavin via ntg-context
2023-03-14 16:43 ` Gavin via ntg-context
2023-03-14 16:56 ` Hans Hagen via ntg-context [this message]
2023-03-14 14:36 ` Hans Hagen via ntg-context
2023-03-14 16:08 ` Alan Braslau via ntg-context
2023-03-14 18:03 ` Gavin via ntg-context
2023-03-14 18:14 ` Alan Braslau via ntg-context
2023-03-14 21:32 ` Hans Hagen via ntg-context
2023-03-14 22:00 ` Gavin via ntg-context
2023-03-14 21:26 ` Hans Hagen via ntg-context
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=9640ff44-5280-04bf-d39f-a4e9a4c25303@freedom.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@freedom.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).