ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gavin via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Gavin <gavinpublic@comcast.net>
Subject: Spacing in \unit
Date: Sat, 8 Oct 2022 11:59:04 -0600	[thread overview]
Message-ID: <DDE9DDAB-986E-490D-8ACE-B7539CDE3C37@comcast.net> (raw)

Hi list,

I made a small example with all of the issues I am trying to fix for the \units command. The first formula below uses the \unit command, but produces strange spacing. The second formula produces the desired spacing, without using the \unit command.

\showmakeup[mathglue] %\mathspacingmode=1

\starttext
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 W s} = \unit{9.87e5 newton m}
\stopformula
\startformula
 1.23\mathord\times10^5\,{\rm kg\mathord\cdot m^2/s^2} + 8.64\mathord\times10^5\,{\rm W\mathord{\cdot}s} = 9.87\mathord\times10^5\,{\rm N\mathord{\cdot}m}
\stopformula
\stoptext

I’m trying to fix four issues:
  - No space between the number and the following units. Should be a thin space.
  - No space between the units and the following symbol (+ and = above). Should be appropriate “bin" or “rel" space.
  - Too much space around the \cdot in the units. Should be treated like an “ord" when used to separate units.
  - Too much space around the \times in the scientific notation. Should be treated like an "ord" when used in scientific notation. (I'm not sure there is consensus on this.)

Some of these seemed like things I could fix myself, so I dug into phys-dim.mkxl to see what I could do. The good news is that I didn’t break anything. The bad news is that nothing I did seemed to have any effect – including deleting phys-dim.mkxl entirely! I double checked that I was working on the same installation used for typesetting. Is the code used for \unit now somewhere else?

These issues only occur in math mode, and \unit handles comma separators correctly, unlike \digit.

I’d like to get some sort of temporary patch for at least some of these issues, even if I need to write it myself. I use \unit everywhere in physics problems sets for students and in keys that I share other teachers.

Any guidance is appreciated!

Gavin

P.S. I’m working on a more comprehensive test file, but its not ready yet.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2022-10-08 17:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-08 17:59 Gavin via ntg-context [this message]
2022-10-10  1:32 ` Alan Braslau via ntg-context
2022-10-10  6:15   ` Max Chernoff via ntg-context
2022-10-12 21:54     ` Spacing in \unit - SOLVED Gavin via ntg-context
2022-10-12 22:11       ` Rik Kabel via ntg-context
2022-10-12 22:49       ` Max Chernoff via ntg-context
2022-10-12 23:55         ` Spacing in \unit - degrees Alan Braslau via ntg-context
2022-10-13  3:14           ` Gavin via ntg-context
2022-10-13 13:26             ` Alan Braslau via ntg-context
2022-10-13  0:11         ` Spacing in \unit - SOLVED Gavin via ntg-context
2022-10-13  7:03       ` Oliver Sieber via ntg-context
2022-10-13 11:52         ` Gavin via ntg-context
2022-10-14  8:12           ` Hans Hagen via ntg-context
2022-10-21 18:20             ` Gavin via ntg-context
2022-10-21 19:07               ` Gavin via ntg-context
2022-10-12 16:50 ` Dimension atom in math? (was: Spacing in \unit) Gavin via ntg-context
  -- strict thread matches above, loose matches on Subject: below --
2022-09-25 13:30 Spacing in \unit Gavin via ntg-context
2022-09-25 15:19 ` Hans Hagen via ntg-context
2022-09-25 15:29   ` Gavin via ntg-context
2022-09-25 15:39     ` Hans Hagen via ntg-context
2022-09-25 16:31 ` Bruce Horrocks via ntg-context

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=DDE9DDAB-986E-490D-8ACE-B7539CDE3C37@comcast.net \
    --to=ntg-context@ntg.nl \
    --cc=gavinpublic@comcast.net \
    /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).