![tabularx 中的段落中的 \hbox 未满(不良率 10000)](https://linux22.com/image/374814/tabularx%20%E4%B8%AD%E7%9A%84%E6%AE%B5%E8%90%BD%E4%B8%AD%E7%9A%84%20%5Chbox%20%E6%9C%AA%E6%BB%A1%EF%BC%88%E4%B8%8D%E8%89%AF%E7%8E%87%2010000%EF%BC%89.png)
我知道这个问题已经被广泛讨论了,但是我尝试了一些解决方案,但没有奏效;我看到一些帖子说解决这个问题的最好方法是共享代码,因为它非常具体,所以我在这里!
正如您从标题猜到的那样,在编译表格时我收到错误:
Underfull \hbox (badness 10000) in paragraph
我真的不知道如何解决它。有些帖子说它来自\\
但如果我删除它们,我就没有下划线,错误仍然会发生!
\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}
感谢您的阅读!祝您有美好的一天!PS:我使用 TeXstudio(如果真的很重要的话)
答案1
这是由于列太窄造成的,如果你把文本设置得更整齐,看起来会更好
\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}
“未满的水平盒子”意味着行中的空白被拉伸太多,在这种情况下,由于一行只能有两个单词,在许多情况下,它们之间的单个空格被过度拉伸以调整文本,将其设置为 raggedright 可以避免这种情况。
此处与误用\\
无关。人们经常将 放在\\
段落末尾,出于技术原因,这会强制段落后出现一个完全空的行,然后该行会被拉伸到全宽,并给出与您情况相同的未满水平框警告。