I want to create a tabular with fixed column width and centered text. I write it like that:
\begin{table}[ht]
\begin{center}
\begin{tabular}{p{4cm}p{4cm}p{4cm}}
\hline
\multicolumn{3}{c}{\textbf{High resolution model}} \\
\hline
\centering $\alpha_{H,1}$ & \centering $\alpha_{H,2}$ & \centering $\alpha_{H,3}$ \\
bla & bla & bla \\
\end{tabular}
\end{center}
\end{table}
I use the centering command because when using "p{4cm}p{4cm}p{4cm}" to fix the size of the columns, by default the text is aligned on the left. But when I want to compile I get the following error : "! Extra alignment tab has been changed to \cr." that I do not understand and that I am not able to solve.
Any help would be appreciated :)
p
type columns, use>{\centering\arraybackslash}p{4cm}
if you only want to center the contents of one cell, use\multicolumn{1}{c}{.....}
or\makecell
from themakecell
package.