[Tex/LaTex] Centering text in table and multi column environment

multicolumntables

I want to center the text in a table code given below in first column only just like the other two columns created by multi column centered the heading Dispersion Constant (R). I want the Algorithm heading in first column of table to be centered just like the Dispersion Constant (R) . The result of following code is given in figure below. Keep in mind I just want Algorithm to be centered not the content below(SCA,MCMA,etc) the Algorithm Heading. Thank You. Please help?

\begin{table}[h]
\centering
\caption{Dispersion Constant $(R)$ Values}
\begin{tabular}{|l|l|l|}
\hline
\centering
\textbf{Algorithm} & \multicolumn{2}{|c|}{\textbf{Dispersion Constant $(R)$}}\\
\hline
& \textbf{M=16} & \textbf{M=32}\\ \hline

SCA & R\textsubscript{SCA} = 123 & R\textsubscript{SCA} = 123 \\\hline
MCMA & R\textsubscript{MCMA} = 123 & R\textsubscript{MCMA} = 123\\\hline 
MCMA(Dual Mode) & R\textsubscript{MCMA}& R\textsubscript{MCMA}\\\hline 
DD-MCMA & R\textsubscript{DD-MCMA} = 123 & R\textsubscript{DD-MCMA} = 123\\\hline 
DD-MCMA(Dual Mode) & R\textsubscript{DD-MCMA}& R\textsubscript{DD-MCMA}\\\hline 
\end{tabular}
\end{table}

enter image description here

Best Answer

If you absolutely must employ the "prison look" for tables, but wish to lessen the visual oppressiveness, consider getting rid of the \hline directives in the body of the tabular material. And, load the array package and set \extrarowheight to a small non-zero length value. :-)

You should also make an effort to give the term "R" ("dispersion value") a consistent appearance. In your code, it shows up in math italics in the table's header but in upright ("Roman") in the body of the table. Do make the appearance of this variable name consistent. In the code below, I show how to make use of the math-italics method. And, while we're talking about consistency, I've made the M term employ (bold) math italics as well.

Finally, to center some material in a single cell of the first column, use a \multicolumn{1}{|c|}{...} "wrapper".

enter image description here

\documentclass{article}
\usepackage{array}    % for '\extrarowheight' macro
\usepackage{caption}  % for '\captionsetup' macro
\usepackage{amstext}  % for '\text' macro
\renewcommand{\thetable}{\Roman{table}} % just for this example

\begin{document}
\begin{table}%[h]
\captionsetup{font=bf,skip=0.5\baselineskip}
\setlength{\extrarowheight}{2pt}
\centering

\caption{\boldmath 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
& \boldmath $M=16$ & \boldmath $M=32$ \\ 
\hline

SCA & $R_{\text{SCA}} = 123$ & $R_{\text{SCA}} = 123$ \\ %\hline
MCMA & $R_{\text{MCMA}} = 123$ & $R_{\text{MCMA}} = 123$\\ %\hline 
MCMA(Dual Mode) & $R_{\text{MCMA}}$ & $R_{\text{MCMA}}$\\ %\hline 
DD-MCMA & $R_{\text{DD-MCMA}} = 123$ & $R_{\text{DD-MCMA}} = 123$\\%\hline 
DD-MCMA(Dual Mode) & $R_{\text{DD-MCMA}}$& $R_{\text{DD-MCMA}}$\\
\hline 
\end{tabular}
\end{table}
\end{document} 
Related Question