2

I am fixing my thesis template, and on the middle of it I found some texts are going out of the screen, randomly. After hours of work, I could narrow it down to a simple MWE, so I could post a question here asking about it:

\documentclass[10pt,openright,twoside,a5paper]{memoir}
\usepackage[english]{babel}

\usepackage[showframe]{geometry}
\setlength{\parindent}{1.6cm}

\begin{document}

\frenchspacing
\textbf{textbf: (encoding: T1, family: cmr, series: bx, shape: n, size: 10.5, baseline: 11.0pt)}

\end{document}

Why latex is letting the text goes out of the screen? How I can block latex from doing this?

enter image description here

 D:\test2.tex:10: Overfull \hbox (5.92477pt too wide) in paragraph at lines 10--11[]\OT1/cmr/bx/n/10 textbf: (en-cod-ing: T1, fam-ily: cmr, se-ries: bx, shape:
user
  • 4,745
  • 1
    You cannot prevent TeX from doing this, unfortunately. TeX is designed for producing beautiful paragraphs, and when it cannot do that it just throws an overfull box warning and expects you to fix it. You have to rewrite your text, or change the interword glue so that it has more stretch or shrink, etc. Or you can just increase \emergencystretch to a really large value to do this automatically when necessary — that guarantees no overfull boxes, at the risk of large spaces. I'm pretty sure this question is a duplicate though. – ShreevatsaR Aug 17 '17 at 03:50
  • 1
    Unfortunately the answers at the canonical question are hardly satisfactory. :-( – ShreevatsaR Aug 17 '17 at 04:20
  • 2
    @ShreevatsaR You can add an additional answer there, if you think you have a better one. – Schweinebacke Aug 17 '17 at 09:03

1 Answers1

1

How I can block latex from [letting the text go out of the screen]?

You have two principal options:

  • Issue the directive \sloppy immediately before the paragraph in question (and issue the directive \fussy at the start of the next paragraph. The interword distances will be much larger than TeX would normally consider to be acceptable. You may or may not find it acceptable, though.

  • Rewrite the paragraph suitably. E.g., if you change

    \textbf{textbf: (encoding: T1, family: cmr, series: bx, shape: n, size: 10.5, 
    baseline: 11.0pt)}
    

    to

    \textbf{textbf: (encoding: T1, family: cmr, series: bx, size: 10.5, shape: n, 
    baseline: 11.0pt)}
    

    i.e., if you interchange the "shape" and "size" items, the overfull line is gone.

Mico
  • 506,678