I have looked around for a solution that allows me to vertically centrally align a multirow
row that spans two intermediate rows, which potentially span multiple lines since the tabular environment is tabularx
.
Some other questions that don't quite get to the solution are here, here, and here. These solutions use the fixup
parameter to multirow
that I really would not like to use, or they are not quite applicable to my case.
So, to give an example
\documentclass{article}
\usepackage{tabularx, multirow, booktabs, lipsum}
\begin{document}
\begin{table}[ht]
\begin{tabularx}{\textwidth}{XXX}
\toprule
a & the first very, very, very, very, very, very, very, very, very, very, very long line. & a \\
\multirow{2}{*}{b} & a very, very, very, very, very, very, very, very, very, very, very long line. & \multirow{2}{*}{b} \\
& another very, very, very, very, very, very, very, very, very, very, very long line. & \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
I would like the "b"s to be vertically centrally aligned. I am not tied in any way to multirow
, but I am to tabularx
and would very much prefer an automatic solution.
"tied in any way to multirow"
? If you are just after centering the text vertically as well as horizontally in each cell (not in multirow cells), then\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}
will work. Then you can also define a new column type for horizontal centering.multirow
package does. But I might be mistaken.multirow
enables one to write text that spans several rows. As explained by @Philipp in his answer here, "multirow is not capable of a correct vertical alignment, if it spans multi-line cells"multirow
in its favor. A number of the other solutions linked in the main question do just that, build solutions which do not require the use of themultirow
package.