1

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}

Margin failure

4
  • It’s just an overfull hbox warning.
    – Tommiie
    Commented Mar 27, 2019 at 13:05
  • @Tommiie Thank you, "unfortunately" I had not heard of that warning before. Increasing the pre-tolerance to \pretolerance=400 solved the issue globally. Commented Mar 27, 2019 at 13:39
  • Check the log after compiling your document. It might show you issues you didn't even spot. I personally would rather not hack at this with plain TeX commands like \pretolerance.
    – Tommiie
    Commented Mar 27, 2019 at 13:41
  • I wonder whether the package microtype can help for occurences like your first sentence...
    – Tommiie
    Commented Mar 27, 2019 at 13:43

1 Answer 1

1

LaTeX ordinary fact here in my opinion. I mean, LaTeX can't cut your text in a good way — I suppose we call it "cesure". You must type antislash minus to indicate the good way to cut your text.

5
  • Could you elaborate on "LaTeX ordinary fact"? I've never encountered it before writing this lengthy document, which lead me to believe it had to do something with the specified styling, but maybe I've been lucky all this time. Commented Mar 27, 2019 at 13:12
  • 2
    I think Chaurand means hyphenation not cut. LaTeX does not know how to hyphenation a work like theeeee... or jumpssssssss, you can help it by making syllables using \- or specify hyphenation for this word in the preamble using \hyphenation{the-e-e-e-e-e-e-e-e-e-e-e} (here it is just - marking syllables)
    – daleif
    Commented Mar 27, 2019 at 13:15
  • @daleif So why does it fail for the word "months" (first sentence), and how to solve it without relying on case-by-case solutions? Commented Mar 27, 2019 at 13:19
  • 1
    @JJMDriessen there is no way to hyphenate the work month. In this case LaTeX has two choices (remember it is trying to keep a straight right margin) (1) move month to the next page and stretch the remaining text (aka the space) between words, or (2) leave it hanging into the margins, telling the user there is an overfull hbox and the the user do rewrites. In this case the penalty/badness for stretching the line was larger than a certain threshold, so (2) was chosen.
    – daleif
    Commented Mar 27, 2019 at 13:23
  • 1
    Since the word "months" (which cannot be hyphenated) is involved, and if you can't easily rephrase the paragraph, you may need to try something more extreme, making the paragraph "sloppy". Look at this question for one possibility: How to avoid using \sloppy document-wide to fix overfull \hbox problems? Commented Mar 27, 2019 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .