[Tex/LaTex] Methods to resolve long line overflowing into margin

line-breakingmarginsspacing

My document sometimes has lines which slightly overflow into the margin, such as in the below example. I was wondering what different methods could resolve this issue, such as changing spacing between words, or forcing the last word to a new line. My text is justified, and I am suppressing hyphenation. If a general document-wide solution exists that I could just add to my preamble, that would be awesome, but various ad hoc solutions that resolve a single occurrence of the problem only would be quite fine too.

enter image description here

My clunky attempt at an MWE is below. It may be more superfluous than necessary, but it reproduces the problem.

\documentclass[a4paper,12pt]{book}
\usepackage{times}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

\usepackage{geometry}
\geometry{bindingoffset=5mm}
\geometry{margin=2.54cm}

\hyphenpenalty=100000
%\pretolerance=10000
\tolerance=2000 
\emergencystretch=10pt

\begin{document}

\mainmatter
\chapter{Test}
\section{Aaaaaaaaaaaaaa bbbbb ccc ddddddd eeeeeee fffffffffffff}
\lipsum[1]

\end{document}

Best Answer

To fix the issue of words in sectioning headers protruding into the right-hand margins, you could add the following two instructions to the preamble:

\usepackage{sectsty}
\allsectionsfont{\raggedright}

In general, if you absolutely do not want to permit hyphenation in the document, you could (a) issue the instruction \sloppy after \begin{document} (and be prepared to get some sloppy-looking paragraphs!) or (b) typeset the entire document ragged-right rather than fully justified.

Related Question