ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen via ntg-context <ntg-context@ntg.nl>
Cc: Alan Braslau <alan.braslau@icloud.com>
Subject: Re: \unit parser ignoring case, in some cases.
Date: Tue, 14 Mar 2023 10:08:31 -0600	[thread overview]
Message-ID: <20230314100831.47b15277@boo.my.domain> (raw)
In-Reply-To: <5644393d-7778-c03c-50f4-fde3b04cc521@freedom.nl>

On Tue, 14 Mar 2023 15:36:37 +0100
Hans Hagen via ntg-context <ntg-context@ntg.nl> 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 <K>} 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
___________________________________________________________________________________

  reply	other threads:[~2023-03-14 16:08 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
2023-03-14 14:36     ` Hans Hagen via ntg-context
2023-03-14 16:08       ` Alan Braslau via ntg-context [this message]
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=20230314100831.47b15277@boo.my.domain \
    --to=ntg-context@ntg.nl \
    --cc=alan.braslau@icloud.com \
    /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).