Is there a way how to automatically prevent line breaks in between number and physical unit, other than manually inserting ~ as an unbreakable space? I was thinking something like a rule that replaces common white space in each occurrence when it’s between a digit and the unit (which I can define in a list, like µL, mL, mg, kg etc.).
There are a few packages that standardize the presentation of units in your document:
- unify
- fancy-units
- metro (not updated for a while)
If don’t want to use a special syntax a lot of times in your document you could use this regex based show rule:
#let prefixes = "qryzafpnμmcdhkMGTPEZYRQ"
#let units = ("L", "m")//Add all units you will use
#show regex("\\d\\s[" + prefixes + "]?(" + units.join("|") + ")"): it => {
show " ": sym.space.nobreak.narrow
it
}
But this might interact poorly with other parts of your document (and in this case does not support the deka prefix da since it’s two characters).
2 Likes
Thanks! fancy-units #qty[value][units] looks simply enough for my application.