I would like to center the content of certain cells (actually the whole first row) of my table, while the rest of the table is left-aligned.
It works with multicolumn
, but when using multicolumn
it does not break the content of the cell and puts all the text in one line.
I wonder if there is not a simple command, such as {\centering
} (which I tried and doesn't work), without the "detour" via multicolumn?
\begin{table}[h]
\centering
\label{example}
\noindent\begin{tabular}{>{\raggedright\arraybackslash}m{3cm}|>{\raggedright\arraybackslash}m{3cm}|>{\raggedright\arraybackslash}m{3cm}|}\hline
here I want centering and line breaking &here too &here too \\ \hline
the rest aligned on the left & left1 & left2\\ \hline
3 & 4 & 5 \\ \hline
\end{tabular}
\end{table}
\centering
will work, if it was anl
column then line breaking is disabled anyway and using\multicolumn{1}{c}
does not change that, so with no example code it is very hard to understand your question.\multicolumn{1}{>{\centering\arraybackslash}m{3cm}|}{text}
.