无法使用 tabularx 去除未满的 \hbox(不良率 4886)

无法使用 tabularx 去除未满的 \hbox(不良率 4886)

我一直为这个问题而绞尽脑汁(其他的答案都不适合我),但是我无法摆脱这个未满的 \hbox(糟糕程度 4886 或 2111,取决于我是否使用实际的文本内容)用 tabularx 得到一个跨页面的完整文本宽度表格...我只想要一个很好的解决方案来显示一个 3 列表格,其中只有文本段落(最右边两列)和左边列中的名称。如下所示(我正在使用 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}

不管怎样,实际的 pdf 输出看起来不错,但显然我想在没有警告的情况下正确地完成它! 在此处输入图片描述

答案1

这是第一行第二个单元格的问题:由于这些单元格的宽度较短,LaTeX 有时难以在行尾处用连字符连接单词。Tommytom例如,如果您将第一个单元格的内容缩短为,则问题会消失。我建议在单元格开头加载ragged2e和使用。>[{\RaggedRight}X

比较是否有此指令:

        \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} 

在此处输入图片描述

相关内容