I’m working on a German academic paper in Typst and trying to format the text with justify = true. My setup kinda looks like this:
set page("a4")
set page(margin: (right: 2.5cm, left: 3cm, top: 2.5cm, bottom: 2.5cm))
let leading = 1.5 * 12pt
let spacing = leading + 6pt
set block(spacing: spacing)
set par(spacing: spacing)
set par(leading: leading)
set par(linebreaks:auto)
set text(font: "New Computer Modern", lang: "de", size: 12pt, hyphenate:auto)
set par(justify: true)
The issue I’m running into is with gender-inclusive language, specifically using a colon “:” in words like: Brückenbauer:innen
Typst treats the “:” as punctuation (similar to sentence punctuation), so it prevents any line breaks within the word. This causes awkward spacing between words. (see screenshot below)
Is there a way to:
Allow line breaks after or within Brückenbauer:innen, or
Tell Typst to treat the colon differently (e.g., not as a punctuation mark), or
Replace the colon with a visually identical but breakable character?
One solution would be to use the * character instead, but I’d prefer to keep the colon visually as-is (per university guidelines), but I need Typst to break the word like a regular compound.
The shy hyphen is -? and it allows you to insert suggestions or extra hyphen break points in a work. Like Brück-?en
If you insert something like that into the word, it will break again (at multiple possible points, not just at the soft hyphen). I don’t really know how that works. (Why didn’t it allow hyphenation in the first place, I mean?) The question is also how to automate it for your document.
The following seems like it would work, and only this placement of the soft hyphen, again not sure why (I also don’t know where a good place to break would be in relation to the : but since it picks a place earlier in the word anyway… maybe not the problem?
I was going to suggest using a soft hyphen, U+00AD, so a question. You say you can enter it in Typst with -?. Where can I find out any similar shortcuts for other such elemants like “Narrow No Break Space”?
There is a shortcut for regular non-breaking space, ~ but for the narrow one you’ll have to go to the next page, symbols and find it there (it has a search box)
In regular markup that would be #sym.space.nobreak.narrow; to enter it. You can give it a shorter name, of course with a let statement.