[NTG-context] \unit parser ignoring case, in some cases.
Hans Hagen
j.hagen at freedom.nl
Tue Mar 14 15:36:37 CET 2023
On 3/13/2023 10:55 PM, Gavin wrote:
>
>
>> On Mar 13, 2023, at 3:44 PM, Hans Hagen via ntg-context <ntg-context at ntg.nl> 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
-----------------------------------------------------------------
More information about the ntg-context
mailing list