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.

I have the following code

\documentclass[a4paper, 11pt]{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{|p{2cm}|p{6cm}|p{1cm}|p{1cm}|p{1cm}|}
\hline
\multicolumn{2}{|c|}{} & Start date & End date & Days spent\\
\hline
\multirow{6}{2cm}{Background research} & This is some long text that wraps below& Lucus Radebe  & & \\
 & This is some long text that wraps below & Michael Duberry  & & \\
 & This is some long text that wraps below & Dominic Matteo  & & \\
  & This is some long text that wraps below & Dominic Matteo  & & \\
   & This is some long text that wraps below & Dominic Matteo  & & \\
 & This is some long text that wraps below & Didier Domi  & & \\ \hline
\multirow{3}{2cm}{Midfielders} & MC & David Batty  & & \\
 & MC & Eirik Bakke  & & \\
 & MC & Jody Morris  & & \\ \hline
Forward & FW & Jamie McMaster  & & \\ \hline
\multirow{2}{2cm}{Strikers} & ST & Alan Smith  & & \\
 & ST & Mark Viduka  & & \\
\hline
\end{tabular}
\end{document}

It wraps text in the third column but not the first. How can I make it wrap in the first column too?

EDIT: One possible solution

Use \multirow{6}{2cm}{{\begin{center}Defenderss adsadasdasdas\end{center}}}

But that does not maintain the vertical alignment if your other rows get wrapped

share|improve this question
    
Things inside \multirow don't wrap by themselves. –  egreg Apr 5 '12 at 11:19
    
How can i make columns spanning multiple rows and wrap text then? –  user972616 Apr 5 '12 at 11:21
add comment

1 Answer

up vote 3 down vote accepted

I think you want to use 2cm rather than * as the width argument for \multirow

enter image description here

\documentclass{article}

\usepackage{multirow}

\begin{document}

\begin{tabular}{|p{2cm}|l|p{2cm}|}
\hline
\multicolumn{3}{|c|}{Team sheet} \\
\hline
Goalkeeper & GK & Paul Robinson \\ \hline
\multirow{6}{2cm}{Defend\-erss adsad\-asda\-sdas} & LB & Lucus Radebe \\
 & DC & Michael Duberry \\
 & DC & Dominic Matteo \\
 & DC & Dominic Matteo \\
 & DC & Dominic Matteo \\
 & RB & Didier Domi \\ \hline
\multirow{3}{2cm}{Midfielders} & MC & David Batty \\
 & MC & Eirik Bakke \\
 & MC & Jody Morris \\ \hline
Forward & FW & Jamie McMaster \\ \hline
\multirow{2}{2cm}{Strikers} & ST & Alan Smith \\
 & ST & Mark Viduka \\
\hline
\end{tabular}

\end{document}
share|improve this answer
    
Nope didn't work –  user972616 Apr 5 '12 at 11:32
1  
You'll need to define not work, as it does wrap those entries. Of course if you put large unhyphenatable words in their they won't break unless you help with \- or other hyphenation customisation. It would have been easier if you'd had a complete MWE with documentclass so we could see any other things affecting your output –  David Carlisle Apr 5 '12 at 11:37
    
See code/image added to answer –  David Carlisle Apr 5 '12 at 11:45
    
The vertical alignment is not centered anymore using that –  user972616 Apr 5 '12 at 11:50
    
That's a documented feature. The multirow manual says: If any of the spanned rows are unusually large, or if you’re using the bigstrut and \bigstrutsare used asymetrically about the centerline of the spanned rows, the vertical centering may not come out right. Use the fixup argument in this case., Your rows are large because the other columns now have wrapped text. So you can put \multirow{6}{2cm}[-3em]{Defend\-erss adsad\-asda\-sdas} –  David Carlisle Apr 5 '12 at 12:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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