1

This is a follow up link question to How to make a content into 2 row

enter image description here

Basically, I want to have a small gap in blue line below and also do not touch the bottomrule

enter image description here

My full MWE:

\documentclass[12pt,oneside]{book}

\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{hhline, boldline}
\usepackage{seqsplit, caption} %for table spacing to second row
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text
\usepackage{siunitx} %for table spacing to second row
\usepackage{threeparttable} %to add footnote below table
\usepackage{tabulary}
\usepackage{graphicx}

\begin{document}

\begin{table}[h!]
\centering
    \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}XXlrr}

    % \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}Xrrrrrr}


    \toprule
    & & & \multicolumn{2}{c}{\textbf{Cholestrrol Levellll}} \\
     \cmidrule{4-5}
     & &  & \thead{{\textbf{Equal}} \\ \textbf{variances} \\ \textbf{assumed}}
     & \thead{{\textbf{Equal}} \\ \textbf{variances not} \\ \textbf{assumed}}\\
\midrule

\multirow{3}{=}{Levene's Test for Equality of Variances}

    & F 
    & & 0.314 &   \\
    & Sig. & & 0.579 & \\

\midrule

\multirow{5}{=}{t-test for Equality of Means}


    & t
    & & 2.428 & 2.428   \\
    & df & & 38 & 34.886 \\
    & Sig. (2-tailed) &  & 0.579 & 0.64273\\
    & Mean Difference &  & 0.579 & 0.64273\\
    & Std. Error Difference &  & 0.579 & 0.64273\\
    & \multirow{1.2}{=}{95\% Confidence of Interval of the Difference}  &  Lower & 0.579 & 0.64273\\
    & &  Upper & 0.579 & 0.64273\\
\bottomrule

\end{tabularx}
\end{table}

\end{document} 
17
  • 1
    @Schrödinger'scat Sorry, I forget. Too rush. Thanks for reminding, edited done – aan Nov 10 '19 at 1:34
  • If nothing else helps, you could add an empty row, & & & & \\ before \bottomrule. On the other hand, you are loading makecell. Have you tried to use it for the two-row entry? – user194703 Nov 10 '19 at 1:35
  • 1
    @aan ... it adds some space that is 1.2 of the fontsize height (something close to it actually) See here : tex.stackexchange.com/q/8260/120578 – koleygr Nov 10 '19 at 1:44
  • 1
    Because I have seen so many examples where users rediscover bugs that have been solved ages ago. Overleaf uses a very old installation. Plus it "compresses" error messages. What I want to say is that if you are happy with it, that's fine, but I would never want to be at their mercy. – user194703 Nov 10 '19 at 1:47
  • 1
    No, by default it just does not give you the full error message. Let me stress that I never used overleaf myself but I had more than enough situations in which users uploaded codes with errors, and claimed that they did not get any message. I was told that overleaf suppresses error messages. Anyway, this code seems to be an example of something where the output of overleaf differs from the one you get on an updated TeX installation. What that means is that, once overleaf update their packages, you may get a different result. – user194703 Nov 10 '19 at 1:52
1

I'd do some redesign to avoid the large blank areas in the table. Probably the following suits your needs:

enter image description here

\documentclass[12pt,oneside]{book}

\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{hhline, boldline}
\usepackage{seqsplit, caption} %for table spacing to second row
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text
\usepackage{siunitx} %for table spacing to second row
\usepackage{threeparttable} %to add footnote below table
\usepackage{tabulary}
\usepackage{graphicx}

\begin{document}

\begin{table}[h!]
\centering
    \begin{tabularx}{\textwidth}{>{\quad}Xlrr}
    \toprule
     & & \multicolumn{2}{c}{\textbf{Cholestrrol Levellll}} \\
     \cmidrule{3-4}
       &  & \multicolumn{2}{c}{\thead{Equal variances}} \\ 
       &  & \thead{assumed} & \thead{not \\ assumed}\\
\midrule
\multicolumn{4}{@{}l}{Levene's Test for Equality of Variances}\\
     F    & & 0.314 &   \\
     Sig. & & 0.579 & \\
\midrule
\multicolumn{4}{@{}l}{t-test for Equality of Means}\\
     t  & & 2.428 & 2.428   \\
     df & & 38 & 34.886 \\
     Sig. (2-tailed) &  & 0.579 & 0.64273\\
     Mean Difference &  & 0.579 & 0.64273\\
     Std. Error Difference &  & 0.579 & 0.64273\\
     \multirow{2}{=}{95\% Confidence of Interval of the Difference}  &  Lower & 0.579 & 0.64273\\
     &  Upper & 0.579 & 0.64273\\
\bottomrule
\end{tabularx}
\end{table}

\end{document} 
2
  • thanks. Is very nicely table too. You using \multicolumn{4}{@{}l}{\textbf{t-test for Equality of Means}}. which is @{}l, can give more explanation in this? – aan Nov 10 '19 at 9:52
  • 1
    @aan: l to left align the text that is used inside of the \multicolumn command. @{} is used to remove the small horizontal space that is automatically added to the left and right of every table cell (this length is called \tabcolsep, default value is 6pt). If you prefer, you can of course also use \multicolumn{4}{l}{\textbf{t-test for Equality of Means}} instead. – leandriis Nov 10 '19 at 10:06

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.