TransWikia.com

table formatting in terms of length and breadth

TeX - LaTeX Asked on July 18, 2021

MWE:

documentclass{article}
usepackage{amsmath}
usepackage{multirow}
begin{table}[]
caption{}
label{tab:my-table}
begin{tabular}{|c|c|c|c|c|c|c|}
hline
multirow{2}{*}{A} & multirow{2}{*}{B} & multirow{2}{*}{C} & multirow{2}{*}{D} & multirow{2}{*}{E} & multicolumn{2}{c|}{F}           cline{6-7} 
                   &                    &                    &                    &                    & G              & H               hline
textbf{0.2}       & textbf{0.5}       & textbf{1}         & textbf{0.2}       & textbf{0.5}       & −1.8713360906  & −1.7640262021   hline
textbf{0.3}       & 0.5                & 1                  & 0.2                & 0.5                & −1.9365758323  & −1.7648755545   hline
textbf{0.4}       & 0.5                & 1                  & 0.2                & 0.5                & −1.9844365775  & −1.7572640364   hline
0.2                & textbf{0.6}       & 1                  & 0.2                & 0.5                & −1.8893451634  & −1.7769110253   hline
0.2                & textbf{0.7}       & 1                  & 0.2                & 0.5                & −1.9037201042  & −1.7845630194   hline
0.2                & textbf{0.8}       & 1                  & 0.2                & 0.5                & −1.9084283289  & −1.78054097011  hline
0.2                & 0.5                & textbf{1.1}       & 0.2                & 0.5                & −1.8638586434  & −1.75716821872  hline
0.2                & 0.5                & textbf{1.2}       & 0.2                & 0.5                & −1.8563791180  & −1.75030388119  hline
0.2                & 0.5                & textbf{1.3}       & 0.2                & 0.5                & −1.8488975550  & −1.74343325690  hline
0.2                & 0.5                & 1                  & textbf{0.3}       & 0.5                & −1.7816929512  & −1.67995077275  hline
0.2                & 0.5                & 1                  & textbf{0.4}       & 0.5                & −1.6940695909  & −1.59754625788  hline
0.2                & 0.5                & 1                  & textbf{0.5}       & 0.5                & −1.60833298231 & −1.51669912930  hline
0.2                & 0.5                & 1                  & 0.2                & textbf{0.6}       & −1.79104380621 & −1.69665633242  hline
0.2                & 0.5                & 1                  & 0.2                & textbf{0.7}       & −1.72028938675 & −1.63324789889  hline
0.2                & 0.5                & 1                  & 0.2                & textbf{0.8}       & −1.66248454886 & −1.58021088372  hline
end{tabular}
end{table}

Question: How can I control the height of each cell in this table?

Please help me

2 Answers

As mentioned @js bibra in his comment, your question is actually duplicate to column-and-row-padding-in-tables. Let me add one more possibilities given in answers to question in the link, where behind vertical paddings are suggested some improvements to table design

  • S column type defined in siunitx package,
  • etoolbox package for defining robust command for marking cells with boldface numbers
  • macro makegapedcells for vertical padding, which is defined by setcellgapes{...}
documentclass{article}
usepackage{makecell, multirow}
usepackage{siunitx}
usepackage{etoolbox}
newrobustcmdB{DeclareFontSeriesDefault[rm]{bf}{b}bfseries}                          
usepackage[skip=1ex, font=small, labelfont=bf]{caption}

begin{document}
    begin{table}[ht]
    centering
sisetup{detect-weight,
         mode=text}
    setcellgapes{5pt}
    makegapedcells
caption{My table}
label{tab:...}
    label{tab:my-table}
begin{tabular}{|*{5}{S[table-format=1.1]|}
                 *{2}{S[table-format=-1.11]|}
                 }
hline
{multirow{2.4}{*}{A}} & {multirow{2.4}{*}{B}} & {multirow{2.4}{*}{C}} & {multirow{2.4}{*}{D}} & {multirow{2.4}{*}{E}} & multicolumn{2}{c|}{F}          cline{6-7}
        &       &       &       &       & {G}           & {H}             hline
B  0.2 &B 0.5 &B 1   &B 0.2 &B 0.5 & -1.8713360906 & -1.7640262021  hline
B  0.3 & 0.5   & 1     & 0.2   & 0.5   & -1.9365758323 & -1.7648755545  hline
B  0.4 & 0.5   & 1     & 0.2   & 0.5   & -1.9844365775 & -1.7572640364  hline
0.2     &B 0.6 & 1     & 0.2   & 0.5   & -1.8893451634 & -1.7769110253  hline
0.2     &B 0.7 & 1     & 0.2   & 0.5   & -1.9037201042 & -1.7845630194  hline
0.2     &B 0.8 & 1     & 0.2   & 0.5   & -1.9084283289 & -1.78054097011     hline
0.2     & 0.5   &B 1.1 & 0.2   & 0.5   & -1.8638586434 & -1.75716821872     hline
0.2     & 0.5   &B 1.2 & 0.2   & 0.5   & -1.8563791180 & -1.75030388119     hline
0.2     & 0.5   &B 1.3 & 0.2   & 0.5   & -1.8488975550 & -1.74343325690     hline
0.2     & 0.5   & 1     &B 0.3 & 0.5   & -1.7816929512 & -1.67995077275     hline
0.2     & 0.5   & 1     &B 0.4 & 0.5   & -1.6940695909 & -1.59754625788     hline
0.2     & 0.5   & 1     &B 0.5 & 0.5   & -1.60833298231& -1.51669912930     hline
0.2     & 0.5   & 1     & 0.2   &B 0.6 & -1.79104380621& -1.69665633242     hline
0.2     & 0.5   & 1     & 0.2   &B 0.7 & -1.72028938675& -1.63324789889     hline
0.2     & 0.5   & 1     & 0.2   &B 0.8 & -1.66248454886& -1.58021088372     hline
end{tabular}
    end{table}
end{document}

enter image description here

Correct answer by Zarko on July 18, 2021

renewcommand{arraystretch}{2}

You can increase the height of each cell with the arraystretch command. Pass the value to the argument, how much to increase the height.

Also, visit my youtube channel WPG for Latex tutorials.

Answered by Abuzar Ghafari on July 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP