Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How to add a forced line break inside a table cell

I would like to write the header of a column on multiple line. I tried with this commands but it doesn't work:

\begin{tabular}{|c|l|l|l|l|l|l|}
\hline \\
$\alpha$ 
& \multicolumn{1}{|c|}{GallusGallus \\ CC \\ t = 104}
& \multicolumn{1}{|c|}{GallusGallus \\ MF \\ t = 124}
& \multicolumn{1}{|c|}{GallusGallus \\ BP \\ t = 110}
& \multicolumn{1}{|c|}{BosTaurus \\ CC \\ t = 99}
& \multicolumn{1}{|c|}{BosTaurus \\ MF \\ t = 217}
& \multicolumn{1}{|c|}{BosTaurus \\ BP \\ t = 205}
\end{tabular}

How can I fix?

share|improve this question

marked as duplicate by egreg, Andrew Swann, Thorsten, lockstep, Stefan Kottwitz Oct 29 '12 at 11:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See this answer: tex.stackexchange.com/a/19678/4427 –  egreg Oct 29 '12 at 11:19

1 Answer 1

up vote 7 down vote accepted

You can use P{<width>}{<contents>} instead of using c column. In p (paragraph) column, usual \centering can be used to center the contents.

\documentclass{article}

\begin{document}
\begin{tabular}{|c|l|}
\hline 
$\alpha$
& \multicolumn{1}{|p{3cm}|}{\centering GallusGallus \\ CC \\ t = 104}\\\hline
\end{tabular}
\end{document}

enter image description here

Your full example will be:

\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\begin{document}
\noindent
\begin{tabular}{|c|l|l|l|l|l|l|}
\hline 
$\alpha$
& \multicolumn{1}{|p{2cm}|}{\centering GallusGallus \\ CC \\ t = 104}
& \multicolumn{1}{|p{2cm}|}{\centering GallusGallus \\ MF \\ t = 124}
& \multicolumn{1}{|p{2cm}|}{\centering GallusGallus \\ BP \\ t = 110}
& \multicolumn{1}{|p{2cm}|}{\centering BosTaurus \\ CC \\ t = 99}
& \multicolumn{1}{|p{2cm}|}{\centering BosTaurus \\ MF \\ t = 217}
& \multicolumn{1}{|p{2cm}|}{\centering BosTaurus \\ BP \\ t = 205}\\\hline
\end{tabular}
\end{document}

enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.