ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco Patzer <lists@homerow.info>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected
Date: Tue, 5 Dec 2023 15:19:25 +0100	[thread overview]
Message-ID: <20231205151925.7aa88ea1@homerow> (raw)

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
___________________________________________________________________________________

             reply	other threads:[~2023-12-05 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 14:19 Marco Patzer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231205151925.7aa88ea1@homerow \
    --to=lists@homerow.info \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).