How can we draw a continuous vertical line using booktabs in table?
What is the simplest method to maximise the width of a table?
There are lots of methods, very confusing.
\documentclass{article}
\usepackage{makecell} % for bold in table using \small
\renewcommand\theadfont{\small} % for bold in table using \small
\usepackage{tabularx, ragged2e}
\usepackage{booktabs}
\begin{document}
\begin{table}[!ht]
\centering
\begin{tabularx}{\textwidth}{l>{\raggedright\arraybackslash}ccc|ccc}
\toprule
& \multicolumn{3}{c|}{\textbf{Paired Differences1}} & \multicolumn{3}{c}{\textbf{Paired Differences2}}\\
\cmidrule{2-7}
& \small {\textbf{Statistic}}
& \thead{\small {\textbf{df}}}
& \thead{\small {\textbf{Sig.}}}
& \small {\textbf{Statistic}}
& \thead{\small {\textbf{df}}}
& \thead{\small {\textbf{Sig.}}} \\
\midrule
Difference & 44.20 & 14.36 & 4.54 & .957 & 10 & .746\\
\bottomrule
\end{tabularx}
\caption{Testing Testing Testing%
\label{tab:test1234}%
}
\end{table}
\end{document}
Best Answer
Here is my suggestion. I have used
tabular*
in combination with@{\extracolsep{\fill}}
to make the table as wide as the textwidth and to evenly distribute the excess white space between the columns. I have also removed the vertical line and replaced the single\cmidrule
by two adjacent ones with a small white space inbetween. In order to clean up the code, I have also removed the repeated occurences ot\small
and\textbf
and instead added\bfseries
to\thedfont
: