ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \unit parser ignoring case, in some cases.
@ 2023-03-09 13:04 Gavin via ntg-context
  2023-03-13 21:44 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 14+ messages in thread
From: Gavin via ntg-context @ 2023-03-09 13:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

Hello list,

I continue to work with the \unit command, and found some behavior very surprising. When I try to register units with capital letter names, it breaks lowercase metric prefixes. For example, registering C=coulomb, K=kelvin and N=newton breaks metric units cm, kg, and ns. The file below demonstrates the behavior.

Obviously, I can use full names in my document. However, I would like the standard SI symbols, which are single capital letters, to work for me and my less TeX-savvy colaborators.

Thanks!
Gavin


\starttext

Units does not completely ignore case.

\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

Units with capital letters, called with the capital letter (C, K, N) fail.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

Now I register some units with capital letter names: C=coulomb, K=kelvin, N=newton.

\registerunit[unit][
  C=coulomb,
  K=kelvin,
  N=newton]

Units called by capital letter (C, K, N) now work.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

However, units with lowercase prefixes (c, k, n) are broken.
\startformula
  \unit{3cm} \qquad
  \unit{6kg} \qquad
  \unit{3ns} \qquad
\stopformula

\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-03-14 22:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 13:04 \unit parser ignoring case, in some cases 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
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

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).