In a table I defined the width of some of its columns. I'd like to align the content of these columns in the horizontal center. How can I do it ?
Please find an example of the code below. The columns 4 to 7 are aligned to the left, but I want them at the center.
Code: Select all
\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{lcccp{2.0cm}p{2.0cm}p{2.0cm}p{2.0cm}}
\hline\\
\centering
Col 1&Col 2&Col 3&Col 3&Col 4 XXX XX XXXX&Col 5 XXX XX XXXX&Col 6 XXX XX XXXXX&Col 7 XXX XX XXXX\tabularnewline
\hline
\centering
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
XX&XX&XX&XX&XX&XX&XX&XX\tabularnewline
\hline
\end{tabular}
\end{table}
\end{document}