如何让列标题相对于其下方的数字居中

如何让列标题相对于其下方的数字居中
\documentclass[12pt]{article}

\oddsidemargin 0.0in
\textwidth 6.5in
\headheight 0.0in
\topmargin 0.0in
\headsep 0.0in
\textheight 9.0in

\usepackage{rotating, graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{caption}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage[flushleft]{threeparttable}
\usepackage{array, booktabs, tabularx}
\usepackage{array}
\usepackage{tabulary}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{epsfig}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage[title,titletoc]{appendix}
\usepackage{subcaption}
\usepackage{placeins}
\usepackage{xurl}

\begin{document}

\begin{table}[htbp]
  \begin{footnotesize}
    \setcounter{table}{4}
    \let\cline\cmidrule
    \ \caption{ what do you know or not know support by google}
    \begin{center}
      \begin{minipage}{\textwidth}
        \begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}*{9}{c@{}}}
          \hline\hline
          & \multicolumn{6}{c}{} & \multicolumn{3}{c}{} & \multicolumn{6}{r}{ Who did you support in the 2020 consert?}\\[1.0ex]
          \hline\\
          & \multicolumn{2}{c}{idoooo 12345} & \multicolumn{2}{c}{liorrr 11111} & \multicolumn{2}{c}{Other}\\[1.0ex]
          \cline{2-3}\cline{4-5}\cline{6-7}\\
          & (1)  & (2) &  (3) & (4) &  (5) & (6) \\ [2ex]
          \hline \\ 
          \multicolumn{6}{l}{A: How do you feel about that?}\\[2.0ex]
          \hline \\
          & \ \emph{N} & \% & \ \emph{N} & \% & \ \emph{N} & \% \\[1.0ex]
          \ \ Not generous enough &  250   &    39.6  &  409 & 50.7 & 40 & 61.5 \\[1.0ex] 
          \ \ Welcome relief &    284  &  44.8 & 356   & 44.1 & 15 & 23.1 \\[1.0ex] 
          \ \ Too costly & 100   &   15.8 & 42 & 5.2 & 10 & 15.4 \\[1.0ex] 
          \ \ Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0 \\[1.0ex] 
          \hline \\
          \multicolumn{6}{l}{B: Who gets credit for that?}\\[2.0ex]
          \hline \\
          & \ \emph{N} & \% & \ \emph{N} & \% & \ \emph{N} & \% \\[1.0ex]
          \ \ idoooo 12345 &  507  &    80 & 134 & 16.6 & 27 & 41.5 \\[1.0ex] 
          \ \ me & 66 & 10.4 & 52 & 6.4 & 18 &27.7 \\[1.0ex]
          \ \ liorrr 11111 & 14 & 2.2 & 252 &31.2 & 7 & 10.8 \\[1ex]
          \ \ you & 47 & 7.4 & 369 & 45.7 & 13 & 20 \\[1ex]
          \ \ Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0\\[1ex]
          \hline\hline
        \end{tabular*}
        \vspace*{0.03cm}
        \\{\footnotesize{\textbf{Notes:} \emph{N} = Frequency, \% = Percent.\ When percentages are rounded to the nearest whole number.
      \end{minipage}
    \end{center}
    \label{tabMainMPC}
  \end{footnotesize}
\end{table}

\end{document}

在此处输入图片描述 在此处输入图片描述

答案1

在此处输入图片描述

\documentclass[12pt]{article}

\oddsidemargin 0.0in
\textwidth 6.5in
\headheight 0.0in
\topmargin 0.0in
\headsep 0.0in
\textheight 9.0in


\usepackage[flushleft]{threeparttable}
\usepackage{array, booktabs, tabularx}
\usepackage{siunitx}


\begin{document}

\begin{table}[htbp]
    \caption{ what do you know or not know support by google}
    \centering
        \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}*{6}{wc{4em}}@{}}
          \toprule
          \multicolumn{6}{r}{ Who did you support in the 2020 consert?}\\
          \midrule
          & \multicolumn{2}{c}{idoooo 12345} & \multicolumn{2}{c}{liorrr 11111} & \multicolumn{2}{c}{Other}\\
          \cmidrule(lr){2-3}\cmidrule(lr){4-5}\cmidrule(lr){6-7}
          & (1)  & (2) &  (3) & (4) &  (5) & (6) \\ 
          \midrule
          \multicolumn{6}{l}{A: How do you feel about that?}\\
          \midrule
          & \emph{N} & \% & \ \emph{N} & \% & \ \emph{N} & \% \\ \addlinespace
          Not generous enough &  250   &    39.6  &  409 & 50.7 & 40 & 61.5 \\ 
          Welcome relief &    284  &  44.8 & 356   & 44.1 & 15 & 23.1 \\
          Too costly & 100   &   15.8 & 42 & 5.2 & 10 & 15.4 \\
          Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0 \\
          \midrule
          \multicolumn{6}{l}{B: Who gets credit for that?}\\
          \midrule
          & \emph{N} & \% & \ \emph{N} & \% & \ \emph{N} & \% \\ \addlinespace
          idoooo 12345 &  507  &    80 & 134 & 16.6 & 27 & 41.5 \\ 
          me & 66 & 10.4 & 52 & 6.4 & 18 &27.7 \\
          liorrr 11111 & 14 & 2.2 & 252 &31.2 & 7 & 10.8 \\
          you & 47 & 7.4 & 369 & 45.7 & 13 & 20 \\
          Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0\\
          \bottomrule
        \end{tabular*}
        \smallskip
        
        {\footnotesize{\textbf{Notes:} \emph{N} = Frequency, \% = Percent.\ When percentages are rounded to the nearest whole number.}}
    \label{tabMainMPC}
\end{table}


\begin{table}[htbp]
\centering
\sisetup{table-column-width=2.75em}
   \begin{threeparttable}
    \caption{ what do you know or not know support by google}
        \begin{tabular}{l*{3}{S[table-format=3] S[table-format=3.1]}}
          \toprule
          \multicolumn{6}{r}{ Who did you support in the 2020 consert?}\\
          \midrule
          & \multicolumn{2}{c}{idoooo 12345} & \multicolumn{2}{c}{liorrr 11111} & \multicolumn{2}{c}{Other}\\
          \cmidrule(lr){2-3}\cmidrule(lr){4-5}\cmidrule(lr){6-7}
          & {(1)}  & {(2)} &  {(3)} & {(4)} &  {(5)} & {(6)} \\ 
          \midrule
          \multicolumn{6}{l}{A: How do you feel about that?}\\
          \midrule
          & {\emph{N}} & {\%} & {\emph{N}} & {\%} & {\emph{N}} & {\%} \\ \addlinespace
          Not generous enough &  250   &    39.6  &  409 & 50.7 & 40 & 61.5 \\ 
          Welcome relief &    284  &  44.8 & 356   & 44.1 & 15 & 23.1 \\
          Too costly & 100   &   15.8 & 42 & 5.2 & 10 & 15.4 \\
          Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0 \\
          \midrule
          \multicolumn{6}{l}{B: Who gets credit for that?}\\
          \midrule
          & {\emph{N}} & {\%} & {\emph{N}} & {\%} & {\emph{N}} & {\%} \\ \addlinespace
          idoooo 12345 &  507  &    80 & 134 & 16.6 & 27 & 41.5 \\ 
          me & 66 & 10.4 & 52 & 6.4 & 18 &27.7 \\
          liorrr 11111 & 14 & 2.2 & 252 &31.2 & 7 & 10.8 \\
          you & 47 & 7.4 & 369 & 45.7 & 13 & 20 \\
          Total & 634 & 100.0 & 807 & 100.0 & 65 & 100.0\\
          \bottomrule
        \end{tabular}
        \begin{tablenotes} \setlength\labelsep{0pt}
        \item[]\footnotesize{\textbf{Notes:} \emph{N} = Frequency, \% = Percent.\ When percentages are rounded to the nearest whole number.}
        \end{tablenotes}
        \end{threeparttable}
    \label{tabMainMPC}
\end{table}
\end{document}

相关内容