整理表格

整理表格

列(她的结果)必须位于列(我的结果)旁边 你好:我想将列(她的结果)拉到列(我的结果)旁边。有人可以帮帮我吗?MWE 是:

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

答案1

这是你的答案。

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

在此处输入图片描述

相关内容