# Underfull \hbox (badness 10000) in .sty

I reasearched a lot of advice on the undefull box problem. But nothing I tried solved the problem. I wrote a .sty file for a certain formatting and get this warning for every occurrence of this markup:

\newcommand{\recordsAffected}[2]{%
\noindent This problem affects #1 record\s{#1}:

\vspace{3pt}

\setlength\parindent{0pt}{\tiny #2}
}


The code inside the .tex file looks like this, no linebreak anywhere, but it can contain many hundreds of numbers:

\recordsAffected{39}{123, 456, 789, 123, 456, 789, 123, 456, 789, 123, 456, 789, 123, 456}%


What am I doing wrong?

Minimal example:

\documentclass[a4paper]{scrartcl}
\sloppy         %improves justification, problem occured also without
\usepackage{my_possibly_dumb_package}

\begin{document}

\recordsAffected{39}{a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008, a56445/008, a57540/008, a57622/008, a57624/008, a57808/008, a60025/008, a61589/008, a61966/008, a69208/008, ocm02999106/008, ocm30263703/008, a40465/008, a40629/008, ocm02573713/008, ocm27892685/008, ocm04943922/008, ocm09696410/008, ocm08401480/008, ocm19374238/008, ocm04445359/008, ocm10964101/008, ocm12302731/008, ocm06112303/008, ocm08717325/008, ocm23645394/008, ocm23400177/008, a69971/008}%

\end{document}


Warning:

    Underfull \hbox (badness 4647) in paragraph at lines 7--8
[]\T1/ptm/m/n/6 a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49
581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008
,
[]

• No. No \\ anywhere. But I will try to provide the full example, should have already. The warning refers to this tag though.
– ena
Mar 24 '16 at 20:03
• @ena: How about using a \raggedright output rather than justified? Here's a suggested output.
– Werner
Mar 24 '16 at 20:39

The posted example gives an error for \s but I guessed a definition for that.

I used \raggedright here to avoid over/underfull boxes.

I added a missing \par at the end of the scope for \tiny so that the matching baselineskip is used, rather than the normal baselineskip.

\usepackage{my_possibly_dumb_package}

\begin{document}

\recordsAffected{39}{a43278/008, a43942/008, a45969/008, a46754/008, a49221/008, a49581/008, a49622/008, a52060/008, a52125/008, a52127/008, a52435/008, a55814/008, a56445/008, a57540/008, a57622/008, a57624/008, a57808/008, a60025/008, a61589/008, a61966/008, a69208/008, ocm02999106/008, ocm30263703/008, a40465/008, a40629/008, ocm02573713/008, ocm27892685/008, ocm04943922/008, ocm09696410/008, ocm08401480/008, ocm19374238/008, ocm04445359/008, ocm10964101/008, ocm12302731/008, ocm06112303/008, ocm08717325/008, ocm23645394/008, ocm23400177/008, a69971/008}%

\end{document}


\def\s#1{%
\ifnum#1>1 s\fi
}

\newcommand{\recordsAffected}[2]{%
\noindent This problem affects #1 record\s{#1}:%

\vspace{3pt}%

{\raggedright\tiny#2\par}%
}


Or if you want justified paragraph with inter word spaces allowed to stretch to cope then replace

{\raggedright\tiny#2\par}%


by

{\parindent0pt \spaceskip .3em plus\textwidth \tiny#2\par}%


• Thank you very much! (And sorry for forgetting the \s definition.) Though, I really prefer the aligned version, visually. At the moment, I just ignore warnings with -interaction=nonstopmode (but this is a messy copout).
– ena
Mar 25 '16 at 14:03
• @ena tex doesn't stop on warnings so -interaction not really doing anything in that case. If you prefer stretching the white space to maintain alignment then TeX will not complain so long as you tell it that you want the white space to stretch. None of the constraints are built in they are user-set. I updated the answer with a version for justified paragraph setting. Mar 25 '16 at 14:12
• Thank you for the idea. I think, the problem is that my record lists are very long (sometimes several pages, didn't want to clutter the minimal example like that) and then the badness 1000 does stop the processing (many many times, always giving line numbers of this very command). If whitespace stretching is the problem, shouldn't this already be gone using \sloppy (aka 3em)? I will experiment a bit more around whitespace, the suggestion still outputs warnings. Thanks again.
– ena
Mar 27 '16 at 13:28
• @ena No. TeX does not stop on badness warnings or pause for user interaction in any way, they are simply warning messages sent to the terminal and log file. You can not possibly get underfull warnings with that space setting unless some of your numbers are more than half the text width, so that you can only fit one on a line, in which case you can not do a justified setting so a warning is approprate, or use the ragged setting. Mar 27 '16 at 13:44