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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to