Hi Alan
On Oct 12, 2022, at 5:55 PM, Alan Braslau via ntg-context
wrote: \unit{135℃} adds a space after the digits 135. I do not believe that this is correct (for ℃ is *not* a "real" unit, unlike \unit{408.15 K} which *is* a real unit).
According to “Scientific Style and Format: The CSE Manual for Authors, Editors, and Publishers, 8th Ed.” by the Council of Science Editors:
The symbol for degrees Celsius, ℃ (not simply C), is separated from the number on its left by one space, whereas the degree symbol for a plane angle (e.g. a 45° angle) and for longitude and latitude (e.g. 45°30’N) is not separated from the numeral by a space. [§12.2.1.1 SI Rules, pp.169-170]
As a recovering string theorist, I cannot help but speculate that this rule extends to spherical coordinates in any number of dimensions. However, if you don’t want the space, you can use 135\unit{℃}, which does not add a space.
Also, \unit{135°C} drops the "C". Is this a parsing bug?
It is not a parsing bug; it is a limitation. In general, units must be spelled out (newton, joule, etc.) which produces the correct SI symbol (N, J, etc.). Some units are also recognized by their symbols (m, s, kg,…). Celsius is recognized by the single character “℃” and by the name “celsius”, but not by the two character combination “°C”. Probably, the parser could be expanded to recognize the two character combination. That requires mucking around in phys-dim.lua, which I’m not going to touch. Use \unit{135 celsius} if you want the space, and 135\unit{celsius} if you don’t. Or you can add your favorite abbreviations: \registerunit[ °C=°C, ] \setupunittext[ °C=℃, ] Then use \unit{135°C} if you want the space and 135\unit{°C} if you don’t.
Related, \unit{90°} does not seem to introduce a space, as indeed it should not.
Also related, using \unit for just the units, and not the number, is useful when they follow something that is not a number, like a vector: $ \vec v = (4.0, -3.2, 1.5)\unit{m/s} $. You frequently do not want a space in that situation. Now that I’ve had this success messing with other people’s code, I’ve got your luagraph module on my mind. Gavin