[Tex/LaTex] Why is XeLaTeX Pushing British English Text into the Margins

babelfontspolyglossiaxetex

I'm running into issues whereby TeX/LaTex/XeLaTex can't seem to calculate line breaks properly in regular paragraphs. This came about when I was experimenting with different fonts—in particular, Linux Libertine—and I found that XeLaTex would now and again let lines spill over into the right-hand margin, when using Linux Libertine, for no apparent reason.

I'm a TeX novice, but I think I've narrowed the issue down to the presence of the "british" or "UKenglish" language option when using the babel—or even polyglossia—package in conjunction with certain fonts, e.g., Linux Libertine. Here's what I've managed to figure out so far:

The following are cases where there are no visible issues with lines spilling into the margins:

  1. typesetting/compiling the document with pdfLaTeX using (a) TeX's
    default font and (b) the babel package with the language option set
    to any option for British or American English;

  2. typesetting the document with XeLaTex using (a) the Times New Roman
    font—\setmainfont[Ligatures=TeX]{Times New Roman}—and (b) the babel
    or polyglossia packages with the language option set to "british" or
    "UKenglish";

  3. typesetting the document with XeLaTex using (a) the
    Linux Libertine font—\setmainfont[Ligatures=TeX]{Linux
    Libertine}—but with (b) the babel or polyglossia packages and the
    language option set to any form of American English.

However, here are the cases where there are visible issues of lines spilling into the margins:

  1. typesetting the document with XeLaTex using (a) the Linux Libertine font and (b) the babel or polyglossia packages with the language option set to any form of British English ("british" or "UKenglish").

In other words, the problem only arises when all of the following hold true: typesetting with (1) XeLatex, (2) the Linux Libertine font, and (3) the language options "british" or "UKenglish".

To my untrained TeX eye, it seems that the problem arises because of the "british" or "UKenglish" language options. But "british", or "UKenglish", is the language option I have to use, and so I'm stuck. I just can't figure out why this is happening, or how to fix it.

I've included an MWE and attached a PNG image showing the issue. Of course, the MWE is just an 'example' document, but I get similar behaviour with other, 'real' documents. In the MWE the problem I'm seeing occurs in the first sentence of the second paragraph: it runs straight into the margin.

The LOG file indicates the following:
Overfull \hbox (9.32085pt too wide) in paragraph at lines 26–40
[]\EU1/LinuxLibertineO(0)/m/n/12 Of course our rewards and pleasures were as suddenly sweeping as our troubles;

Any help help anyone might be able to provide would be greatly appreciated.

Here is the MWE, and, below, the PNG image:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
%\usepackage{polyglossia}
%\setmainlanguage[variant=british]{english}    
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\usepackage{microtype}

\begin{document}

“[…]

With the sorrow of living so great, the sorrow of punishment had to be pitiless. We lived for the day and died for it. When there was reason and desire to punish we wrote our lesson with gun or whip immediately in the sullen flesh of the sufferer, and the case was beyond appeal. The desert did not afford the refined slow penalties of courts and gaols.

Of course our rewards and pleasures were as suddenly sweeping as our troubles; but, to me in particular, they bulked less large. Bedouin ways were hard even for those brought up to them, and for strangers terrible: a death in life. When the march or labour ended I had no energy to record sensation, nor while it lasted any leisure to see the spiritual loveliness which sometimes came upon us by the way. In my notes, the cruel rather than the beautiful found place. We no doubt enjoyed more the rare moments of peace and forgetfulness; but I remember more the agony, the terrors, and the mistakes. Our life is not summed up in what I have written (there are things not to be repeated in cold blood for very shame); but what I have written was in and of our life. Pray God that men reading the story will not, for love of the glamour of strangeness, go out to prostitute themselves and their talents in serving another race.

[…]”

(T.\ E.\ Lawrence, \emph{Seven Pillars of Wisdom})

\end{document}

Image showing issue.

Best Answer

The word sticks in the margin because latex can't find a suitable break point.

You can

  1. Add a hyphenation point with trou\-bles (locally) or globally:

    selectlanguage[variant=british]{english} \hyphenation{trou-bles}

  2. Allow latex to use more space e.g. by setting \emergencystretch (http://www.tex.ac.uk/cgi-bin/texfaq2html?label=overfull)

  3. Switch to lualatex which can do font expansion.