How to make Numbers with their units stay in the same line?

Hey!

Currently writing my Bachelors Thesis in mechanical engineering and I have been struggling to find a solution for having Units and their Numbers be bound to the same line of text. The Numbers are not in math mode. In the screenshots you can see the wrong and correct styling i want to achieve. Can anyone help?
Wrong:
wrong
Right:
right

Using the box command doesnt work as it creates a lot of empty space in the paragraph

1 Like

You can produce a non-breaking space using the tilde:

D10 = 2,5~μm, D50 = 8,3~μm
2 Likes

Oh boy, thank you so much.

1 Like

https://typst.app/docs/reference/symbols/#shorthands

consider using one of the packages unify, metro or fancy-units when you work with physical quantities. The line break can occur but uses basically the same fix in the last of the bunch:

#import "@preview/fancy-units:0.1.1": *
#configure(
  qty-format: format-qty.with(
     separator: sym.space.nobreak.narrow //this is "~"
  ),
)
3 Likes

I wonder why none of them use no-break space by default. Also, they use math font/mode, while OP doesn’t.

3 Likes