I needed to do a table with 4 columns.The first has 2 cells. the second has 4 cells. The third is split into three different things. And, the fourth is split into 3 different things. I know how to do a table with four columns but do not know how to split a column. The pictures attached is exactly what I wanted to do. Note:The (her results) column is not shown in the picture attached but it should be identical to (my results) column.I do not know if my MWE would help or not. I could not know how![enter image description here][1] to do this table properly. Can anyone help? my MWE is:
\begin{table}[ht]
\caption{.} % title of Table
\centering % used for centering table
\begin{tabular}{c c c c} % centered columns (4 columns)
\hline\hline %inserts double horizontal lines
Metal thickness$(nm)$ & Metal width$(\mum)$ & My Results & Her Results\\ [0.5ex] % inserts table
%heading
\hline % inserts single horizontal line
25 & 8 & 1.447413 & 0.9627 & 2.128 \\ % inserting body of the table
After this question was solved by #egreg, I tried to add an extra column that is also composed of three parts like the (my results) column . However, I had an error.this is what I thought to be the way of adding an extra column in the code provided in the answer by egreg.
\newcommand{\splitcell}[1]{%
\begin{tabular}{@{}c@{}}\strut#1\strut\end{tabular}%
}
\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{6-8}
& &
{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
\end{tabular}
\end{table}
[1

multicolumn, play with it for a while, then have a look atmultirowand try to incorporate it slowly.... :) start small, and build up until you get closer :) – cmhughes Aug 13 '14 at 20:15