2

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

?
12
  • 1
    Please add a complete minimal document (MWE) showing your problem instead of a snippet.
    – epR8GaYuh
    Feb 11, 2019 at 11:28
  • 1
    Regarding @epR8GaYuh comment, have a look at tex.meta.stackexchange.com/questions/228: Your code can not be executed as it is at the moment. People need to add surrounding code. This is considered bad practice here. Feb 11, 2019 at 12:41
  • 6
    You have Porosity (%). It probably should be Porosity (\%). Feb 11, 2019 at 12:50
  • 3
    @Yasamin Use the siunitx package for this sort of thing. Feb 11, 2019 at 13:02
  • 1
    @Yasamin: \num{2.196d-12} will improve the printing of numbers, use siunitx for this, as suggested by Will Robertson already
    – user31729
    Feb 11, 2019 at 14:10

2 Answers 2

6

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

7

In addition to fixing the obvious error -- remember that % in TeX and LaTeX is a comment character -- you should

  • do a better job of typesetting small numbers using exponential notation -- I suggest you use the \num macro of the siunitx package

  • do a better job of typesetting scientific units -- I suggest you employ the \si macro of the siunitx package and place the units on a line by themselves

  • allow a line break in at least one of the cell headers, to make the tabular material fit inside the width of the textblock. I suggest you load the tabularx package, use a tabularx environment instead of a tabular environment, and apply a centered version of the package's X column type to the final data column.

  • and, last but not least, don't load the obsolete txfonts package. Instead, load the newtxtext and newtxmath packages.

Also, do use fewer words in the caption and various cell headers.

enter image description here

\documentclass{article}
    \usepackage{tabularx}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \usepackage[skip=0.333\baselineskip]{caption}
    \usepackage{booktabs,siunitx}
    \usepackage{newtxtext,newtxmath} % 'txfonts' is obsolete

\begin{document}

\begin{table}
\caption{Estimated mass of Itokawa particles taking
         into account their porosity}
\label{Tab3}
\sisetup{round-mode=places,round-precision=3} % apply automatic rounding
\setlength\tabcolsep{3pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} l cccc C @{}}
\toprule
Sample & Silicate density
       & Volume
       & Estimated mass
       & Porosity
       & Estimated mass given porosity \\
       & (\si{g\per\micro\meter\cubed})
       & (\si{\micro\meter\cubed})
       & (g)
       & (\%) %% not (%)
       & (g)\\
\midrule
RA-QD02-0014 & \num{2.196e-12} & 125921 & \num{2.7652e-7} & 0.7 & \num{2.7458 e-7} \\
RA-QD02-0023 & \num{2.196e-12} & 781081 & \num{1.7153e-6} & 0.0 & \num{1.7153 e-6} \\
RA-QD02-0047 & \num{2.196e-12} & 148570 & \num{3.2626e-7} & 0.0 & \num{3.2626 e-7} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .