[NTG-context] Spacing in \unit - SOLVED
Gavin
gavinpublic at comcast.net
Wed Oct 12 23:54:43 CEST 2022
Hi Max, Alan, Bruce, Hans, et.al
I solved my four issues with \unit spacing. In the process, I prevented unwanted line breaks and removed an overzealous backspace before division symbols. Below is a MWE that shows all of these issues, as well as pictures of the result with the unmodified phys-dim.mkxl and with my modified phys-dim.mkxl. The final result is exactly what I wanted.
If anyone wants my changes, either for their own use or to improve the distributed phys-dim.mkxl, Iām happy to share.
Thanks for all of your comments!
Gavin
MWE:
\setuppapersize[A5]
\starttext
The \type{\unit} command in text produces \unit{1.23e5 kg m^2/s^2}.
Inline math \type{$\unit$} produces $\unit{1.23e5 kg m^2/s^2}$.
Display math produces
\startformula
\unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula
Line breaking in math:
{\hsize=0pt $G = \unit{6.6743e-11 m3 kg-1 s-2}$}
\blank
Line breaking in text:
{\hsize=0pt \unit{6.6743e-11 m3 kg-1 s-2}}
\stoptext
Output with unmodified phys-dim.mkxl:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-3.pdf
Type: application/pdf
Size: 16028 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20221012/8671718a/attachment-0002.pdf>
-------------- next part --------------
Output with my modified phys-dim.mkxl:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.pdf
Type: application/pdf
Size: 16052 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20221012/8671718a/attachment-0003.pdf>
-------------- next part --------------
> On Oct 10, 2022, at 12:15 AM, Max Chernoff via ntg-context <ntg-context at ntg.nl> wrote:
>
> Hi Alan,
>
>> I would very strongly argue that the space between the number and the
>> following units be UNBREAKABLE. Perhaps a thin space (preference), but
>> most certainly non-breakable.
>>
>> Similarly around the times in scientific notation.
>>
>> I further cannot imagine that a line break be acceptable around a \cdot
>> in composite units.
>>
>> This can possibly lead to overfill and underfill, something that I find
>> *infinitely* more acceptable then breaking numbers and units.
>
> Yes, I agree completely here.
>
>> I do not know or use the \units command. Maybe it uses unbreakable
>> spaces, maybe not. I would never use it unless it could be configured
>> to only use nonbreakable spaces.
>
> The current behaviour doesn't break the unit from the number, but it
> does split the scientific notation.
>
> This test file:
>
> \starttext
> \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
>
> \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
> \stoptext
>
> gives:
>
> Math:
> šŗ=
> 6.6743Ć
> 10ā11m3ā
kgā1ā
sā2
> Text:
> 6.6743
> Ć
> 10ā11 m3ā
kgā1ā
sā2
>
> which isn't great. In my opinion, the \unit command should be typeset in an
> \hbox (or similar) since I can't think of any circumstances where breaking
> it would be reasonable.
>
> Thanks,
> -- Max
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at 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
> ___________________________________________________________________________________
More information about the ntg-context
mailing list