[Tex/LaTex] ! Misplaced \noalign. \midrule ->\noalign

equationstables

This is the table

\documentclass{article}  
    \usepackage{array}  
        \newcolumntype{C}{>{$}c<{$}} 
        \usepackage[skip=0.333\baselineskip]{caption}
        \usepackage{booktabs,
                    amsmath,  
                    siunitx} 
        \usepackage{txfonts}   
        \begin{document} 

            \begin{table}
                  \caption{Estimated mass of the three Itokawa particles with taking into account their porosity}
                     \label{Tab3}
                    \centering
                     \begin{tabular}{@{} l CCCCC @{}}
                        \toprule
                        Sample      &   Silicate density (g/ (\mu m^3))  &  Volume (\mu m^3)    & Estimated mass (g)    & Porosity (%) &    Estimated mass with considering the porosity (g) \\
                          \midrule
                      RA-QD02-0014      &  2.196 \times 10^(-12) &  125921  &2.7652 \times10^(-7)    &  0.7  &               2.7458 \times 10^(-7)  \\
                     RA-QD02-0023       &  2.196  \times 10^(-12)   &    781081   &     1.7153 \times10^(-6)    &    0.0    &       1.7153 \times 10^(-6)     \\
                     RA-QD02-0047       &    2.196  \times 10^(-12)  &  148570  &   3.2626\times 10^(-7)    &    0.0    &        3.2626 \times 10^(-7)  \\
                \bottomrule
                \end{tabular}
               \end{table}
        \end{document}

and the error

! Misplaced \noalign.
\midrule ->\noalign 
                    {\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global \@...
l.283               \midrule

?

Best Answer

You should use siunitx facilities. I suggest a legend for the table columns, instead of those long headers.

\documentclass{article}  
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,amsmath,siunitx} 
\usepackage{newtxtext,newtxmath}% better than txfonts   

\sisetup{per-mode=symbol}

\begin{document} 

\begin{table}[htp]

\caption{Estimated mass of the three Itokawa particles with taking into account their porosity}
\label{Tab3}
\centering
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l
  S[table-format=1.3e-2]
  S[table-format=6.0]
  S[table-format=1.4e-1]
  S[table-format=1.1]
  S[table-format=1.4e-1]
  @{}
}
\toprule
Sample  &
{SD (\si{\gram\per\micro\meter\cubed})} &
{V (\si{\micro\meter\cubed})} &
{EM (\si{\gram})} &
{P (\%)} &
{EMP (\si{\gram})} \\
\midrule
RA-QD02-0014 & 2.196e-12 & 125921 & 2.7652e-7 & 0.7 & 2.7458e-7 \\
RA-QD02-0023 & 2.196e-12 & 781081 & 1.7153e-6 & 0.0 & 1.7153e-6 \\
RA-QD02-0047 & 2.196e-12 & 148570 & 3.2626e-7 & 0.0 & 3.2626e-7 \\
\bottomrule
\addlinespace
\multicolumn{6}{@{}l@{}}{SD: Silicate density; V: Volume; EM: Estimated mass; P: Porosity;}\\
\multicolumn{6}{@{}l@{}}{EMP: Estimated mass with considering the porosity} \\
\end{tabular*}

\end{table}

\end{document}

enter image description here

Related Question