typst / typst

A new markup-based typesetting system that is powerful and easy to learn.
https://typst.app
Apache License 2.0
32.62k stars 871 forks source link

Spaces after « and before » should be nobreak in french #1920

Open crowdagger opened 1 year ago

crowdagger commented 1 year ago

Description

(Hi, first time submitting an issue for this project, hope I'm doing it things more or less right!)

When setting lang to french, spaces after and before the french « quotes » (or "guillemets") « and » should be unbreakable. Currently, this is not the case:

« Bonjour, ceci est un dialogue » 

"Bonjour, ceci est un dialogue"

Screenshot 2023-08-12 at 14-08-44 Test – Typst

As the example above shows, using the smart quote feature it works correctly, but some french layouts (e.g. Bépo) allow to easily type « and » and if you are used to do it the results won't be great.

(If you agree this should be fixed and can point me in the right direction, I'd be happy to try and start working on a PR ^^)

Reproduction URL

No response

Operating system

Web app, Windows

Typst version

Omikhleia commented 1 year ago

Slightly relates to https://github.com/typst/typst/issues/1194#issuecomment-1561194499 (where I mentioned in passing that "the use of a \u{00A0} space in French quotes is not really respecting the true typography")

My 2 cents on the topic:

The "guillemet space" shall always be unbreakable indeed, and is "usually" smaller than the regular inter-word space, with also a bit less stretch/shrinkability. Babel (LaTeX) adopted a definition recommended by Thierry Bouche years ago (and SILE followed it too more recently), which as far as I understand is typographically sound for fr and fr-CA (but note that fr-CH may prefer a thin space there, or even no guillemet space at all).

Likewise, for the record, French requires a non-breakable space (but usually stretch/shrinkable as an inter-word space for justification purposes) before a colon -- and a thin space before certain "high" punctuation signs ;!? (with a number of exceptions...), unbreakable too and usually non-variable, ideally around half of the inter-word space, at least in fr; fr-CA usually does not add that space before the so-said high punctuations)

Obviously/unfortunately, few typesetting software follow these usual/old conventions -- as noted, LaTeX with Babel does, as well as SILE -- But many just use some unbreakable fixed spaces in these cases. FWIW, LibreOffice and MSWord do that (i.e. insert the same fixed nbsp everywhere), though they do implement some of the differences between French from France, Canada and Switzerland ;)

yodatak commented 1 week ago

Maybe in this part https://github.com/typst/typst/blob/main/crates/typst/src/text/smartquote.rs

any maybe with this we could now doi it with simple show instruction https://github.com/typst/typst/pull/4876 https://github.com/typst/typst/issues/4672

laurmaedje commented 1 week ago

Not sure whether this is even a bug. The smartquotes work as intended and the text above with manual quotes simply doesn't use non-breaking spaces.