段落中的 \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也被刪除。

在此輸入影像描述

編輯:使用新的列類型改進了程式碼。

相關內容