段落中的 \hbox 未满(不良程度 3148)

段落中的 \hbox 未满(不良程度 3148)

我收到了警告信息

Underfull \hbox (badness 3148) in paragraph at lines xxx-xxx

我猜想这与单词“平方和”之间的间距有关,但我不知道如何修复它。我在表格末尾使用 \hline 时也遇到了麻烦。

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

% Table preamble
\usepackage{array}
\usepackage{siunitx}

\begin{table}[ht]
    \centering
    \caption{ANOVA for the quadratic model for the retention factors of lycopene, beta-carotene and coenzyme Q10.}
    \vspace*{5mm}
    \label{Table2}
    \begin{tabular}{p{3.2cm}p{1.9cm}p{0.7cm}p{2.9cm}p{1.8cm}p{1.8cm}}
    \hline
    \textbf{Source} & \textbf{Sums of squares} & \textbf{DF} & \textbf{Mean square} & \textbf{F value} & \textbf{Prob$>$ F}\\
    \hline
    \multicolumn{6}{c}{\textbf{Lycopene}}\\
    \hline
    \textbf{Model} & \centering{0.46} & \centering{9}  & \centering{0.052} &\centering{329.29} & $<$ 0.0001\\
    \textbf{A-Pressure} & \centering{0.10} & \centering{1}  &\centering{0.10} & \centering{641.24} & $<$ 0.0001\\
    \textbf{B-Temperature} & \centering{0.012} & \centering{1}  &\centering{0.012} & \centering{75.20} & $<$ 0.0001\\
    \textbf{C-C$_{E}$} & \centering{0.32} & \centering{1}  &\centering{0.32} & \centering{2034.60} & $<$ 0.0001\\
    \textbf{AB} & \centering{0.011} & \centering{1}  &\centering{0.011} & \centering{72.08} & $<$ 0.0001\\
    \textbf{AC} & \centering{\num{6.9e-3}} & \centering{1} & \centering{\num{6.9e-3}} & \centering{43.94} & $<$ 0.0001\\
    \textbf{BC} & \centering{\num{2.9e-3}} & \centering{1} &\centering{\num{2.9e-3}} & \centering{18.34} & \centering{0.0020}\\ 
    \hline
    \end{tabular}
\end{table}

答案1

我会充分利用它,siunitx而无需猜测列宽应该是多少。

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}

\newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}

\begin{document}

\begin{table}[htp]
\centering

\caption{ANOVA for the quadratic model for the retention factors of 
  lycopene, beta-carotene and coenzyme Q10.}\label{Table2}

\medskip

\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l
  S[table-format=1.3e-1,table-align-exponent=false]
  c
  S[table-format=1.3e-1,table-align-exponent=false]
  S[table-format=4.2]
  S[table-format=1.4,table-comparator]
  @{}
}
\toprule
Source & {\splitcell{Sums of \\ squares}} & {DF} &
 {\splitcell{Mean \\ square}} & {$F$ value} & {Prob $>F$}\\
\midrule
\multicolumn{6}{@{}c@{}}{\textit{Lycopene}}\\
\addlinespace
Model         & 0.46   & 9 & 0.052  &  329.29 & < 0.0001 \\
A-Pressure    & 0.10   & 1 & 0.10   &  641.24 & < 0.0001 \\
B-Temperature & 0.012  & 1 & 0.012  &   75.20 & < 0.0001 \\
C-C$_{E}$     & 0.32   & 1 & 0.32   & 2034.60 & < 0.0001 \\
AB            & 0.011  & 1 & 0.011  &   72.08 & < 0.0001 \\
AC            & 6.9e-3 & 1 & 6.9e-3 &   43.94 & < 0.0001 \\
BC            & 2.9e-3 & 1 & 2.9e-3 &   18.34 &   0.0020 \\
\bottomrule
\end{tabular*}

\end{table}

\end{document}

我删除了所有粗体,因为它不是真正必要的:标题已经很突出了。

在此处输入图片描述

答案2

我建议对代码进行轻微的调整(参考了 Sigur 嵌入的建议):

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

% Table preamble
\usepackage{array}
\usepackage{siunitx}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}


\begin{table}[ht]
    \centering
    \caption{ANOVA for the quadratic model for the retention factors of lycopene, beta-carotene and coenzyme Q10.}
    \vspace*{5mm}
    \label{Table2}
    \begin{tabular}{m{3.2cm}M{1.9cm}M{0.65cm}M{2.2cm}M{1.35cm}M{1.86cm}}
    \hline
    \textbf{Source} & \textbf{Sums of squares} & \textbf{DF} & \textbf{Mean square} & \textbf{F value} & $\mathbf{Prob > F}$\\
    \hline
    \multicolumn{6}{c}{\textbf{Lycopene}}\\
    \hline
    \textbf{Model} & 0.46 & 9  & 0.052 & 329.29 & $<$ 0.0001\\
    \textbf{A-Pressure} & 0.10 & 1  &0.10 & 641.24 & $<$ 0.0001\\
    \textbf{B-Temperature} & 0.012 & 1  &0.012 & 75.20 & $<$ 0.0001\\
    \textbf{C-C$_{E}$} & 0.32 & 1  &0.32 & 2034.60 & $<$ 0.0001\\
    \textbf{AB} & 0.011 & 1  &0.011 & 72.08 & $<$ 0.0001\\
    \textbf{AC} & \num{6.9e-3} & 1 & \num{6.9e-3} & 43.94 & $<$ 0.0001\\
    \textbf{BC} & \num{2.9e-3} & 1 &\num{2.9e-3} & 18.34 & 0.0020\\ 
    \hline
    \end{tabular}
\end{table}

\end{document}

所有过满和欠满警告均已消失。此外,最后一个错误也\hline被删除。

在此处输入图片描述

编辑:使用新的列类型改进了代码。

相关内容