# Centering Text using multirow that overflows onto multiple lines

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}

-
I changed 100px to 100pt in your code. – Gonzalo Medina Apr 5 '11 at 18:58

\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}

-
This was perfect. Thanks! – Spike Apr 5 '11 at 19:38