4

Table multirow vertical alignment centre not working properly.

\documentclass{book}
\usepackage{multirow}
\begin{document}
\begin{tabular}{p{100pt}p{100pt}p{100pt}}
\hline
\multirow{6}{100pt}{realized two line text two line text two line text}&realized two line text two line text two line text&realized two line text two line text two line text\\
&realized two line text two line text two line text&realized two line text two line text two line text\\
&1&2\\
&1&2\\
&1&2\\
&1&2\\
\hline
\end{tabular}
\end{document} 
3
  • 1
    Have a look at the tabularray package. It makes merging cells much easier. Commented Jul 16 at 12:45
  • It is not really clear, what you expect. You are using 6 lines (not 6 rows!) for the \multirow and the vertical centering is done inside those 6 lines. Guess: Maybe you want 10 instead of 6, because the resulting number of lines for this table is 10 not 6?
    – cabohah
    Commented Jul 16 at 12:53
  • Off-topic: Your table is oversized (wider than the width of the text area).
    – cabohah
    Commented Jul 16 at 12:54

3 Answers 3

4

At Using multirow package you should consider all text lines in adjacent columns. In your case 10 of them:

\documentclass{book}
\usepackage{multirow}
\begin{document}
\noindent%
\begin{tabular}{p{100pt}p{100pt}p{100pt}}
    \hline
\multirow{10}{=}{realized two line text two line text two line text}
        &   realized two line text two line text two line text
            &   realized two line text two line text two line text\\
        &   realized two line text two line text two line text
            &   realized two line text two line text two line text\\
        & 1 & 2\\
        & 1 & 2\\
        & 1 & 2\\
        & 1 & 2\\
    \hline
\end{tabular}
\end{document} 

enter image description here

Or by using tabularray package:

\documentclass{book}
\usepackage{tabularray}
\begin{document}
\noindent%
\begin{tblr}{colspec = { *{3}{Q[l, wd=100pt]}},
             cell{1}{1} = {r=6}{}   % observe diference in number of rows
             }
    \hline
realized two line text two line text two line text
    &   realized two line text two line text two line text
        &   realized two line text two line text two line text\\
    &   realized two line text two line text two line text
        &   realized two line text two line text two line text\\
    & 1 & 2\\
    & 1 & 2\\
    & 1 & 2\\
    & 1 & 2\\
    \hline
\end{tblr}
\end{document} 

Result is the same as before.

2
  • The main thing to realize with multirow is that the first parameter is not "how many rows tall is this cell" but "how many lines of text tall is this cell".
    – Teepeemm
    Commented Jul 16 at 13:07
  • @Teepeemm, yes. You are right. Maybe in answer I should more emphasize this fact.
    – Zarko
    Commented Jul 16 at 14:12
2

I'd like to suggest using a tabularx environment with three X-type columns. This will assure that the table's width doesn't exceed \textwidth.

enter image description here

\documentclass{book}
\usepackage{multirow,tabularx}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{XXX}
\hline
\multirow{11}{\hsize}{%
realized two line text two line text two line text}
&realized two line text two line text two line text
&realized two line text two line text two line text\\
&realized two line text two line text two line text
&realized two line text two line text two line text\\
&1&2\\
&1&2\\
&1&2\\
&1&2\\
&1&2\\
\hline
\end{tabularx}
\end{document}
2

This puts one tabular inside another.

enter image description here

\documentclass{book}
%\usepackage{multirow} % no longer needed
\usepackage{array} % for 'm' column type
\begin{document}
\noindent
\begin{tabular}{ m{100pt} c }
\hline
realized two line text two line text two line text &
  \begin{tabular}{@{} p{100pt} p{100pt} @{}}
  realized two line text two line text two line text&
  realized two line text two line text two line text\\
  realized two line text two line text two line text&
  realized two line text two line text two line text\\
  1&2\\
  1&2\\
  1&2\\
  1&2
  \end{tabular}\\
\hline
\end{tabular}
\end{document} 
1
  • +1. I've taken the liberty of adding a screenshot.
    – Mico
    Commented Jul 17 at 2:35

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.