ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected
@ 2023-12-05 14:19 Marco Patzer
  2023-12-05 16:27 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Patzer @ 2023-12-05 14:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

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

end of thread, other threads:[~2023-12-05 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 14:19 [NTG-context] \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected Marco Patzer
2023-12-05 16:27 ` [NTG-context] " Wolfgang Schuster
2023-12-05 18:58   ` Marco Patzer
2023-12-05 19:06     ` Wolfgang Schuster
2023-12-05 19:21       ` Marco Patzer

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