0

I am facing issues in vertically aligning (and wrapping of) the text in a multirow table. I would accordingly appreciate some help in this regard from the estmeed community. Please see below:

\begin{table}
\caption{Story of Humpty Dumpty}
\centering
\begin{tabular}{c|c|c}
\hline
\multirow{3}{*}{Humpty Dumpty Sat} & on & \begin{tabular}[c]{@{}c@{}}the wall\\ and had a great fall  \end{tabular}\\ \cline{2-3} 
& \begin{tabular}[c]{@{}c@{}} on\end{tabular} & \begin{tabular}[c]{@{}c@{}}the wall\\ and had a great fall \end{tabular}\\ \cline{2-3} & \begin{tabular}[c]{@{}c@{}}on\\ \end{tabular} & \begin{tabular}[c]{@{}c@{}}the wall\\ and had a great fall\end{tabular} \\ \hline
\end{tabular}
\end{table}

I am looking to achieve the following:

enter image description here

1
  • please have a look at the answer below - note that \multirow{5}{*}{Humpty Dumpty Sat} can also take decimal values for fine vertical alignment as well as negative values such as 5.2 etc -- \multirow{5.2}{*}{Humpty Dumpty Sat} -- adapt to taste
    – js bibra
    Nov 22, 2020 at 0:58

2 Answers 2

1

vertical alignment

enter image description here

 \multirow{5}{*}{Humpty Dumpty Sat} & on & \begin{tabular}[c]{@{}c@{}}the wall\\ and had a great fall  \end{tabular}\\ \cline{2-3} 

additionally to wrap the text in multirow

enter image description here

\multirow{5}{0.2\textwidth}{\centering Humpty Dumpty Sat} 
2
  • 1
    Thanks a million. This settles it :-).
    – Qureshi
    Nov 22, 2020 at 1:58
  • @Qureshi do upvote if you have the urge
    – js bibra
    Nov 22, 2020 at 1:59
0

Alternatively, with shorter code which employ m type of columns and center setting for `multirow cells:

\documentclass{article}
\usepackage{array, multirow}

\begin{document}
    \begin{table}
\caption{Story of Humpty Dumpty}
\centering
\renewcommand\multirowsetup{\centering} % <---
\renewcommand\arraystretch{1.3}
\begin{tabular}{p{6em}|c|>{\centering\arraybackslash}m{8em}} <---
    \hline
\multirow{4.5}{=}{Humpty Dumpty Sat} % 4.5=6 spanned lines-2 lines text + 0.5 line for gaps in rows
    & on    & the wall and had a great fall \\ \cline{2-3}
    & on    & the wall and had a great fall \\ \cline{2-3} 
    & on    & the wall and had a great fall \\ 
    \hline
\end{tabular}
    \end{table}
\end{document}

enter image description here

You must log in to answer this question.

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