如何绘制中间是空的表格

如何绘制中间是空的表格

我想要绘制如下的表格:

在此处输入图片描述

我正在努力如何使中间变成空白。

我的 MWE:

\documentclass[12pt,oneside]{book}

\usepackage[]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx,
            threeparttable, tabulary}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{siunitx} %for table spacing to second row
\usepackage{graphicx}

\usepackage[font=small,
            labelfont={bf,sf}, textfont={sf}, 
            justification=centering]{caption}

\begin{document}



\begin{table}[h!]
\centering
 \begin{tabular}{lcclcc}
     \toprule
     \multicolumn{2}{c}{\thead{Dataset}} & \multicolumn{2}{c}{\thead{Dataset2}}\\\\ 
     \cmidrule{2-3}
     & \thead{Number}
     & \thead{Values}\\
     \midrule

     \bottomrule
    \end{tabular}

\end{table}


\end{document}

答案1

像这样吗?

在此处输入图片描述

\documentclass{book}
\usepackage{booktabs,array}
\begin{document}

\begin{table}[h!]
\setlength\tabcolsep{0pt}
\centering
%% select suitable overall width (e.g., 0.8\textwidth) and column width (e.g., 1.5cm)
\begin{tabular*}{0.8\textwidth}{ @{\extracolsep{\fill}} *{4}{p{1.5cm}} }
\toprule
\multicolumn{2}{l}{Dataset 1} & \multicolumn{2}{l}{Dataset 2}\\
\cmidrule{1-2} \cmidrule{3-4}
Number & Values & Number & Values \\
\cmidrule{1-2} \cmidrule{3-4}
1 & 5 \\
2 & 4 \\
3 & 4 & 3 & 3.4 \\
\bottomrule
\end{tabular*}
\end{table}

\end{document}

答案2

这就是你想要的东西吗?

\documentclass[12pt,oneside]{book}

\usepackage[]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx,
            threeparttable, tabulary}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{siunitx} %for table spacing to second row
\usepackage{graphicx}

\usepackage[font=small,
            labelfont={bf,sf}, textfont={sf},
            justification=centering]{caption}

\begin{document}

\begin{table}[h!]
\centering\sffamily
 \begin{tabular}{llp{1em}ll}
     \toprule
     \multicolumn{2}{c}{\thead{Dataset1}} & & \multicolumn{2}{c}{\thead{Dataset2}}\\
     \cmidrule{1-2}\cmidrule{4-5}
      \thead{Number} & \thead{Values} & & \thead{Number} & \thead{Values} \\
     \cmidrule[\lightrulewidth]{1-2}\cmidrule[\lightrulewidth]{4-5}
3 & 4 & &3 & 3.4 \\
     \bottomrule
    \end{tabular}
\end{table}

\end{document} 

在此处输入图片描述

相关内容