# Bad spacing with XeLatex and polyglossia

I have a multilingual Latex document the which uses Xelatex and the fontspec package for rendering. My rendered document shows unsatisfying spacing especially in English: Often the white space after punctuation of any kind is far too wide. I never had this issue before, and therefor I am asking my self, if I got mad or if something has changed with some package updates: Here is an example:

It quite strikes the eye, that there isn't any hyphenation going on. But this may be just a coincidence, as later in the document there are cases of hyphenation, but not many. My results in German are better. Can anybody help me out here please.

Here is a code example:

\documentclass[a4paper,10pt,twoside]{memoir}

\usepackage{polyglossia}

\usepackage{xltxtra}
\usepackage{fontspec}

\setmainlanguage[spelling=old,babelshorthands=true,script=latin]{german}
\setotherlanguage[variant=polytonic]{greek}{}
\setotherlanguages{english, french, italian, spanish, latin, portuguese}

\usepackage{blindtext}

\begin{document}

\blinddocument
\begin{english}
\blinddocument
\end{english}
\end{document}

• space after punctuation is larger than word spaces by default, use \frenchspacing to turn this off Aug 19 '20 at 19:56
• @DavidCarlisle Ah, ok, I didn't find anything about it in the polyglossia manual or else where. Aug 19 '20 at 19:57
• it is a built in tex feature, not really xetex or polyglossia specific except that babel and polyglossia probably switch between \frenchspacing and non french spacing as the default, depending on the language in use Aug 19 '20 at 19:59
• That's not a polyglossia feature, but a general (La)TeX feature (cf. tex.stackexchange.com/q/4705/35864). \nonfrenchspacing (which leaves a larger space after sentence-ending punctuation) is enabled for some languages like English and disabled (by calling \frenchspacing) for other languages where that is not that common (German and French for example). Aug 19 '20 at 20:00
• @moewe Thanks for clarifying. The strange thing is, that it seems to depend on the command you are using to change the language too. Is there a way to set \frenchspacing for all languages in a document? Aug 19 '20 at 20:10

As David Carlisle says in the comments, this is expected behaviour: By default TeX leaves a slightly larger space after sentence-ending punctuation than between words. This behaviour is known by the TeX command \nonfrenchspacing.

While this is common (or at least not completely uncommon) in English typography (though I gather there is debate about whether or not it is a good idea to leave a larger space after periods and the likes), it is usually not done in other languages. For those situations TeX has the command \frenchspacing, which causes space after punctuation to become the same as inter-word spaces.

So you would say \frenchspacing to counter this behaviour if you see it.

When localisation packages like babel and polyglossia are involved, those packages may change the \frenchspacing/\nonfrenchspacing state if languages are switched according to national conventions.

With a modern version of polyglossia there is a way to completely disable \nonfrenchspacing and force \frenchspacing at all times: Just redefine the internal macro \polyglossia@lang@frenchspacing:n that sets \(non)frenchspacing to always issue \frenchspacing.

\documentclass[a4paper,10pt,twoside]{memoir}

\usepackage{polyglossia}
\usepackage{fontspec}

\makeatletter
\ExplSyntaxOn
\cs_set_nopar:Nn{\polyglossia@lang@frenchspacing:n}{\frenchspacing}
\ExplSyntaxOff
\makeatother

\setmainlanguage[spelling=old,babelshorthands=true,script=latin]{german}
\setotherlanguage[variant=polytonic]{greek}{}
\setotherlanguages{english, french, italian, spanish, latin, portuguese}

\usepackage{blindtext}

\begin{document}

\blinddocument
\begin{english}
\blinddocument
\end{english}
\end{document}


But there are alternatives to this approach, e.g. polyglossia: how to set \frenchspacing for all languages, everywhere?.

Another very radical alternative (that probably has the potential to break stuff) would be

\def\nonfrenchspacing{\frenchspacing}
\AtBeginDocument{\frenchspacing}

• Just for completeness and as babel has been mentioned, the equivalent setting is \AddBabelHook{frenchspacing}{afterextras}{\frenchspacing}. Aug 28 '20 at 11:04