I'm making use of a provided custom class to write a dissertation (called dissertation.cls), which is based on the book class. I have found that it leads to sentences ignoring page margins on rare occassions (it occured 2 or 3 times in the 200+ page document).
I have stripped down the provided dissertation.cls in an attempt to find what causes the mistake, and to provide an MWE, shown below. I have then reproduced the error by finding example sentences that trigger the bug. I had to do this through trial-and-error, because it is not clear to me what causes te bug to be triggered (remember that I only found few occasions of this occurence in the 200+ page thesis). A page snippet of the resulting pdf is shown below the MWE, in which the first three out of four paragraphs fail to abide the margins.
How can I solve this issue, without affecting the specified style (i.e. as defined by the specified fonts, margins, paper size, etc. in the MWE below)?
Edit: In the example below, I'm aware that "theeeeeeeeeeeeeeee" and "jumpssssssssss" are non-existing words, and that LateX might have trouble finding proper hyphenation for them. However, the first sentence is a direct example copied from the thesis document, and it shows that failure occurs for the existing word "months", which should never be hyphenated (rather, it should be placed on the next line).
\documentclass[10pt]{book}
% \documentclass{dissertation} = a customized book class, and contains the following code that result in the margin errors:
\RequirePackage[printonlyused]{acronym}
\RequirePackage[pdftex]{geometry}
\RequirePackage{titletoc}
\RequirePackage{fourier}
\geometry{papersize={170mm,240mm}}
\geometry{hscale=0.75,vscale=0.8}
\begin{document}
\chapter{test}
% fail
Defining, implementing and understanding the optimisations have spanned several months.
% fail
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over theeeeeeeeeeeeeeee lazy dog.
% fail
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumpsssssssssss over the lazy dog.
% correct
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\end{document}
\pretolerance=400
solved the issue globally.\pretolerance
.microtype
can help for occurences like your first sentence...