如何在表格中间制作表格内容

如何在表格中间制作表格内容

我不擅长在 LaTex 中使用表格。我只是尝试重复使用一些表格格式。

如何让“圆圈”内容位于中间。我的表格看起来很奇怪。

[![在此处输入图片描述][1]][1]

\documentclass[12pt,oneside]{book}

\usepackage[showframe]{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}


\begin{document}


\begin{table}[h!]
% \setlength{\tabcolsep}{1.0em}
\centering

\begin{threeparttable} 
\sisetup{table-format=13.0, table-number-alignment=center, table-column-width=1.0cm}
 \begin{tabular}{lSS}
    %  \toprule
    % %   \addlinespace[1.2ex]
    %  \multirow{2.4}{*}{\textbf{Stimulus Number\tnote{a}}} & \multicolumn{2}{c}{\textbf{Classification Accuracy (\%)}}\\ 
     
     \toprule
     \textbf{Stimulus Number\tnote{a}} & \textbf{Classification Accuracy (\%)} \\ 
     
    %  \cmidrule{2-3}
    % &{\textbf{Accuracy}}
    %  & {\textbf{Inaccuracy}} \\
     \midrule
    Stimulus 1 (A21, B32; A11) &  68.42  \\
    Stimulus 2 (A2, B47; A1)  &   94.74 \\
    Stimulus 3 (A6, B40; B51)  &  84.21    \\


 \bottomrule
    \end{tabular}
    \footnotesize 
\begin{tablenotes}
\item[a] Stimulus Number (Class A Sample Numbers, Class B Sample Numbers; Reference X Sample Numbers)
\end{tablenotes}
    \end{threeparttable} 
\end{table}   


\end{document}

答案1

评论,添加于 2021-08-16:下面的答案回答了 OP 的问题就像最初问的那样。但与此同时,原帖作者似乎对查询进行了很大程度的修改,对于预期的答案产生不确定的影响。)

请注意,表格有 2 列,而不是 3 列。siunitx选项table-format=13.0不适用于第 2 列中的数据;应该是table-format=3.2。选项table-column-width=1.0cm似乎也不合适;我肯定会省略该选项。最后,我相信table-number-alignment=center也可以省略。

在此处输入图片描述

\documentclass[12pt,oneside]{book}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{siunitx} % for 'S' column type

\begin{document}

\begin{table}[h!]
\centering
\begin{threeparttable} 
\caption{Classification accuracy for \textit{Pilot Study}}
    \label{tab:Classification Accuracy_for_Pilot_Study}
    
\begin{tabular}{@{} l S[table-format=3.2] @{}}
    \toprule
    Stimulus Number\tnote{a} & {Classification Accuracy (\%)} \\ 
    \midrule
    Stimulus  1 (A21, B32; A11) &  68.42 \\
    Stimulus  2 (A2, B47; A1)   &  94.74 \\
    Stimulus  3 (A6, B40; B51)  &  84.21 \\
    Stimulus  4 (A5, B32; A4)   & 100.00 \\
    Stimulus  5 (A16, B49; B50) & 100.00 \\
    Stimulus  6 (A7, B36; B37)  &  84.21 \\
    Stimulus  7 (A20, B38; A21) & 100.00 \\ 
    Stimulus  8 (A29, B45; B46) & 100.00 \\
    Stimulus  9 (A24, B43; A26) & 100.00 \\
    Stimulus 10 (A11, B50; B51) &  94.74 \\ 
    Stimulus 11 (A8, B35; B36)  & 100.00 \\
    Stimulus 12 (A10, B42; B43) & 100.00 \\
    Stimulus 13 (A8, B32; A10)  & 100.00 \\
    Stimulus 14 (A18, B34; B35) &  89.47 \\ 
    Stimulus 15 (A3, B47; A23)  &  94.74 \\
    Stimulus 16 (A13,  B38; A14)&  84.21 \\
    Stimulus 17 (A18, B43; A21) &  68.42 \\
    Stimulus 18 (A7, B40; B42)  &  84.21 \\ 
    Stimulus 19 (A23, B47; A24) &  94.74 \\
    Stimulus 20 (A8, B55; B56)  &  89.47 \\
    \bottomrule
\end{tabular}
\footnotesize 
\begin{tablenotes}
\item[a] Stimulus Number (Class A Sample Numbers, Class B Sample Numbers; Reference X Sample Numbers)
\end{tablenotes}
\end{threeparttable} 
\end{table}   

\end{document}

答案2

在此处输入图片描述

\documentclass[12pt,oneside]{book}

\usepackage[showframe]{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}


\begin{document}


\begin{table}[h!]
% \setlength{\tabcolsep}{1.0em}
\centering
\caption{Classification accuracy for \textit{Pilot Study}}
    \label{tab:Classification Accuracy for Pilot Study}
    
\begin{threeparttable} 
\sisetup{table-format=13.0, table-number-alignment=center, table-column-width=1.0cm}
 \begin{tabular}{lSS}
 
     \toprule
     \textbf{Stimulus Number\tnote{a}} & \textbf{Classification Accuracy (\%)} \\ 
     

     \midrule
    Stimulus 1 (A21, B32; A11) &  68.42  \\
    Stimulus 2 (A2, B47; A1)  &   94.74 \\
    Stimulus 3 (A6, B40; B51)  &  84.21    \\
    Stimulus 4  (A5, B32; A4) &  100.00  \\
    Stimulus 5  (A16, B49; B50) & 100.00  \\
    Stimulus 6  (A7, B36; B37) & 84.21   \\
    Stimulus 7  (A20, B38; A21) & 100.00  \\ 
    Stimulus 8  (A29, B45; B46) & 100.00   \\
    Stimulus 9  (A24, B43; A26) & 100.00 \\
    Stimulus 10 (A11, B50; B51) & 94.74   \\ 
    Stimulus 11 (A8, B35; B36) & 100.00  \\
    Stimulus 12 (A10, B42; B43) & 100.00   \\
    Stimulus 13 (A8, B32; A10) & 100.00    \\
    Stimulus 14 (A18, B34; B35) & 89.47    \\ 
    Stimulus 15 (A3, B47; A23) & 94.74   \\
    Stimulus 16 (A13,  B38; A14) & 84.21    \\
    Stimulus 17 (A18, B43; A21)& 68.42    \\
    Stimulus 18 (A7, B40; B42) & 84.21    \\ 
    Stimulus 19 (A23, B47; A24) & 94.74      \\
    Stimulus 20 (A8, B55; B56) & 89.47     \\

 \bottomrule
    \end{tabular}
    \footnotesize 
\begin{tablenotes}
\item[a] Stimulus Number (Class A Sample Numbers, Class B Sample Numbers; Reference X Sample Numbers)
\end{tablenotes}
    \end{threeparttable} 
\end{table}   


\end{document}

相关内容