How can I change hyphenation rules without changing language?

Hyphenation rules depend on the language used, but, sometimes, I want to use some rules which are not used in the language in which I write. How can I set these rules without changing the language?

Specifically: When a word is split between lines, there is a hyphen at the end of the line. If the word is split in the place where it originally contains a hyphen, the exact behavior depends on the language. In some languages, it is split just before the hyphen, so the original hyphen is at the beginning of the next line, and a hyphen is added at the end of the previous line like usually. In some languages, there is a hyphen at the end of the previous line but no other hyphen, so the original hyphen is practically lost.

I want to keep the original hyphen at the beginning of the next line in English text. Here is an example:

#set par(justify: true)
#set page(width: 5cm, height: 5cm, margin: 2mm)

#set text(lang: "en")
English: \
Fugiat corrupti quam sed de-bitis nulla dolores et perspi-ciatis.

#set text(lang: "cs")
Czech: \
Fugiat corrupti quam sed de-bitis nulla dolores et perspi-ciatis.

Rendering of the previous code

Notice that the words “de-bitis” and “perspi-ciatis” contain hyphens in the source text. In the English typeset text, there is no way to tell that there are hyphens originally, not just to break words between lines. The Czech typeset text is much clearer in this regard.

How can I do in Typst that hyphenation in English behaves like in Czech as is shown?

Related question: How can I change quotation marks in the set language, so, for example, #quote[like this] whould look ‹like this› in English text?

I do not know if it is possible, but I expect that these rules would be exposed as parameters, or that I would create a custom language based on English with some rules tweaked.

This is just an answer to your second question regarding quotes. You can set the property quotes of the function smartquote() to override the default quotes based on the language. This will affect automatic quotes as well as the function quote().

#set smartquote(quotes: "<>")
"Hello" #quote[World]
1 Like

text.costs


1 Like