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 am trying to create a table where one column has multiple rows. This is very easy to do using the multirow package. However, if I specify a width for this \multirow and my text overflows, the second line of the multirow loses its centering. Here is an example of what I'm doing:

\usepackage{multirow}
\begin{table}[!h]
    \begin{tabular}{ | c | c |}
        1 & \multirow{4}{100pt}{This one works} \\
        2 & \\
        3 & \\
        4 & \\
        1 & \multirow{4}{100pt}{This one doesn't work and loses its centering because the text is too long}\\
        2 & \\
        3 & \\
        4 & \\
    \end{tabular}
\end{table}
share|improve this question
    
I changed 100px to 100pt in your code. –  Gonzalo Medina Apr 5 '11 at 18:58
add comment

1 Answer

up vote 3 down vote accepted

\multirow uses the \multirowsetup macro before the text is actually typeset and, by default, \multirowsetup is defined as \raggedright. You can change this by redefining \multirowsetup (as I did in my example), or manually adding a \centering command in the last argument of each \multirow in which the text should appear centered.

\documentclass[12pt]{report} 
\usepackage{multirow}

\begin{document}

\begin{table}[!h]
  \renewcommand\multirowsetup{\centering}
   \begin{tabular}{ | c | c |}
        1 & \multirow{4}{100pt}{This one works} \\
        2 & \\
        3 & \\
        4 & \\
        1 & \multirow{4}{100pt}{This one doesn't work and loses its centering because the text is too long}\\
        2 & \\
        3 & \\
        4 & \\
    \end{tabular}
\end{table}

\end{document}
share|improve this answer
    
This was perfect. Thanks! –  Spike Apr 5 '11 at 19:38
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.