# tabularx and multirow: vertical center is not correct

I'm trying to produce a table where the text in the left columns can contain a linebreak AND is vertically centered in relation to the height of three columns. Specifically, I have the following minimal example:

\documentclass{article}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\renewcommand{\arraystretch}{1.4}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\begin{table}[]
\centering
\begin{tabularx}{\linewidth}{P{1.5cm}P{2.6cm}X}
\toprule
\textbf{Method}  & \textbf{Frame} & \textbf{Headline}                  \\
\midrule
\multirow{3}{=}{mylabel}&    sometext (some information)           & this is text that is somewhat longer than the first two columns      \\
&      sometext (some information)        & this is text that is somewhat longer than the first two columns. it's also longer than the text in the first column. much much much much much much much much longer actually!                          \\
&     sometext (some information)          & this is text that is somewhat longer than the first two columns          \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}


Note how in the resulting PDF the left label is not vertically centered.

I'm aware of the various related questions listed in the following but none of them address this specific issue with the wrongly vertically centered left text:

• Wellcome to TeX SE! – F. Pantigny Apr 25 at 10:29

In the environment {NiceTabular} of nicematrix, you have a command \Block to merge cells both vertically and horizontally. The content of the block is placed at the mathematical center of the block. That means that, when you want to merge vertically (as in your example), you have to specify the number of logical rows (and not the number of physical lines as with \multicolumn).

However, there is no {NiceTabularX} environment (maybe in a further version). That means that you have to compute "by hand" the width of the third column.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}
\begin{table}[]
\centering
\begin{NiceTabular}{P{1.5cm}P{2.6cm}P{\dimexpr \linewidth -4.1cm - 6 \tabcolsep}}
\toprule
\textbf{Method}  & \textbf{Frame} & \textbf{Headline}                  \\
\midrule
\Block[l]{3-1}{mylabel}&    sometext (some information)           & this is text that is somewhat longer than the first two columns      \\
&      sometext (some information)        & this is text that is somewhat longer than the first two columns. it's also longer than the text in the first column. much much much much much much much much longer actually!                          \\
&     sometext (some information)          & this is text that is somewhat longer than the first two columns          \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}


You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

You can put \\ in the command \Block. Example:

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}
\begin{table}[]
\centering
\begin{NiceTabular}{P{1.5cm}P{2.6cm}P{\dimexpr \linewidth -4.1cm - 6 \tabcolsep}}
\toprule
\textbf{Method}  & \textbf{Frame} & \textbf{Headline}                  \\
\midrule
\Block[l]{3-1}{mylabel\\ 2nd line}&    sometext (some information)           & this is text that is somewhat longer than the first two columns      \\
&      sometext (some information)        & this is text that is somewhat longer than the first two columns. it's also longer than the text in the first column. much much much much much much much much longer actually!                          \\
&     sometext (some information)          & this is text that is somewhat longer than the first two columns          \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}


If you want automatic break lines in the \Block, you have to put a \parbox in the block (with the right width: maybe this will automated in a further version of nicematrix).

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}
\begin{table}[]
\centering
\begin{NiceTabular}{P{1.5cm}P{2.6cm}P{\dimexpr \linewidth -4.1cm - 6 \tabcolsep}}
\toprule
\textbf{Method}  & \textbf{Frame} & \textbf{Headline}                  \\
\midrule
\Block[l]{3-1}{\parbox{1.5cm}{some text, other text, other text}}&    sometext (some information)           & this is text that is somewhat longer than the first two columns      \\
&      sometext (some information)        & this is text that is somewhat longer than the first two columns. it's also longer than the text in the first column. much much much much much much much much longer actually!                          \\
&     sometext (some information)          & this is text that is somewhat longer than the first two columns          \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}


\multirow is designed for one-lined cells and the default \arraystretch. In your case, you have to count the total number of lines in the three rows as a starting point for trhe first argument of \multirow and adjust this argument by trial and error. Note this argument may have a decimal part for fine-tuning.

\documentclass{article}

\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}

\renewcommand{\arraystretch}{1.4}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}

\begin{table}[]
\centering
\begin{tabularx}{\linewidth}{P{1.5cm}P{2.6cm}X}
\toprule
\textbf{Method} & \textbf{Frame} & \textbf{Headline} \\
\midrule
\multirow{7.4}{=}{mylabel}& sometext (some information) & this is text that is somewhat longer than the first two columns \\
& sometext (some information) & this is text that is somewhat longer than the first two columns. it's also longer than the text in the first column. much much much much much much much much longer actually! \\
& sometext (some information) & this is text that is somewhat longer than the first two columns \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}