\unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected
Hi! I'm struggling with the rendering of a particular liquid metal: %% renders as m (meter), not as Hg \unit{mercury} %% renders as mm·m, not as mmHg \unit{millimetermercury} This is strange, since both “mercury” and “millimetermercury” are defined in phys-dim.lua. To get mercury recognised as a unit this can be used: \registerunitshortcut [mercury=mercury] Now \unit{mercury} renders correctly as Hg. Why is that \registerunitshortcut necessary? Is it even correct to use it like this? However, even then millimetermercury doesn't render correctly: %% renders as mm·Hg, not as mmHg \unit{millimetermercury} How to get millimetermercury render as mmHg? And “inch mercury” render as inHg? I can't find “inchmercury” in phys-dim.lua, only “millimetermercury”, should it be added? Example: %% \enabletrackers [physics.units] %% inch should render as “in” %% \setupunittext [inch=in] \starttext \unit{mercury}\crlf %% renders: mm · m \unit{12 millimetermercury}\crlf %% renders: mm · m \unit{12 inchmercury}\crlf %% renders: in · m %% why is this necessary to get mercury rendered as Hg? \registerunitshortcut [mercury=mercury] \unit{12 millimetermercury}\crlf %% renders: mm · Hg \unit{12 inch mercury}\crlf %% renders: in · Hg \stoptext Questions: 1) Why is \unit{mercury} not working, although it's listed in phys-dim.lua? 2) Is the call \registerunitshortcut [mercury=mercury] necessary/correct? 3) How to make \unit{millimetermercury} render as mmHg and \unit{inch mercury} render as inHg? Marco
Marco Patzer schrieb am 05.12.2023 um 15:19:
Hi!
I'm struggling with the rendering of a particular liquid metal:
%% renders as m (meter), not as Hg \unit{mercury}
%% renders as mm·m, not as mmHg \unit{millimetermercury}
This is strange, since both “mercury” and “millimetermercury” are defined in phys-dim.lua. To get mercury recognised as a unit this can be used:
\registerunitshortcut [mercury=mercury]
Now \unit{mercury} renders correctly as Hg.
Why is that \registerunitshortcut necessary? Is it even correct to use it like this? However, even then millimetermercury doesn't render correctly:
%% renders as mm·Hg, not as mmHg \unit{millimetermercury}
How to get millimetermercury render as mmHg? And “inch mercury” render as inHg? I can't find “inchmercury” in phys-dim.lua, only “millimetermercury”, should it be added?
Example:
%% \enabletrackers [physics.units]
%% inch should render as “in” %% \setupunittext [inch=in]
\starttext \unit{mercury}\crlf %% renders: mm · m
\unit{12 millimetermercury}\crlf %% renders: mm · m \unit{12 inchmercury}\crlf %% renders: in · m
%% why is this necessary to get mercury rendered as Hg? \registerunitshortcut [mercury=mercury]
\unit{12 millimetermercury}\crlf %% renders: mm · Hg \unit{12 inch mercury}\crlf %% renders: in · Hg \stoptext
Questions:
1) Why is \unit{mercury} not working, although it's listed in phys-dim.lua? 2) Is the call \registerunitshortcut [mercury=mercury] necessary/correct? 3) How to make \unit{millimetermercury} render as mmHg and \unit{inch mercury} render as inHg?
None of your examples work because millimetermercury and mercury are the names for the labels and the units are accessed with hg and mmhg. \setupunittext[en][millimetermercury=inHg] \starttext \unit{mmhg} \stoptext Wolfgang
On Tue, 5 Dec 2023 17:27:59 +0100
Wolfgang Schuster
None of your examples work because millimetermercury and mercury are the names for the labels and the units are accessed with hg and mmhg.
Ok, that makes sense. And it works, thanks for the explanation and the quick reply.
\setupunittext[en][millimetermercury=inHg]
That doesn't make sense, inch and mm are different units. I'd rather add: \registerunit [inHg=inchmercury] \setupunittext [en] [inchmercury=inHg] Marco
Marco Patzer schrieb am 05.12.2023 um 19:58:
\setupunittext[en][millimetermercury=inHg] That doesn't make sense, inch and mm are different units. I'd rather add:
\registerunit [inHg=inchmercury]
\setupunittext [en] [inchmercury=inHg]
It's just a stupid example to show how to set the label value. Wolfgang
On Tue, 5 Dec 2023 20:06:46 +0100
Wolfgang Schuster
That doesn't make sense, inch and mm are different units. I'd rather add:
\registerunit [inHg=inchmercury]
\setupunittext [en] [inchmercury=inHg]
It's just a stupid example to show how to set the label value.
Ok, got it. Thanks for your quick help, as usual! Marco
participants (2)
-
Marco Patzer
-
Wolfgang Schuster