# How to break header titles in a table

Please, how to break headers titles in a table ?

\begin{table}[H]
\begin{tabular}[h]{|p{2cm}||p{2cm}}
\hline
{title one} & {title two}   \\ \hline\hline
\end{tabular}
\caption{title}
\end{table}


Thank you.

-

## 1 Answer

You can use \parboxes with line changing commands; inside the boxes you can use \centering to center the contents:

\documentclass{article}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|p{2cm}|p{2cm}|}
\hline
\parbox[t]{2cm}{\centering title \\ one} & \parbox[t]{2cm}{\centering title \\ two} \\[3ex]
some text & some text \\
some text & some text \\
\hline
\end{tabular}
\caption{title}
\end{table}

\end{document}


I used the vertical rules as visual reference points. On a side note, with such narrow columns, you could consider setting them ragged right.

-
Thank you so much, it works :) please, one more question how can center the titles in the cellule ? –  researcher Aug 31 '12 at 22:47
@researcher You're welcome" For your new requirement, see my updated answer; I assumed you wanted to center only the title cells; if you wanted to center all the column, let me know. –  Gonzalo Medina Aug 31 '12 at 22:53
Thank you so much for help :), yes how center all the column ? –  researcher Sep 1 '12 at 9:09
@researcher load the array package: usepackage{array} and instead of p{2cm} use >{\centering\arraybackslash}p{2cm} –  Gonzalo Medina Sep 1 '12 at 13:37
thank you so much Gonzalo :) my table is well, but i have a little problem, i have one title of coloumn is a bit long so it is written on the table row, i wish you understand me .. –  researcher Sep 1 '12 at 21:03