-1

This question already has an answer here:

column (her results) must be next to the column (my results) Hi: I wanted to pull the column (her results) up to be next to the column (my results). can someone help me please?. the MWE is:

\documentclass{article}
\usepackage{siunitx,booktabs,caption}


\newcommand{\splitcell}[1]{%
  \begin{tabular}{@{}c@{}}\strut#1\strut\end{tabular}%
}

\begin{document}

\begin{table}[htp]
\centering

\caption{The table caption}

\begin{tabular}{S[table-format=2.0] S[table-format=1.0] S[table-format=1.6] S[table-format=1.4] S[table-format=1.3]}

\toprule
{$t$ (\si{\nano\meter})} & {$W$ (\si{\micro\meter})} & \multicolumn{3}{c}{My results} \\
\cmidrule{3-5}
                         &                           & {Re}     & {\splitcell{Theor.\\Overlap\\factor}} & {\splitcell{Theor.\\MPA\\(\si{dB/mm})}} \\
\midrule
25                       & 8                         & 1.447413 & 0.9627                                & 2.128 \\
                         & 4                         & 1.446128 & 0.9538                                & 1.20  \\
\midrule
31                       & 8                         & 1.448499 & 0.9377                                & 4.196 \\
                         & 4                         & 1.446889 & 0.9571                                & 2.78  \\
\bottomrule
                         &                           & \multicolumn{3}{c}{Her results} \\
 \cmidrule{3-5} % 6-8
                         &                                 &                                      & {\splitcell{Theor.\\Overlap\\factor}} & {\splitcell{Theor.\\MPA\\(\si{dB/mm})}} \\
\midrule
25                       & 8                          &     & 0.9627                               & 2.128 \\
                         & 4                           &   & 0.9538                               & 1.20  \\
\midrule
31                       & 8                          &   & 0.9377                               & 4.196 \\
                         & 4                          &    & 0.9571                               & 2.78  \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

marked as duplicate by cfr, Mico, user31729, Paul Gessler, yo' Aug 14 '14 at 22:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    What exactly is the problem you're having? Should just be a matter of rearranging the input. – Paul Gessler Aug 14 '14 at 20:52
  • 2
    The simplest way is split content of your table into two tabular, something like this: \begin{table}\caption ...\begin{tabular}<stuff for my results>end{tabular}\begin{tabular}<stuff for her results>\end{tabular}\end{table}. Another way is reformat table, i.e. extend number of columns from 5 to 10. – Zarko Aug 14 '14 at 20:56
  • Zarko, I tried both ideas and could not get it. The column (her results) always appear below the table!!!. Could you past the solution code? – Naema Aug 14 '14 at 21:15
  • This question already has an answer here: wrote few minutes ago. – Aradnix Aug 14 '14 at 21:22
1

Here is your answer.

   \begin{table}[htp]
\centering

\caption{The table caption}

\begin{tabular}{S[table-format=2.0] S[table-format=1.0] S[table-format=1.6] S[table-format=1.4] S[table-format=1.3]|S[table-format=1.6] S[table-format=1.4] S[table-format=1.3]}

\toprule

         {$t$ (\si{\nano\meter})}     &  {$W$ (\si{\micro\meter})} & \multicolumn{3}{c}{Her results} & \multicolumn{3}{c}{My results} \\
 \cmidrule{3-8} % 6-8
                         &                                 &                                      & {\splitcell{Theor.\\Overlap\\factor}} & {\splitcell{Theor.\\MPA\\(\si{dB/mm})}} & {Re}     & {\splitcell{Theor.\\Overlap\\factor}} & {\splitcell{Theor.\\MPA\\(\si{dB/mm})}} \\
\midrule
25                       & 8                          &     & 0.9627                               & 2.128 & 1.447413 & 0.9627                                & 2.128 \\
                         & 4                           &   & 0.9538                               & 1.20  & 1.446128 & 0.9538                                & 1.20  \\
\midrule
31                       & 8                          &   & 0.9377                               & 4.196 & 1.448499 & 0.9377                                & 4.196 \\
                         & 4                          &    & 0.9571                               & 2.78  & 1.446889 & 0.9571                                & 2.78  \\ \bottomrule
\end{tabular}
\end{table}

enter image description here

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