如何制作多行中间?

如何制作多行中间?

我的表格下面的上下文圆Number不在中心。

我在用:\multirow{2}{*}{\textbf{Number}} & \multicolumn{3}{c}{\textbf{Accuracy (\%)}}\\

在此处输入图片描述

我的 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
\sisetup{table-format=2.2, table-number-alignment=center, table-column-width=2.0cm}
 \begin{tabular}{lSSS}
     \toprule
    %   \addlinespace[1.2ex]
     \multirow{2}{*}{\textbf{Number}} & \multicolumn{3}{c}{\textbf{Accuracy (\%)}}\\ 
     \cmidrule{2-4}
    &{\textbf{AA}}      & {\textbf{BB}}      & {\textbf{CC}}\\
     \midrule     
    Number & AA & BB & CC\\
        \bottomrule
    \end{tabular}
    \end{table}


\end{document}

答案1

我看到了两种解决方案:要么使用可选参数multirow来考虑添加的规则填充booktabs,要么通过反复试验,用第一个参数中的行数来作弊——现在您可以使用带有小数部分的行数。

\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
\sisetup{table-format=2.2, table-number-alignment=center, table-column-width=2.0cm}
 \begin{tabular}{lSSS}
     \toprule
     \multirow{2}{*}[-0.5\belowrulesep]{\textbf{Number}} & \multicolumn{3}{c}{\textbf{Accuracy (\%)}}\\
     \cmidrule{2-4}
    &{\textbf{AA}} & {\textbf{BB}} & {\textbf{CC}}\\
     \midrule
    Number & AA & BB & CC\\
        \bottomrule
    \end{tabular}
    \vskip 1cm
\sisetup{table-format=2.2, table-number-alignment=center, table-column-width=2.0cm}
 \begin{tabular}{lSSS}
     \toprule
     \multirow{2.25}{*}{\textbf{Number}} & \multicolumn{3}{c}{\textbf{Accuracy (\%)}}\\
     \cmidrule{2-4}
    &{\textbf{AA}} & {\textbf{BB}} & {\textbf{CC}}\\
     \midrule
    Number & AA & BB & CC\\
        \bottomrule
    \end{tabular}
    \end{table}

\end{document} 

在此处输入图片描述

相关内容