# Why is XeLaTeX Pushing British English Text into the Margins?

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}


• Fontspec replaces the fontenc package. Either use one or the other, not both! Things can get funny if you do. Mar 19 '15 at 14:05
• You Don't Have To Write Your Title That Way...
– Werner
Mar 19 '15 at 14:25
• Looks to me like a combination of hyphenation points and font size. TeX will sometimes 'give up' if there is no good point to do a break: that depends on the text, the font in use and the valid hyphenation points. Mar 19 '15 at 14:33
• I don't think the fonts are the issue, they are just required to show the issue. The question is whether british allows (or should) allow trou{-}bles (and you can see it recognizes the overfull line in the .log); with LuaTeX, the whole word is pushed to the next line. TeX tends to avoid hyphenating words of less than three syllabus, I think.
– jon
Mar 19 '15 at 14:38
• @MobiusPizza: fontspec doesn't replace fontenc, it actually loads it itself. And it is no problem to load fontenc yourself if you need more encoding definitions. But as the last encoding loaded with fontenc is the one active at the begin of the document the order you load the packages is important, normally fontspec should come last. Mar 19 '15 at 15:21

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.

• Op claimsif language is set to US English the problem vanishes, I wonder if UK English have fewer/worse hyphenation definitions. Mar 20 '15 at 0:14
• @Ulrike Fischer: Thank you. If only it could always be as easy as you make it sound! Mar 20 '15 at 10:50