TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Due to zero stretch in \ttfamily the lines get Underfull \hbox (badness 10000) often. I would like to ignore these, still being informed about other badnesses in the same paragraph. See the example:


\usepackage[latin]{babel} % latin hyphenation

% this allows description label to spread multiple lines

% change column width to show the issue

\hbadness1750 % we allow a bit larger \hbadness in the twocolumn mode

% my macro to print TeX code snippets



\item[\printTeX{\\newcommand\'\{<command>\}\'[<num args>]\'[<opt arg default>]\{<expansion>\}}] --- 
In accumsan egestas est, vestibulum gravida nibh adipiscing in.
Maecenas fringilla porta dolor quis bibendum.
Nulla arcu libero, pharetra nec semper et, tempus a purus.
Nullam non mi sed nulla accumsan varius.
Nulla sit amet mi urna, eu cursus nunc.
Nunc et justo eros, sed vehicula felis.
Nulla aliquet turpis accumsan leo auctor facilisis aliquam lectus sagittis. 


Plus text \ldots


It produces three "badness", I would like the first to be ignored (i.e. not even mentioned in the log) but the following two still shown.

Underfull \hbox (badness 10000) in paragraph at lines 27--35
     \OT1/cmtt/m/n/10 \newcommand{<command>}[<num-args>][<opt-

Underfull \hbox (badness 10000) in paragraph at lines 27--35
\OT1/cmtt/m/n/10 arg-default>]{<expansion>} \OT1/cmr/m/n/10 --- In ac-cu-

Underfull \hbox (badness 1783) in paragraph at lines 27--35
\OT1/cmr/m/n/10 m-san ege-stas est, ve-sti-bu-lum gra-vi-da ni-bh
share|improve this question
up vote 3 down vote accepted

One way could be to allow some variability in the interword spacing:

  \begingroup\ttfamily\spaceskip=.5em plus .1em minus .05em
  \def\\{\char`\\ }%
  \def\{{\char`\{ }%
  \def\}{\char`\} }%

However, lines like those are quite problematic when they don't fit a line: they should be split in some good place that doesn't spoil the understanding of the syntax you're trying to illustrate. So probably manual intervention is the best strategy for getting a decent result.

The problem of "hiding" the message has only one solution: avoiding the underfull line to begin with. The messages are produced when TeX has finished typesetting the paragraph, and it can't distinguish the underfull lines you don't care of.

share|improve this answer
oh ok, my fault, I should have specified it better: I would like the message to disappear, not the underfull box... – yo' Jun 20 '12 at 15:32
@tohecz I don't think it's a good idea: you don't really need to have the typewriter type characters aligned over each other. However, the message is generated when the paragraph is being output, so if you have the two for the "normal part", you have also the first one. – egreg Jun 20 '12 at 16:08
On the other hand, I prefer \raggedright over large interword spaces, and it happens to me that the line contains no spaces at all... – yo' Jun 20 '12 at 20:54
I thought it might be possible to insert some skip at the end of a given line, which could be 0pt plus 1fil in this case -- that would leave the line as is and the badness would disappear. – yo' Jun 20 '12 at 20:56
@tohecz You have to do it manually. I tried with combinations of \hfil\penalty X\hfilneg inserted between the "arguments", but did not succeed. I'll try again. – egreg Jun 20 '12 at 21:00

After some discussion and hints from @egreg, I came to a good-working solution:

\def\ {\' }%

The only workaround is that one has to use \<space> instead of simple <space>, since <space> will produce un-breakable space.

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.