Is it possible to disallow putting dashes on new lines

Here is another workaround, but it doesn’t work with the equation as shown in the example. If you in fact want non-breaking spaces you could also consider typing them out. Their shortcut is ~ in markup.

#show: block.with(width: 16.0cm, stroke: 0.3pt)
#set text(lang: "uk")
#show regex("\b -"): it => it.text.replace(" ", sym.space.nobreak)
#show regex("\b –"): it => it.text.replace(" ", sym.space.nobreak)
#show regex("\b —"): it => it.text.replace(" ", sym.space.nobreak)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore - lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore -- lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore --- lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut $x = 1$ --- lorem ipsum dolor sit amet.


If you really want justification at a linebreak you can use #linebreak(justify: true) for that but it doesn’t produce very nice results. It will stretch the line as far as necessary in that case.

1 Like