# Text is spilling over the margin with standard margin settings [duplicate]

I have default margin settings, but certain text is spilling over the margin boundary. It happens when the final word on the line includes a hyphen. For example, if eye-movement happens to be at the end of the line, this can break the margin boundary.

It doesn't happen very often, but frequently enough to be a eyesore.

Thanks for any tips.

## marked as duplicate by egreg line-breaking StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 18 '16 at 9:03

• The problem is a word with a hyphen can be broken only at that hyphen (may be there are exceptions). Just imagine reading eye-mo-vement! Either you try to force breaking precisely at that point, or you rephrase your sentence so that the problem disappears. – Bernard Jul 17 '15 at 16:48
• Could you provide us with an MWE please, so that we can have your text. That way, we won't have to construct some text with a line ending in 'eye-movement' ourselves. As you can imagine, that will save a lot of tedious messing about and make your question much more attractive to us to answer – Au101 Jul 20 '15 at 22:23
• Wait till the very end of your project, then revise the text slightly or insert manual breaks if absolutely necessary. – musarithmia Jul 20 '15 at 22:44
• Welcome! Make sure that you are are enabling hyphenation patterns for the correct language (in case TeX can find a break elsewhere) e.g. if you write in English, make sure you load patterns for the correct variant. Ensure that your text block has adequate width in terms of number of characters (i.e. not too narrow relative to the font size etc.). Try loading microtype. Problems like this are the exception rather than the rule so if you have several, something is either wrong or you have extreme typesetting requirements. – cfr Jul 21 '15 at 1:40

This might help:

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\sloppy % hyphenation for whole document
% use sloppypar environment for particular block of text
% no package is required

\begin{document}
text abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz eye-movement
\end{document}

• This solution doesn't work for me. The word sticks out into the margin. – musarithmia Jul 20 '15 at 22:16
• The problem is TeX can't break the word combination. Why would making it unbreakable by a second means help? – cfr Jul 21 '15 at 1:37
• The use of \sloppy for the entire document is not a good solution. I don't see that using T1 or lmodern is likely to make any difference. Could you explain how these are supposed to help in what appears to be an English language document? (T1 is recommended and lmodern is fine, although not my preference for LM support, so those are not bad suggestions - I just can't see why they'd help.) – cfr Jul 21 '15 at 20:53
• lmodern is the font I use with T1 encoding, it has nothing to do with hyphenation. Well, you could use sloppypar environment for hyphenation in certain parts of text. – Jitendra Kumar Jul 22 '15 at 3:38

You can use the solution from this question:

https://stackoverflow.com/questions/2193307/how-to-get-latex-to-hyphenate-a-word-that-contains-a-dash

\def\hyph{-\penalty0\hskip0pt\relax}
you can replace eye-movement with eye\hyph{}movement which will allow LaTeX to hyphenate the word even if it already contains a hyphen.