Alternative to LaTeX \discretionary?

In Polish, it’s a common practice to include a hyphen at the start of the line when breaking a word with a hyphen in it.

In that case, the word biało-czarny could be hyphenated to:
biało-
-czarny

In LaTeX, this could be achieved using \discretionary{-}{-}{-}. Is there anything similar to this in Typst? I don’t want to manually break it using -\ -

1 Like

Starting with Typst v0.12, which is currently available for testing, this will happen automatically when setting the language to Polish using #set text(lang: "pl").

The same is true for the languages Lower Sorbian, Czech, Croatian, Portuguese, Slovak, and (in some cases) Spanish.

4 Likes

Huh, that’s great news! Is there (or is there planned to be) a way to set that manually? Or anything like \discretionary for other, similar purposes?

I’m neither aware of any way to currently do something like that, nor of any concrete plans to add one, but who knows what the future will bring.


To add a bit of context for any readers unfamiliar with the \discretionary macro: It can be used for words whose hyphenated form is different from. For example, the old German spelling rules dictated the word “lecker” to be hyphenated as “lek-/ker”, which can be set via \discretionary{lek-}{ker}{lecker}.

1 Like

For context and for anyone who wants to try out version 0.12.0-rc1: