# Table setting with middle rule

I want to know how can I put the N_1 , N_2 and N_3 a little bit high in order to have them in the middle with the name number and I want the middle rule to be only under N_1 , N_2 and N_3

\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}

\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{graphicx}
\usepackage{amssymb,amsmath,nccmath}
%%\usepackage{caption} % is loaded automatically by 'subcaption'
\usepackage{lscape,array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % centered 'p' col.
%%\usepackage{natbib} % is loaded automatically by elsarticle doc class
\usepackage{subcaption}
\usepackage{caption}
\usepackage{framed}  % Framing content
\usepackage{nomencl} % Nomenclature package
\usepackage[font=small,skip=0pt]{caption}
\makenomenclature
\setlength{\nomitemsep}{-\parskip}\usepackage{booktabs,multirow}

%% Load the next two packages *last*:

\journal{Journal of \LaTeX\ Templates}

\bibliographystyle{elsarticle-num}

\begin{document}
\begin{table}[htp]
\centering
\begin{tabular}{ c c c c }
\toprule
name \\ number & $N_1$ & $N_2$ & $N_3$ \\
\midrule
1 &  full name age 1 & full name age 2    & full name age 3 \\
2 & full name age 4  & full name age 5     &
full name age 6    \\
3 & full name age 7   & full name age 8     &
full name age 9  \\
4 & full name age 10  & full name age 11     &
full name age 12     \\
\bottomrule
\end{tabular}
\end{table}
\section*{References}

\bibliography{mybibfile}

\end{document}


You can try this solution:

\begin{table}[htp]
\centering
\begin{tabular}{ c c c c }
\toprule
name & \multirow{2}{*}{$N_1$} & \multirow{2}{*}{$N_2$} & \multirow{2}{*}{$N_3$} \\
number & & & \\
\cmidrule{2-4}
1 & full name age 1  & full name age 2  & full name age 3  \\
2 & full name age 4  & full name age 5  & full name age 6  \\
3 & full name age 7  & full name age 8  & full name age 9  \\
4 & full name age 10 & full name age 11 & full name age 12 \\
\bottomrule
\end{tabular}
\end{table}


You will need \usepackage{multirow} in your preamble.

The simplest is to use the makecell package: the eponymous command allows for line breaks in standard cells, and by default centres its contents both horizontally and vertically:

\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}

\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{graphicx}
\usepackage{amssymb, mathtools, nccmath}
%%\usepackage{caption} % is loaded automatically by 'subcaption'
\usepackage{lscape,array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % centered 'p' col.
%%\usepackage{natbib} % is loaded automatically by elsarticle doc class
\usepackage{subcaption}
\usepackage{caption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\usepackage[font=small,skip=0pt]{caption}
\makenomenclature
\setlength{\nomitemsep}{-\parskip}\usepackage{booktabs,multirow, makecell}

%% Load the next two packages *last*:

\journal{Journal of \LaTeX\ Templates}

\bibliographystyle{elsarticle-num}

\begin{document}

\begin{table}[!htp]
\centering
\begin{tabular}{ c c c c }
\toprule
\makecell{name \\ number} & $N_1$ & $N_2$ & $N_3$ \\
\midrule
1 & full name age 1 & full name age 2 & full name age 3 \\
2 & full name age 4 & full name age 5 &
full name age 6 \\
3 & full name age 7 & full name age 8 &
full name age 9 \\
4 & full name age 10 & full name age 11 &
full name age 12 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


• @Bernard Perfect. Did not know the package makecell yet. – Matthias Nov 1 '17 at 13:20