2

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}
1
  • I changed 100px to 100pt in your code. Apr 5, 2011 at 18:58

1 Answer 1

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .