[Tex/LaTex] Underfull \hbox (badness 10000) in paragraph for table

line-breakingtableswarnings

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.

Best Answer

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}