0

A MWE is as follows (not extremely minumum):

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

\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}  
\renewcommand\arraystretch{1.5}

\begin{document}
\begin{table}
\centering
    \begin{tabular}{@{}m{3cm} M{3.5cm} M{3.5cm} M{3.5cm}@{}}
    \hline \hline
      & Team A  & Team B & Team C \\ \hline 
    A & \multirow{3}[10]{=}{\centering Text} & Text & Text \\ \cline{3-4}
    B & & \multirow{2}[8]{=}{\centering Text Text Text Text Text Text Text Text} & Text \\ \cline{4-4}
    C & & & Text Text Text Text Text Text Text Text \\ \hline  
    \end{tabular}
\end{table}
\end{document}

The result looks like this:

The result looks like this

The third row height is higher due to text wrapping, and I want to make the height of the first and second rows is the same as the third one. I've searched and tried many ways, the following one is the most satisfying solution but still not as good as what it is claimed to be.

...
\usepackage{stackengine}
\newcommand\xrowht[2][0]{\addstackgap[.5\dimexpr#2\relax]{\vphantom{#1}}}
...
\begin{table}
\centering
    \begin{tabular}{@{}m{3cm} M{3.5cm} M{3.5cm} M{3.5cm}@{}}
    \hline \hline
      & Team A  & Team B & Team C \\ \hline\xrowht{20pt} 
    A & \multirow{3}[10]{=}{\centering Text} & Text & Text \\ \cline{3-4}\xrowht{20pt}
    B & & \multirow{2}[8]{=}{\centering Text Text Text Text Text Text Text Text} & Text \\ \cline{4-4}
    C & & & Text Text Text Text Text Text Text Text \\ \hline  
    \end{tabular}
\end{table}

This basically adds \xrowht{} at the end of the row after \hline. The solution provider Steven B. Segletes claims that the \xrowht{2xpt} command adds xpt of height above and below a \vphantom. However, when I try with other length like 40pt, it actually only adds extra height below.

BTW, I also tried other solutions like adding an empty column at the end of each row which does not work anymore, as well as other solutions that either increase the height above the text only or the height below the text only.

Can anyone help me with this issue?

  • how about adding \rule{-20pt}{}{46pt} as an approximation – js bibra May 27 at 1:21
  • @js bibra, thanks, but where should I add it? This seems to be a case by case solution. Is there a universal way to set the height of rows? – Lin Jing May 27 at 1:41
  • the documentation of multirow is available online at texdoc.net/texmf-dist/doc/latex/multirow/multirow.pdf --- please note that with the calc package multirow can calculate the amount of shift up or down required given in section 3.3 -- also adding struts is also discussed in 3.2 – js bibra May 27 at 6:52
  • please have a look at the answer if it meets your requirements or is helpful in any way – js bibra May 27 at 10:52
  • 1
    @js bibra Thanks so much for your answer as well as the comment. Thanks for pointing to the exact seciton of multirow package. This also requires some experimentation with the parameter values. I'll wait a bit to see whether there will be better solutions. Thanks again. – Lin Jing May 27 at 13:32
0

A rough hack -- you may like to experiment with the definition of strut to your choice--this is one option out of many available

enter image description here

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

 \renewcommand\arraystretch{1.5}
% define "struts" as suggested by Claudio Beccari in
%    a piece in TeX and TUG News, Vol. 2, 1993.
\newcommand\T{\rule{0pt}{24ex}}       % = `top' strut
\newcommand\B{\rule[-18ex]{0pt}{0pt}} % = `bottom' strut
\newcommand\TB{\T\B} % top-and-bottom strut 

\begin{document}
    \begin{table}
        \centering
        \begin{tabular}{@{}m{3cm} m{3.5cm} m{3.5cm} m{3.5cm}@{}}
            \hline \hline
            & Team A  & Team B & Team C \\ \hline 
            A & \T\T \multirow{3}[50]{*}{Text} & Text & Text \\ \cline{3-4}
            B & & \T\multirow{2}[8]{=}{Text Text Text Text Text Text Text Text} & Text 
            \\ \cline{4-4}
            C & & & \T Text Text Text Text Text Text Text Text\\ \hline  
        \end{tabular}
    \end{table}
\end{document}
| improve this answer | |
0

Just give each row equal lines. enter image description here

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

\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}  
\renewcommand\arraystretch{1.5}

\begin{document}
\begin{table}
\centering
\begin{tabular}{@{}m{3cm} M{3.5cm} M{3.5cm} M{3.5cm}@{}}
\hline \hline
  & Team A  & Team B & Team C \\ \hline 
  \multirow{3}{*}{A}
    & \multirow{9}[10]{=}{\centering Text}
    & \multirow{3}{*}{Text}
    & \multirow{3}{*}{Text} \\
  &&&\\
  &&&\\
\cline{3-4}
  \multirow{3}{*}{B}
    & & \multirow{6}[8]{=}{\centering Text Text Text Text Text Text Text Text}
    & \multirow{3}{*}{Text} \\
  &&&\\
  &&&\\
\cline{4-4}
  \multirow{3}{*}{C}
    & & & \multirow{3}{=}{Text Text Text Text Text Text Text Text} \\
  &&&\\
  &&&\\
\hline
\end{tabular}
\end{table}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.