2

I'm getting the warning message

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

I guess it is related with spacing between the words Sums of squares, but I don't know how to fix it. I'm also having trouble with \hline at the end of the table.

\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}
  • By the way, there's a missing \begin{document} and \end{document}. – quark67 Mar 14 '19 at 2:47
  • Off topic: I'd use $\mathbf{Prob > F}$. – Sigur Mar 14 '19 at 2:48
  • note that \centering does not take an argument so \centering{1} should be \centering 1 but better would be just to specify this is a centered column, and use simply 1 – David Carlisle Mar 14 '19 at 9:10
4

I would exploit siunitx without guessing what the column widths should be.

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

I removed all boldface, as it is not really necessary: headers already have their prominence.

enter image description here

  • 1
    Thanks! It worked. – Luciana May 28 '19 at 19:15
1

I suggests this slight adjustment to the code (with a suggestion from Sigur embedded):

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

All overfull and underfull warnings are gone. Also, an error in the last \hline is removed.

enter image description here

Edit : improved code with a new column type.

  • Thanks! It worked. – Luciana May 28 '19 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.