# Centering of the first row under multicolum headings in tables

I want to center the row under the multicolumn heading. In the table below I want to center the M=16 and M=32 without disturbing the layout of content in the figure below. The Red marker showing content required to be centered only.

\begin{table}[h]
\centering
\caption{Values of Dispersion Constant ($R$)}
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{Algorithm}} & \multicolumn{2}{ c|}{{\boldmath\textbf{Dispersion Constant ($R$)}}}\\
\hline
& \textbf{\centering M=16} & \textbf{\centering M=32}\\ \hline
SCA & R\textsubscript{SCA} = 123 & R\textsubscript{SCA} = 123 \\\hline
\end{table}
MCMA & R\textsubscript{R}=2.55 and R\textsubscript{I}=2.55  & R\textsubscript{R}=2.55 and R\textsubscript{I}=2.55\\
\hline
\multirow{2}*{DD-MCMA} & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 \\
& R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 \\
\hline
\end{tabular}
\end{table}


• You asked the same question yesterday – Johannes_B Jul 10 '18 at 7:26

Simply use \multicolumn{1}{c|}{...} for the cell you want to center.

\documentclass{article}
\usepackage{array}
\renewcommand{\arraystretch}{1.2}
\usepackage{multirow}
\usepackage{caption}
\begin{document}

\begin{table}[h]
\centering
\caption{Values of Dispersion Constant ($R$)}
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{Algorithm}} & \multicolumn{2}{ c|}{{\boldmath\textbf{Dispersion Constant ($R$)}}}\\
\hline
& \multicolumn{1}{c|}{\textbf{M=16}} & \multicolumn{1}{c|}{\textbf{M=32}}\\ \hline
SCA & R\textsubscript{SCA} = 123 & R\textsubscript{SCA} = 123 \\\hline
MCMA & R\textsubscript{R}=2.55 and R\textsubscript{I}=2.55  & R\textsubscript{R}=2.55 and R\textsubscript{I}=2.55\\
\hline
\multirow{2}*{DD-MCMA} & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 \\
& R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 & R\textsubscript{R1} = 123 and R\textsubscript{R2} = 123 \\
\hline
\end{tabular}
\end{table}
\end{document}


• Do u know how I can fully justify the content of above given content in last row? Just like u did it above. – Faizan Zaheer Jul 10 '18 at 5:53
• I mean fully justified content in tables as the contents are left justified here as \begin{tabular}{|l|l|l|}. e.g RSCA,RR1 and RR2 etc – Faizan Zaheer Jul 10 '18 at 6:04
• Is the p{...} works for horizontal line alignment? I want text in table to be justified horizontally. – Faizan Zaheer Jul 10 '18 at 6:14
• Ok. I submitted the new question link – Faizan Zaheer Jul 10 '18 at 6:20
• Please check out the question of the op from yesterday. Duplicate? – Johannes_B Jul 10 '18 at 7:27