![无法使用 tabularx 去除未满的 \hbox(不良率 4886)](https://linux22.com/image/368353/%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%20tabularx%20%E5%8E%BB%E9%99%A4%E6%9C%AA%E6%BB%A1%E7%9A%84%20%5Chbox%EF%BC%88%E4%B8%8D%E8%89%AF%E7%8E%87%204886%EF%BC%89.png)
我一直为这个问题而绞尽脑汁(其他的答案都不适合我),但是我无法摆脱这个未满的 \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}
答案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}