1

Been tearing my hair out with this one (and none of the other answers work for me) but I can't get rid of this underfull \hbox (badness 4886 or 2111 depending on whether I play with the actual text content) with tabularx for a full textwidth table across the page... I just want a nice solution to display a 3 col table with only paragraphs of text in it (far two right cols) and a name in the left col. As follows (I am using sharelatex):

\begin{table}[ht]
\centering
\begin{tabularx}{\linewidth}{lXX}
    \toprule
    Name & Their Description & Functions \\ \midrule
    Tommytommy & "I describe myself as fantastic obviously. Like, really fantastic." & This person is correct, they are fantastic and, like, really smart. We could go on a whole bunch but we will stop. \\
    Jerome & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart. \\
    Lindsay & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart (really really smart, actually). \\
    Helen & "I like to talk a lot so will avoid this question until I absolutely have to admit that I am fantastic just like all the rest, obviously." & This person is correct, and they even gave it lots of consideration -- they are fantastic and, like, really smart. \\ \bottomrule
\end{tabularx}
\caption{My caption}
\label{rage-table}
\end{table}

For what it's worth, the actual pdf output looks fine but obviously I want to do it right with no warnings! enter image description here

1
  • You can try \usepackage{microtype} but beside this, the only way to avoid all underfull warnings in such small columns is to typeset the columns ragged right. Jan 8, 2018 at 15:48

1 Answer 1

2

This comes from the second cell in the first row: as theses cells have a short width, LaTeX sometimes has difficulties in hyphenating words at the end of lines. The problem disappears ifyou shorten the contents of the first cell to Tommytom, for instanc. I suggest loading ragged2e and using >[{\RaggedRight} at the beginning of the X cells.

Compare with and without this directive:

        \documentclass{article}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
    %\usepackage{geometry}
    \usepackage{ragged2e}
        \usepackage{tabularx, booktabs}
        \begin{document}

    \begin{table}[!ht]
    \centering
    \begin{tabularx}{\linewidth}{lXX}
        \toprule
     Name & Their Description & Functions \\ \midrule
     Tommytommy
    & "I describe myself as fantastic obviously. Like, really fantastic." & This person is correct, they are fantastic and, like, really smart. We could go on a whole bunch but we will stop.
     \\
        Jerome & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart. \\
        Lindsay & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart (really really smart, actually). \\
        Helen & "I like to talk a lot so will avoid this question until I absolutely have to admit that I am fantastic just like all the rest, obviously." & This person is correct, and they even gave it lots of consideration -- they are fantastic and, like, really smart. \\ 
\bottomrule
    \end{tabularx}
    \caption{My caption}
    \label{rage-table}
    \end{table}

    \begin{table}[!ht]
    \centering
    \begin{tabularx}{\linewidth}{l>{\RaggedRight}X>{\RaggedRight\arraybackslash}X}
        \toprule
     Name & Their Description & Functions \\ 
\midrule
     Tommytommy
    & "I describe myself as fantastic obviously. Like, really fantastic." & This person is correct, they are fantastic and, like, really smart. We could go on a whole bunch but we will stop.
     \\
        Jerome & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart. \\
        Lindsay & "I describe myself as fantastic obviously." & This person is correct, they are fantastic and, like, really smart (really really smart, actually). \\


Helen & "I like to talk a lot so will avoid this question until I absolutely have to admit that I am fantastic just like all the rest, obviously." & This person is correct, and they even gave it lots of consideration -- they are fantastic and, like, really smart. \\


    \bottomrule
    \end{tabularx}
    \caption{My caption}
    \label{rage-table}
    \end{table}

    \end{document} 

enter image description here

2
  • This looks really helpful -- any chance you can edit the formatting of your code as some of it has slipped in before the code formatting answer and I want to make sure I get it spot on correct when I try :)
    – ratuk_
    Jan 8, 2018 at 17:02
  • YES -- It works! Beautiful! Thank you <3
    – ratuk_
    Jan 8, 2018 at 17:05

You must log in to answer this question.

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