5

I got a "bad box" warning said `!h'

Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2707) in paragraph

The source code is

\begin{table}[!ht]
\caption{Comparison of design requirements for adults and children}
\footnotesize
\begin{center}
\begin{tabular}{|p{0.2\linewidth}|p{0.35\linewidth}|p{0.35\linewidth}|}
\hline \centering{Message} & \centering{Adults}  & \centering{Children} \tabularnewline 
\hline *M1-constraint-requirement-requirement-summary & ``The target user is an \textbf{adult}. Constraints - Ergonomics can be found in standard \textbf{XX1}.''& ``The target user is a \textbf{child}. Constraints - Ergonomics can be found in standard \textbf{XX2}.'' \tabularnewline 
\hline 
\end{tabular} 
\end{center}
\end{table}

and it looks like this enter image description here

I don't know what's going wrong in my case.

2
  • 3
    Welcome to TeX.SX! TeX is having problems in justification (that is in making lines of equal lengths) in those narrow columns. You probably want to use ragged right typesetting.
    – egreg
    Commented Nov 19, 2013 at 21:44
  • 1
    what egreg said, also note \centering does not take an argument: \centering{Adults} should be \centering Adults (the extra group is in this case harmless but doing northing) Commented Nov 19, 2013 at 23:34

1 Answer 1

7

The lines of the first cell of the second line doesn't fill the hbox-es (3 bad boxes). Same at the third cell for one line (1 bad box). Using \raggedright can make these bad boxes go away without the real change of output. This is because the box is small but the words are long: you can't really use justification when you have 1 word per line. (If you have a few words per line, you can try \sloppy.)

The last bad box is caused by the fact that your tabular is larger than the actual \hsize. That's because it is wider than the sum of the column widths. Using the showframe package, you can clearly see that in the example below (\raggedright already added, 1 bad box remaining). You can fix this by resizing a column or changing the column separation (or check this topic).

\documentclass{article}

\usepackage{showframe}

\begin{document}

\begin{table}[!ht]
\caption{Comparison of design requirements for adults and children}
\footnotesize
\begin{center}
\begin{tabular}{|p{0.2\textwidth}|p{0.35\textwidth}|p{0.35\textwidth}|}
\hline \centering{Message} & \centering{Adults}  & \centering{Children} \tabularnewline 
\hline \raggedright*M1-constraint-requirement-requirement-summary & \raggedright``The target user is an \textbf{adult}. Constraints - Ergonomics can be found in standard \textbf{XX1}.''& \raggedright``The target user is a \textbf{child}. Constraints - Ergonomics can be found in standard \textbf{XX2}.'' \tabularnewline 
\hline 
\end{tabular}
\end{center}
\end{table}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .