[Tex/LaTex] Tabular: Underfull \hbox (badness 10000) in paragraph at lines

badnessline-breakingspacingtableswarnings

I read all the questions regarding the error message Underfull \hbox (badness 10000) in paragraph at lines but I am still not sure if my code is correct. The problem is with the tabular of a table.

When I see the pdf, what I notice is that the first raw (the header) occupies more than one line and some words are cut, which is the behavior I do expect. So, my question is, should I ignore those warnings or should I fix something?

To reproduce the code:

\documentclass{article}

% Tables  
\usepackage{pdfpages}
\usepackage{longtable}
\usepackage{array} % for extrarowheight
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{ifthen}
\usepackage{xspace}
%\setlength{\extrarowheight}{1pt}
%\setlength{\tabcolsep}{1em}
\rowcolors{1}{black!10}{}

\newboolean{nextRetrait}
%\setboolean{french}{false}
\setboolean{nextRetrait}{false}

\newcommand{\retrait}
    {\ifthenelse{\boolean{nextRetrait}}%
       {\hspace{-3cm}}%
       {}}%


\begin{document}

\begin{center}
\begin{table*}[!ht]
{\small
\hfill{}
\centering
\scalebox{0.8}{
\retrait\begin{tabular}{|p{1.8cm}|p{1.2cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.4cm}|p{1.4cm}|p{1.4cm}|p{1.4cm}|p{0.6cm}|}
 \hline     
      \textbf{Application (swap unit)}
       &\textbf{Size (MB) before swapping}
      &\textbf{Objects before swapping}
       &\textbf{Size (MB) after swapping}
      &\textbf{Objects after swapping}
       &\textbf{Size (MB) after experiments}
      &\textbf{Objects after experiments}
      &\textbf{Average objects per graph}
      &\textbf{Average \% of shared objects per graph}
      &\textbf{Gain}
\\
\hline
XXX (class) & 22.7 &  469882 & 10.6 & 254696 & 13.8 & 317107 & 170 &17\% & 40\% \\
\hline
\end{tabular}}}
\hfill{}
\caption{XXX}
\label{tb:XXX}
\end{table*}
\end{center}

\end{document}

And the warnings:

Overfull \hbox (2.82243pt too wide) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Application

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 (swap

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Size

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 (MB)

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 be-fore

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 swap-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Objects

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 be-fore

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 swap-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Size

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 (MB)

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 af-ter

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 swap-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Objects

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 af-ter

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 swap-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Size

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 (MB)

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 af-ter

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 ex-per-i-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Objects

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 af-ter

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 ex-per-i-

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Average

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 ob-jects

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 per

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Average

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 % of

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 shared

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 ob-jects

Underfull \hbox (badness 10000) in paragraph at lines 49--49
\OT1/cmr/bx/n/9 per

Overfull \hbox (5.3494pt too wide) in paragraph at lines 49--49
[]|\OT1/cmr/bx/n/9 Gain| 

Overfull \hbox (57.22829pt too wide) in paragraph at lines 30--51
[]  []

Underfull \hbox (badness 10000) in paragraph at lines 30--51

Best Answer

You may want to set the headers ragged right: say

\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

in your preamble and use

\begin{tabular}{|P{1.8cm}|P{1.2cm}|P{1.3cm}|P{1.3cm}|P{1.3cm}|P{1.4cm}|P{1.4cm}|P{1.4cm}|P{1.4cm}|P{0.6cm}|}

You'll have to fine tune the width, as "Application" and "Gain" don't really fit.