Does Typst support automatic hanging punctuation as described in the Wikipedia article? Even for LaTeX this feature does not seem to be commonplace.
Yes, it is activated by default but can be toggled with text(overhang: false/true)
.
It does, however, only support a few characters, see typst/crates/typst-layout/src/inline/line.rs at main · typst/typst · GitHub.
Maybe it is worth mentioning that it currently only work for hyphenation. So “real” hanging punctuation (e.g. at the beginning of the line too), as in the example, for „“ and hyphens alone etc. as in the example can’t be achieved this way right now.
#set page(
width: 250pt,
background: place(dx:221pt, line(stroke: 3pt + red, length: 100%, angle: 90deg))
)
#set par(justify: true)
// Uncomment to see difference
// #set text(overhang: false)
Lorem ipsum dolor sit amet, consectetu–adipiscing elit. Nunc omni virtuti vitium contrario nomine-opponitur. Sed non sunt. in eo genere tantae commoditates corporis; tamque productae temporibus tamque multae. Nec vero alia sunt quaerenda contra Carneadeam illam sententiam. Itaque contra est, ac dicitis; Ex ea difficultate illae fallaciloquae, ut ait Accius, malitiae natae sunt. Nos commodius agimus.
Maybe this is a bit shaky because the default font changed. I’m honestly not sure if this can even be achieved without either dynamically measuring the characters in question or having the amount of correction be adjustable on a per-character basis.