0

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: enter image description here

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}

user5950
  • 1,456
  • 1
    space after punctuation is larger than word spaces by default, use \frenchspacing to turn this off – David Carlisle Aug 19 '20 at 19:56
  • @DavidCarlisle Ah, ok, I didn't find anything about it in the polyglossia manual or else where. – user5950 Aug 19 '20 at 19:57
  • 1
    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 – David Carlisle Aug 19 '20 at 19:59
  • That's not a polyglossia feature, but a general (La)TeX feature (cf. https://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). – moewe 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? – user5950 Aug 19 '20 at 20:10
  • Mhhh, I guess it is possible that some commands like \foreignlanguage don't switch \(non)frenchspacing. Is that what you mean? Can you show an example that demonstrates how this depends on the command you use for language selection? (As I said, it will depend on the language you choose.) I'm not aware of an official way to set \frenchspacing for all languages (except for a few hacks like \let\nonfrenchspacing\frenchspacing and \AtBeginDocument{\frenchspacing}; maybe there is something better, I shall have a look tomorrow ...). – moewe Aug 19 '20 at 20:14
  • You may be interested in https://tex.stackexchange.com/q/406086/35864 (where the answer only explicitly deals with English - which may actually be enough, I don't know which languages don't use \frenchspacing off the top of my head) – moewe Aug 19 '20 at 20:16

1 Answers1

1

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}
moewe
  • 175,683
  • 1
    Just for completeness and as babel has been mentioned, the equivalent setting is \AddBabelHook{frenchspacing}{afterextras}{\frenchspacing}. – Javier Bezos Aug 28 '20 at 11:04