Hi List, I am trying to improve the spacing produced by the \unit command. I have solved three of my four issues by modifying phys-dim.mkxl, but the fourth issue has me stumped. Consider this example: \showmakeup[mathglue] \mathspacingmode=1 \starttext \startformula \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule} \stopformula \stoptext There is no space between the units and the following + or =. The \showmakeup reveals that this is the space between a “dim” and a “bin” or a “dim” and a “rel”. I am guessing that “dim” refers to a new “dimension” atom class, and it appears that the table determining the spacing between atoms does not include space between this dimension class and the binary or relation classes. I don’t know that this is the problem, but this is my best guess. If this is the problem, is there a way I can add this space to the necessary table? If this is not the problem, I’m open to any other insight or advice. Thanks, Gavin
On Oct 8, 2022, at 11:59 AM, Gavin
wrote: 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.