2

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} 
aan
  • 2,663
  • 1
    @Schrödinger'scat Sorry, I forget. Too rush. Thanks for reminding, edited done – aan Nov 10 '19 at 01: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? –  Nov 10 '19 at 01:35
  • @Schrödinger'scat Thanks. I tried & & & & \\ have a very big gap. I am not sure how to use makecell and two-row entry. Could you give a simple example? – aan Nov 10 '19 at 01:37
  • Interesting. On my updated TeXLive 2019 installation I do not get a big gap. Do you have an up-to-date installation? (I compile with pdflatex, how do you compile?) –  Nov 10 '19 at 01:39
  • @Schrödinger'scat . thanks. I am using Overleaf. – aan Nov 10 '19 at 01:40
  • Try adding a [+1.4ex] or something just after the last \ (@Schrödinger'scat ... (S)He possibly using your approach in the original document and not the MWE...) – koleygr Nov 10 '19 at 01:41
  • @koleygr. It works. What does [+1.4ex] mean? adding in 1.4mm? – aan Nov 10 '19 at 01:42
  • OMG. Overleaf. [+1.4ex] means "add a space of 1.4ex. ex (and em) are so-called extensible units, they scale with the font size. –  Nov 10 '19 at 01:44
  • 1
    @aan ... it adds some space that is 1.2 of the fontsize height (something close to it actually) See here : https://tex.stackexchange.com/q/8260/120578 – koleygr Nov 10 '19 at 01:44
  • @Schrödinger'scat Oveleaf is easy to use without need compiler and can share it. Why you said OMG? – aan Nov 10 '19 at 01:45
  • @koleygr Thanks, the link is superb! – aan Nov 10 '19 at 01:46
  • Welcome @aan ... Happy TeXing... – koleygr Nov 10 '19 at 01:47
  • 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. –  Nov 10 '19 at 01:47
  • @Schrödinger'scat. Can you explain more the overleaf compresses error mesages meaning? Do you mean it combine a lot errors together? – aan Nov 10 '19 at 01:49
  • I'd actually recommend https://tex.stackexchange.com/a/4244/194703, where it is correctly stated that 1ex is the height of the letter x (and to the best of my knowledge not "1.2 of the fontsize height" @koleygr ...). –  Nov 10 '19 at 01:50
  • 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. –  Nov 10 '19 at 01:52
  • @Schrödinger'scat Thanks. I got your meaning. Can you have a look https://tex.stackexchange.com/questions/515762/avoid-a-words-being-break-unevenly-for-example-diff-erent if you have time? Another problem occured again, never ending – aan Nov 10 '19 at 02:15

1 Answers1

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} 
leandriis
  • 62,593
  • 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 09: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