How to center text in a multicolumn table?

I have created a multi column table. However, I am unable to centered alignment the text. For example, I want the W and N1 position where the red arrow located. Also, is it possible to position the header Study, Method and Dataset at the middle, as shown in the red font.

Thanks in advance for the time spent entertaining this problem.

\documentclass[journal]{IEEEtran}
\bibliographystyle{IEEEtran}
% *** CITATION PACKAGES ***
\usepackage{cite}
\usepackage{multirow, makecell}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\usepackage{booktabs,siunitx,showframe}
\sisetup{table-format=2.1}

\begin{document}

\begin{table*}
\caption{Some caption}
\scriptsize
\centering
% 19 COL
\begin{tabular}{p{0.4cm}p{1.5cm}p{0.1cm}p{0.1cm}
p{0.3cm}p{0.3cm}p{0.4cm}p{0.4cm}
p{0.4cm}p{0.4cm}p{0.4cm}p{0.4cm}
p{0.4cm}p{0.4cm}p{0.4cm}p{0.4cm}
p{0.4cm}p{0.4cm}p{0.4cm}}

\toprule
%       & \multicolumn{8}{c}{\bfseries Emissions} \\
%       \cmidrule(lr){2-9}
\multicolumn{1}{c}{Study}
&\multicolumn{1}{c}{Method}
&\multicolumn{1}{c}{\makecell[tc]{Num. of\\ subjects}}
&\multicolumn{1}{c}{Dataset}
& \multicolumn{5}{c}{Overall metrics}
& \multicolumn{5}{c}{Class-wise sensitivity}
& \multicolumn{5}{c}{Class-wise sensitivity} \\
\cmidrule(lr){5-9}
\cmidrule(lr){10-14}
\cmidrule(lr){15-19}

&&&
& {Acc.}
& {$\kappa$}
& {MF1}
& {Sens.}
& {Spec.}
%%% Class-wise sensitivity
& {W}
& {N1}
& {N2}
& {N3}
& {REM}
%%% Class-wise selectivity
& {W}
& {N1}
& {N2}
& {N3}
& {REM}\\
\midrule

\cite{Mendonca2019} & {ARNN +RNN}    & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &{--} & 98.00  \\
\cite{Mendonca2019} & {ABC}    & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
\cite{Mendonca2019} & {ABC}    & {90}& {test} & 98.00 & 98.00 & 98.00 & {--} & {--}   & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
\bottomrule
\end{tabular}
\end{table*}

\end{document}

• You can use \multicolumn{1}{c}{\multirow{4}{*}{Study}} and \multicolumn{1}{c}{W}. – leandriis Jul 2 '19 at 6:55
• Apart from that, you will have o replace $ by [ and $ by ] to make your code compilable. Lastly, your code will throw a lot of overfull box warnings due to your usage of p type columns with widths that are too narrow. Is there any reason why you dindt implement the suggestions to your previous question? – leandriis Jul 2 '19 at 6:58
• Hi Leandriis, Thanks once again for entertaining my thread here. I just want to explore another approach. But turn out, the previous approach in the previous thread produce better table – polosepian Jul 2 '19 at 7:09
• I've taken the liberty of editing your code to get rid of the many specious backslash characters. – Mico Jul 2 '19 at 7:59

Since automatic line-breaking in cells would seem to be unnecessary in the any of the cells of the table at hand, I suggest you employ a tabular* environment (with width set to textwidth) and S-type columns for the 15 data columns.

With these adjustments, it's possible to choose \footnotesize rather than \scriptsize as the relative font size. Your readers will appreciate the larger font size. :-)

Note that I would use l for the first two columns and c for the next two columns.

\documentclass[journal]{IEEEtran}
\usepackage{amsmath,booktabs,siunitx}
\newcommand{\mytab}[1]{% % handy helper macro
\smash[b]{\begin{tabular}[t]{c}#1\end{tabular}}}

\begin{document}

\begin{table*}
\sisetup{table-format=2.2}
\caption{Some caption}
\footnotesize  %\scriptsize
\setlength{\tabcolsep}{0pt} % make LaTeX figure out intercol. separation
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} ll cc *{15}{S} }
\toprule
Study & Method & \mytab{Num. of\\ subjects} & Dataset
& \multicolumn{5}{c}{Overall metrics}
& \multicolumn{5}{c}{Class-wise sensitivity}
& \multicolumn{5}{c}{Class-wise selectivity} \\
\cmidrule{5-9} \cmidrule{10-14} \cmidrule{15-19}
&&&
%%% Overall metrics
& {Acc.} & {$\kappa$} & {MF1} & {Sens.} & {Spec.}
%%% Class-wise sensitivity
& {W} & {N1} & {N2} & {N3} & {REM}
%%% Class-wise selectivity
& {W} & {N1} & {N2} & {N3} & {REM}\\
\midrule
\cite{Mendonca2019} & {ARNN+RNN} & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &{--} & 98.00  \\
\cite{Mendonca2019} & {ABC}      & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
\cite{Mendonca2019} & {ABC}      & {90}& {test} & 98.00 & 98.00 & 98.00 & {--} & {--}   & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
\bottomrule
\end{tabular*}
\end{table*}

\end{document}

• Mico, really appreciate for your alternative. I does solve the too small font size problem. Btw, may I know what the function of S in the S-type columns? – polosepian Jul 2 '19 at 12:21
• Also, the table not working properly when including \usepackage{floatrow} in the preamble – polosepian Jul 2 '19 at 12:50
• @RodneyPetrusbalandong - The S` column type is useful for aligning numbers in in cells within a column on their respective decimal markers. – Mico Jul 2 '19 at 13:47
• @RodneyPetrusbalandong - Please clarify what you mean by "the table [is] not working properly". (My telepathy skills are, sadly, very weak.) – Mico Jul 2 '19 at 13:48
• I post a new thread for this problem and can be accessed through this link. – polosepian Jul 3 '19 at 2:41