TeX - LaTeX Asked by Lin Jing on April 1, 2021
A MWE is as follows (not extremely minumum):
documentclass{article}
usepackage{array, multirow, float, bigstrut}
newcolumntype{M}[1]{>{centeringarraybackslash}m{#1}}
renewcommandarraystretch{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 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}
newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{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 hlinexrowht{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?
A rough hack -- you may like to experiment with the definition of strut to your choice--this is one option out of many available
documentclass{article}
usepackage{array, multirow, float, bigstrut}
renewcommandarraystretch{1.5}
% define "struts" as suggested by Claudio Beccari in
% a piece in TeX and TUG News, Vol. 2, 1993.
newcommandT{rule{0pt}{24ex}} % = `top' strut
newcommandB{rule[-18ex]{0pt}{0pt}} % = `bottom' strut
newcommandTB{TB} % 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 & TT multirow{3}[50]{*}{Text} & Text & Text cline{3-4}
B & & Tmultirow{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}
Answered by js bibra on April 1, 2021
Just give each row equal lines.
documentclass{article}
usepackage{array, multirow, float, bigstrut}
newcolumntype{M}[1]{>{centeringarraybackslash}m{#1}}
renewcommandarraystretch{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}
Answered by ZhiyuanLck on April 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP