0

I read many threads on this forum and spent a lot of time to solve this problem, unfortunately, no matter how much I try, I haven’t fixed it yet. I could draw the table below before, with my latex codes. My aim is to draw the same table again.

The related table

But now, by using the same codes shown below, I have received this error:

“! Misplaced \omit. \multispan ->\omit “

 \begin{table}\centering
\begin{adjustbox}{width=0.45\textwidth}

\begin{tabular}{@{}rrrc|rrr|cr|@{}}  
\hline  \\ [-4ex]  
& \multicolumn{3}{c}{\textbf{Mix Rate}} & \multicolumn{3}{c}{\textbf{Mutation factor}}  & \multicolumn{2}{c}{\textbf{Crossover probability}} \\

\textbf{Dimensions} & $Mean$ & $Std$ && $Mean$ & $Std$  && $Mean$ & $Std$  \\ \midrule[0.5pt]

\multicolumn{1}{l}{\textbf{30}}          & 0.550 & 0.091  && 0.519 & 0.089 && 0.599 &0.133  \\

\multicolumn{1}{l}{\textbf{50}}          & 0.549 & 0.076  && 0.521 & 0.094 && 0.565 &0.125  \\

\multicolumn{1}{l} {\textbf{100}}        & 0.609 & 0.085  && 0.529 & 0.093 && 0.504 &0.135  \\

\bottomrule

\end{tabular} \end{adjustbox}

 \end{table}

I would really appreciate it if anyone could help me to fix this problem. Many thanks in advance.

4
  • Welcome to TeX.SX! You have several end-of-row markers \\\ in your code, while \\ is the correct one. \\\ is parsed as two commands \\ and \<space>, where the latter expands to a fixed size space character. This breaks the following \multicolumn command, as this has to be (if used at all) the very first thing in a tabular cell.
    – siracusa
    May 31, 2019 at 5:37
  • Sorry, my misspelling. I edited the codes, but they don't work. Believe me, I could draw the table by using the same codes in the past. But today, I have received the error.
    – YcK
    May 31, 2019 at 5:45
  • This should never have worked.
    – Johannes_B
    May 31, 2019 at 6:54
  • Your code compiles fine for me when wrapped in a document that loads adjustbox and booktabs. Could you please extend your code to include your preamble as well, i.e. make it a full MWE?
    – siracusa
    May 31, 2019 at 17:33

1 Answer 1

1
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}\centering
\begin{tabular}{lS[table-format=1.3]
S[table-format=1.3]S[table-format=1.3]S[table-format=1.3]S[table-format=1.3]S[table-format=1.3]S[table-format=1.3]}
\toprule
& \multicolumn{2}{c}{\textbf{Mix Rate}} & \multicolumn{2}{c}{\textbf{Mutation factor}}  & \multicolumn{2}{c}{\textbf{Crossover probability}} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}
\textbf{Dimensions} & {Mean} & {Std} & {Mean} & {Std}  & {Mean} & {Std}  \\ \midrule
\textbf{30}          & 0.550 & 0.091  & 0.519 & 0.089 & 0.599 &0.133  \\
\textbf{50}          & 0.549 & 0.076  & 0.521 & 0.094 & 0.565 &0.125  \\
\textbf{100}        & 0.609 & 0.085  & 0.529 & 0.093 & 0.504 &0.135  \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
2
  • Thank you for your great effort, but these codes don't work for me due to "siunitx "package, in which latex does not find this package, getting the error of "! LaTeX Error: File `siunitx.sty' not found."
    – YcK
    May 31, 2019 at 7:22
  • 1
    @yck You need to install the package using the package manager.
    – Johannes_B
    May 31, 2019 at 7:24

You must log in to answer this question.

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