4

Here is my minimal code:

\documentclass[12pt]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{french}

\begin{document}
Bonjour tout le monde. Si je vais au bout de la ligne, je vais avoir cela : non !
\end{document}

Here is the result: enter image description here

How can I prevent the line break just before ":"?

0

1 Answer 1

12

There is a bug in gloss-french (or more precisely it hasn't been updated to the new xetex yet). The space/boundary has in the newer xetex versions another class. This avoids the break:

\documentclass[12pt]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\makeatletter
\XeTeXinterchartoks 4095 \french@punctthin = {\xpg@unskip\nobreak\thinspace}%
\XeTeXinterchartoks 4095 \french@punctthick = {\xpg@unskip\nobreakspace}%
\makeatother

\begin{document}
Bonjour tout le monde. Si je vais au bout de la ligne, je vais avoir cela : non !
\end{document}

A patch that would allow you to run the document with luatex too would be:

\documentclass[12pt]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{etoolbox}

\makeatletter
\patchcmd\french@punctuation{255}{4095}{}{}
\patchcmd\french@punctuation{255}{4095}{}{}
\makeatother

\begin{document}
Bonjour tout le monde. Si je vais au bout de la ligne, je vais avoir cela : non !
\end{document}

Beside this you don't have to add the space in the input as the french module will do it for you

\documentclass[12pt]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{french}

\begin{document}
Bonjour tout le monde. Si je vais au bout de la ligne, je vais avoir cela: non!
\end{document}

(Imho if you also write in other languages it is a good idea to get used to an input without spaces as it will give the wrong output e.g. in an english or german context.)

enter image description here

6
  • 1
    @cjorssen: Do you mean that you have already written a lot of source code writing things like cela : instead of cela:?
    – GuM
    Sep 22, 2016 at 17:20
  • @cjorssen: I edited the answer. Actually there is a bug in gloss-french. Sep 22, 2016 at 17:24
  • Thanks. So it affects only xetex?
    – cjorssen
    Sep 22, 2016 at 18:47
  • @cjorssen: Yes together with polyglossia. babel/frenchb has already adapted the code. Sep 22, 2016 at 19:03
  • 2
    I adapted the answer. The bug has already been reported: github.com/reutenauer/polyglossia/issues/145. Besides this: Imho the french module of babel is much more sophisticated then the one of polyglossia. Sep 23, 2016 at 7:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .