0

I know this problem is largely discussed but I tried some solution which did not work; and I saw some post saying that the best for this problem is to share the code because it is very specific so here I am !

As you guessed from the title, when compiling a table I get the error :

Underfull \hbox (badness 10000) in paragraph

And I don't really know how to solve it. Some post say it comes from the \\but if I delete them, I don't have the underline and the error still occur !

\begin{table}
    \centering
    \begin{tabularx}{\textwidth}{|c|c|X|X|X|X|}
        \hline 
        - & Top gem & A & B & C & D \\ \hline 
        Surface quality & Flawless & 90\% flawless, 10\% light defects and up to 2 defects & 70\% flawless, 30\% light defects and up to 2 deep defects & 40\% flawless, 60\% light defects and up to 10\% deep defects defects & More than 60\% light defects and up to 20\% deep defects defects \\ \hline 
        Lustre & Excellent & Very good at least & Good at least & Medium at least & Low at least \\ \hline 
    \end{tabularx} 
\end{table}

Thanks you for reading ! And have a good day ! PS : I use TeXstudio (If it really matters)

6

It is caused in this case by the narrow columns, if you set the text ragged right it looks better

\documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{table}
    \centering
    \begin{tabularx}{\textwidth}{|c|c|>{\raggedright\arraybackslash}X|>{\raggedright\arraybackslash}X|>{\raggedright\arraybackslash}X|>{\raggedright\arraybackslash}X|}
        \hline 
        - & Top gem & A & B & C & D \\ \hline 
        Surface quality & Flawless & 90\% flawless, 10\% light defects and up to 2 defects & 70\% flawless, 30\% light defects and up to 2 deep defects & 40\% flawless, 60\% light defects and up to 10\% deep defects defects & More than 60\% light defects and up to 20\% deep defects defects \\ \hline 
        Lustre & Excellent & Very good at least & Good at least & Medium at least & Low at least \\ \hline 
    \end{tabularx} 
\end{table}
\end{document}

an "underfull hbox" means that the white space in lines has been stretched to much, in this case as you could only get two words on a line in many cases the single space between them was being over-stretched to justify the text, setting it raggedright avoids that.

The relation to mis-use of \\ doesn't apply here. People often put \\ at the end of a paragraph, for technical reasons that then forces a completely empty line after the paragraph which is then stretched to full width and gives the same underfull hbox warning as in your case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.