TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've recently read through my \jobname.log files to spot errors in typography.

I came across this:

Overfull \hbox (6.8925pt too wide) in paragraph at lines 650--651
[][]\T1/cmtt/m/n/10 plot([][][]<functie>[], []col=<kleur>[], []lwd=<breedte van
 de geplotte lijn>[], []type=<type plot,

Underfull \hbox (badness 10000) in paragraph at lines 650--651
\T1/cmtt/m/n/10 zie hierboven>[], []xlab="<eenheid op de x-as>"[], []ylab="<een
heid op de y-as>"[], []main=[]

In the document this part of the document looks like

this (link).

In this case there are three options for me:

  1. Use \linebreak before the part of \textcolor{orange}{main=....
  2. Use \linebreak in the middle of main=... (current solution).
  3. Don't use any linebreaks.

All three solutions produce a message of both underfull as well as overfull hbox.

Is there a way to encourage LaTeX to linebreak within the environment to fix at least one of these errors? Or scale text, adjust boxes of characters, etc.

I've read through the existing questions and they all suggest linebreaking. In this environment that may be too much asked for, but I'd at least like to explore to possibilities to fix this in a special case (if a such special solution even exists - fingers crossed).

share|improve this question
lease help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr May 11 '14 at 2:03
up vote 4 down vote accepted

This stems from the fact that the typewriter font (\ttfamily) does not have any inter-word stretch or shrink. As such, it typically doesn't work well in getting a justified look. Stefan wrote a nice blog entry on this the TeXblog: Full justification with typewriter font. For completeness, I'll duplicate the discussion here:

enter image description here

  \item[slant] \the\fontdimen1\font
  \item[inter-word space] \the\fontdimen2\font
  \item[inter-word stretch] \the\fontdimen3\font
  \item[inter-word shrink] \the\fontdimen4\font
  \item[extra space] \the\fontdimen7\font
  \item[xspaceskip] \the\xspaceskip
  \item[hyphenchar] \the\hyphenchar\font

Note the 0.0pt inter-word stretch and shrink.

The suggestion is to add some inter-word stretch/shrink, and you may want to do this in general for the lines environment in your code screenshot. However, without a visual of how lines is written, I can only suggest that you add the following to the beginning of the environment:

\fontdimen3\font=0.2em% inter-word stretch
\fontdimen4\font=0.1em% inter-word shrink

and perhaps play around with the values.

share|improve this answer
\section{Default typesetting}

\section{With hyphenation}
\hyphenchar\font=`\-% to allow hyphenation

\section{With hyphenation and justification}
\fontdimen2\font=0.4em% interword space
\fontdimen3\font=0.2em% interword stretch
\fontdimen4\font=0.1em% interword shrink
\fontdimen7\font=0.1em% extra space
%\hyphenchar\font=`\-% to allow hyphenation

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.