Skip to content

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

Closed

Description

@crowdagger

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

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Aug 12, 2023
  2. Omikhleia commented on Aug 15, 2023

    @Omikhleia

    Slightly relates to #1194 (comment) (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 ;)

  3. added
    text
    on Aug 15, 2023
  4. added
    good first issue
    good contribution
    on Jul 16, 2024
  5. yodatak commented on Sep 4, 2024

    @yodatak
  6. laurmaedje commented on Sep 4, 2024

    @laurmaedje
    Member

    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.

  7. sijow commented on Sep 20, 2024

    @sijow
    Contributor

    I agree this is rather a feature request (the current behavior is fine but maybe typst could automatically fix the spacing when the use enters guillemets).

    If this issue is closed though maybe #4674 should be reopened (it would be nice to extend the "automatic localization" done for quotes to other types of punctuation).

  8. ainar commented on Nov 13, 2024

    @ainar

    I'm facing this problem in the bibliography. I know no way to add a space before a colon in this case:
    image

  9. eltos commented on Jan 28, 2025

    @eltos
    Contributor

    How about a simple show rule to ease your typing habit?

    #set page(width: 190pt, height: auto)
    
    « Bonjour, ceci est un dialogue » 
    
    #show regex("(« |‹ | ›| »)"): it => {
      show sym.space: sym.space.nobreak // or sym.space.nobreak.narrow
      it
    }
    
    « Bonjour, ceci est un dialogue » 

    testsdf.png

    Caution

    Note that the usage of Guillemets differs in different cultures, built-in automatic space substitution would have to take this into account:

    Ein « Beispiel » in Frankreich und der Welschschweiz
    Ein «Beispiel» in der Deutschschweiz
    Ein »Beispiel« in Deutschland und Österreich  // ⚠ Avoid nobreak space here
    
  10. MDLC01 commented on Feb 24, 2025

    @MDLC01
    Collaborator

    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.

    Note that regular spaces before some other marks are treated as non-breaking:

    #lorem(14) A test » \
    #lorem(14) A test ! \
    #lorem(14) A test ? \
    #lorem(14) A test : \
    #lorem(14) A test ; \
    #lorem(14) A test ,

    Only the closing guillemet is alone on a new line. The other marks are on a new line, together with "test".

  11. laurmaedje commented on May 1, 2025

    @laurmaedje
    Member

    Fixed by #5976

  12. MDLC01 commented on May 1, 2025

    @MDLC01
    Collaborator

    #5976 is about the smartquote elements. This issue is about manually inserted guillemets. The following still does not work as intended in the April 10 development version, which should include #5976.

    #set text(lang: "fr")
    
    #lorem(14) A test » \
    #lorem(14) A test ! \
    #lorem(14) A test ? \
    #lorem(14) A test : \
    #lorem(14) A test ; \
    #lorem(14) A test ,

    Only the closing guillemet is alone on a new line. The other marks are on a new line, together with "test".

  13. reopened this on May 1, 2025
  14. Enivex commented on May 1, 2025

    @Enivex
    Collaborator

    If you're manually inserting quotes, should you then not also manually insert no-break spaces?

  15. MDLC01 commented on May 1, 2025

    @MDLC01
    Collaborator

    As I explained in #1920 (comment), spaces before some punctuation marks already do behave as non-breaking spaces.

  16. laurmaedje commented on May 1, 2025

    @laurmaedje
    Member

    #5976 is about the smartquote elements. This issue is about manually inserted guillemets. The following still does not work as intended in the April 10 development version, which should include #5976.

    I was a bit too fast with this one ...

  17. MrVyM commented on Oct 28, 2025

    @MrVyM

    I'm currently working on a document on typst with smartquotes. I just find this.
    It's the correct place to talk about this ?
    Image

    Image
  18. MDLC01 commented on Oct 28, 2025

    @MDLC01
    Collaborator

    You may want to create a separate issue, but in this case I don't think this behavior is unintended.

  19. laurmaedje commented on Jun 4, 2026

    @laurmaedje
    Member

    Closed by #8406.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood contributiongood first issuetext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions