1

Follwing a question from making a small line gap in table

enter image description here

the words become

Std. Error Differ-
ence (%)

Can we make like:

Std. Error
Difference
(%)

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}
    \toprule
    & & & \multicolumn{2}{c}{\textbf{Bioengineering quizzers  }} \\
     \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.030 &   \\
    & Sig. & & 0.864 & \\
\midrule
\multirow{8}{=}{t-test for Equality of Means}
    & t
    & & 17.505 & 17.505   \\
    & df & & 18 & 17.750 \\
    & Sig. (2-tailed) &  & 0.000 & 0.000 \\
    & Mean Difference (\%) &  & 56.31 & 56.31 \\
    & Standard Error Difference (\%) &  & 3.22 & 3.22\\
    [+0.5ex]
    & \multirow{1.2}{=}{95\% Confidence of Interval of the Difference(\%)}  &  Lower  & 49.55 & 63.07\\
    & &  Upper& 63.07 & 63.07\\ 
    [+1.0ex]
\bottomrule

\end{tabularx}
\end{table}


\end{document}
aan
  • 2,663
  • 1
    How about replacing the second X by e.g. >{\raggedright\arraybackslash}X? (BTW, the meaning of the English word "meaning" is "Bedeutung", and "Meinung" translates to "opinion".;-) –  Nov 10 '19 at 02:18
  • @Schrödinger'scat Thanks. It works well which is \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}X>{\raggedright\arraybackslash}Xlrr}. I didnt know can added in like this. Are we able to make the number situated in the middle? Now is like hanging up more. – aan Nov 10 '19 at 02:21
  • Sorry, which number? –  Nov 10 '19 at 02:22
  • @Schrödinger'scat . The number 3.22 which is same row with Std. Error Difference (%) – aan Nov 10 '19 at 02:23

2 Answers2

2

I'd reduce the number of columns, making subheaders for the two parts of the table body:

\documentclass[12pt,oneside]{book}

\usepackage[pass,showframe]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}[!htp]
\centering
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}\hspace{\tabcolsep}}
  l@{}l
  S[table-format=2.3]
  S[table-format=2.3]
  @{\hspace{\tabcolsep}}
}
\toprule
\multicolumn{4}{c}{\textbf{Bioengineering quizzers}} \\
\midrule
&& \multicolumn{2}{c}{\textbf{Equal variances}} \\
\cmidrule{3-4}
&& {\textbf{assumed}} & {\textbf{not assumed}} \\
\midrule
\multicolumn{4}{l}{\textit{Levene's Test for Equality of Variances}} \\
F    && 0.030 & \\
Sig. && 0.864 & \\
\midrule
\multicolumn{4}{l}{\textit{t-test for Equality of Means}} \\
t                              && 17.505 & 17.505 \\
df                             && 18     & 17.750 \\
Sig. (2-tailed)                &&  0.000 &  0.000 \\
Mean Difference (\%)           && 56.31  & 56.31  \\
Standard Error Difference (\%) &&  3.22  &  3.22  \\
95\% CID (\%) & Lower           & 49.55  & 63.07  \\
              & Upper           & 63.07  & 63.07  \\ 
\midrule[\heavyrulewidth]
\multicolumn{4}{l}{\footnotesize 95\% CID: 95\% Confidence of Interval of the Difference}
\end{tabular*}
\end{table}

\end{document}

enter image description here

egreg
  • 1,121,712
1

This is too long for a comment. If you use makecell you can get rid of a lot of head ache.

\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{makecell}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text

\begin{document}

\begin{table}[h!]
\centering
    \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}X>{\raggedright\arraybackslash}Xlrr}
    \toprule
    & & & \multicolumn{2}{c}{\textbf{Bioengineering quizzers  }} \\
     \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.030 &   \\
    & Sig. & & 0.864 & \\
\midrule
\multirow{8}{=}{t-test for Equality of Means}
    & t
    & & 17.505 & 17.505   \\
    & df & & 18 & 17.750 \\
    & Sig. (2-tailed) &  & 0.000 & 0.000 \\
    & Mean Difference (\%) &  & 56.31 & 56.31 \\
    & \makecell[l]{Standard Error\\ Difference (\%)} &  & 3.22 & 3.22\\
    [+0.5ex]
    & \makecell[l]{95\% Confidence of\\ Interval of\\ the Difference(\%)}  &  
    \makecell[l]{Lower\\[0.6ex] Upper}  & \makecell[r]{49.55\\[0.6ex] 63.07} & 
    \makecell[r]{63.07\\[0.6ex] 63.07}\\
\bottomrule

\end{tabularx}
\end{table}
\end{document}

enter image description here

Please note that:

  • I made some guesses with regards to the numbers in the bottom right part. They can be easily rearranged.
  • Actually I would, if I was you, cook down the table heads (top right part of the table).
  • I made an effort in cooking down the preamble. Please consider using a more minimal preamble in your posts.

Here is a slightly different layout.

\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{makecell}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text

\begin{document}

\begin{table}[h!]
\centering
    \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}X>{\raggedright\arraybackslash}Xlrr}
    \toprule
    & & & \multicolumn{2}{c}{\textbf{Bioengineering quizzers}} \\
     \cmidrule{4-5}
     & & &\multicolumn{2}{c}{\textbf{Variances}}\\
     & & & \textbf{are equal} & \textbf{may differ}\\
\midrule
\multirow{3}{=}{Levene's Test for Equality of Variances}
    & F 
    & & 0.030 &   \\
    & Sig. & & 0.864 & \\
\midrule
\multirow{8}{=}{t-test for Equality of Means}
    & t
    & & 17.505 & 17.505   \\
    & df & & 18 & 17.750 \\
    & Sig. (2-tailed) &  & 0.000 & 0.000 \\
    & Mean Difference (\%) &  & 56.31 & 56.31 \\
    & \makecell[l]{Standard Error\\ Difference (\%)} &  & 3.22 & 3.22\\
    [+0.5ex]
    & \makecell[l]{95\% Confidence of\\ Interval of\\ the Difference(\%)}  &  
    \makecell[l]{Lower\\ {} \\ Upper}  & \makecell[r]{49.55\\ {} \\ 63.07} & 
    \makecell[r]{63.07\\ {} \\ 63.07}\\
\bottomrule

\end{tabularx}
\end{table}
\end{document}

enter image description here