对于与上下文半相关的表格,最佳做法是什么?我遇到的问题是,目前表格占用了我工作中的很大空间,但也是必需的。最佳做法是什么,既能使它们易于阅读,又能减少空间?
\begin{table}[!htb]
\centering
\caption{Accuracy of the different constellations}
\label{tab:nn_acc_const}
\begin{tabular}{rlllll}
\toprule
\multicolumn{1}{l}{} & Size & Const1 & Const2 & Const3 & Const4 \\ \midrule \multirow{4}{*}{\begin{tabular}[c]{@{}r@{}}Accuracy\\ Training\end{tabular}} & \SI{25}{\%} & 27.67 & 26.22 & 26.29 & 26.11 \\ & \SI{50}{\%} & 26.5 & 23.78 & 24.31 & 24.34 \\ & \SI{75}{\%} & 25.37 & 25.83 & 24.33 & 23.74 \\ & \SI{100}{\%} & 25.83 & 24.65 & 22.59 & 23.31 \\ \midrule
\multirow{4}{*}{\begin{tabular}[c]{@{}r@{}}Accuracy\\ Validation\end{tabular}} & \SI{25}{\%} & 18.2 & 18.84 & 18.27 & 21 \\ & \SI{50}{\%} & 17.86 & 22.32 & 18.34 & 19.27 \\ & \SI{75}{\%} & 20.07 & 20.99 & 18.8 & 20.96 \\ & \SI{100}{\%} & 21.06 & 21.22 & 18.2 & 19.56 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[]
\centering
\caption{Loss of the different constellations}
\label{tab:nn_loss_const}
\begin{tabular}{rlllll}
\toprule
\multicolumn{1}{l}{} & Size & Const1 & Const2 & Const3 & Const4 \\ \midrule
\multirow{4}{*}{\begin{tabular}[c]{@{}r@{}}Loss\\ Training\end{tabular}} & \SI{25}{\%} & 0.047 & 0.034 & 0.039 & 0.029 \\ & \SI{50}{\%} & 0.036 & 0.26 & 0.029 & 0.023 \\ & \SI{75}{\%} & 0.030 & 0.21 & 0.025 & 0.019 \\ & \SI{100}{\%} & 0.025 & 0.018 & 0.021 & 0.16 \\ \midrule
\multirow{4}{*}{\begin{tabular}[c]{@{}r@{}}Loss\\ Validation\end{tabular}} & \SI{25}{\%} & 0.2 & 0.14 & 0.17 & 0.12 \\ & \SI{50}{\%} & 0.15 & 0.1 & 0.12 & 0.09 \\ & \SI{75}{\%} & 0.12 & 0.088 & 0.1 & 0.077 \\ & \SI{100}{\%} & 0.1 & 0.075 & 0.086 & 0.066 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[]
\centering
\caption{Overview of \gls{EMG} and \gls{IMU} Accuracy per arm position}
\label{tab:nn_acc_pos}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{@{}lllllll@{}}
\toprule
\textit{} & IMU$_{train}$ & IMU$_{val}$ & EMG$_{train}$ & EMG$_{val}$ & Combined$_{train}$ & Combined$_{val}$ \\ \midrule
lower & 23.83 & 18.75 & x & x & 23.83 & 18.75 \\
middle & 26.33 & 20.19 & 28.46 & 16.85 & 22.89 & 18.99 \\
upper & 23.91 & 20.68 & 25.36 & 16.57 & 20.59 & 18.66 \\ \bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
\begin{table}[]
\centering
\caption{Overview of \gls{EMG} and \gls{IMU} Loss per arm position}
\label{tab:nn_loss_pos}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{@{}lllllll@{}}
\toprule
\textit{} & IMU$_{train}$ & IMU$_{val}$ & EMG$_{train}$ & EMG$_{val}$ & Combined$_{train}$ & Combined$_{val}$ \\ \midrule
lower & 0.025 & 0.105 & x & x & 0.025 & 0.105 \\
middle & 0.024 & 0.1 & 0.026 & 0.12 & 0.018 & 0.077 \\
upper & 0.018 & 0.07 & 0.019 & 0.08 & 0.013 & 0.054 \\ \bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
和
\begin{table}[]
\centering
\caption{Accuracy of size and speed limitations}
\label{tab:nn_acc_limits}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{@{}lllllll@{}}
\toprule
\textit{} & slow$_{train}$ & slow$_{val}$ & fast$_{train}$ & fast$_{val}$ & combined$_{train}$ & combined$_{val}$ \\ \midrule
5cm & 23.05 & 18.1 & 23.98 & 18.69 & 22.18 & 18.27 \\
10cm & 24.34 & 21.49 & 24.37 & 20.39 & 22.24 & 20.94 \\
combined & 21.59 & 18.56 & 21.72 & 18.29 & 20.63 & 18.94 \\ \bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
\begin{table}[]
\centering
\caption{Loss of size and speed limitations}
\label{tab:nn_loss_limits}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{@{}lllllll@{}}
\toprule
\textit{} & slow$_{train}$ & slow$_{val}$ & fast$_{train}$ & fast$_{val}$ & combined$_{train}$ & combined$_{val}$ \\ \midrule
5cm & 0.02 & 0.083 & 0.02 & 0.084 & 0.014 & 0.058 \\
10cm & 0.019 & 0.08 & 0.02 & 0.083 & 0.014 & 0.057 \\
combined & 0.014 & 0.057 & 0.014 & 0.058 & 0.01 & 0.041 \\ \bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
\begin{table}[]
\centering
\caption{Accuracy of the standard settings and the tuned settings for the \gls{RFC}}
\label{tab:compar_acc}
\begin{tabular}{@{}lll@{}}
\toprule
\textit{} & Standard settings & Tuned settings \\ \midrule
combined & 0.161 & 0.167 \\
IMU & 0.18 & 0.185 \\
EMG & 0.139 & 0.139 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[]
\centering
\caption{NeuroKit pipeline Accuracy comparison using \gls{RFC}}
\label{tab:compar_nk_acc_rfc}
\begin{tabular}{@{}llll@{}}
\toprule
\textit{} & \begin{tabular}[c]{@{}l@{}}Standard settings \\ normal pipeline\end{tabular} & \begin{tabular}[c]{@{}l@{}}Standard settings \\ NK pipeline\end{tabular} & \begin{tabular}[c]{@{}l@{}}Tuned settings \\ NK pipeline\end{tabular} \\ \midrule
combined & 0.161 & 0.204 & 0.197 \\
IMU & 0.18 & 0.252 & 0.255 \\
EMG & 0.139 & 0.115 & 0.111 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[]
\centering
\caption{NeuroKit pipeline Accuracy comparison using \gls{NN}}
\label{tab:compar_nk_acc_nn}
\begin{tabular}{@{}lllll@{}}
\toprule
\textbf{} & Standard$_{train}$ & Standard$_{test}$ & NK pipeline$_{train}$ & NK pipeline$_{test}$ \\ \midrule
combined & 20.63 & 18.94 & 23.68 & 21.82 \\
IMU & 22.92 & 20.28 & 29.75 & 26.86 \\
EMG & 22 & 17 & 17.32 & 15.89 \\ \bottomrule
\end{tabular}
\end{table}
答案1
什么是“最佳实践”取决于个人观点。例如,在您的 MWE 中,我将使用能够编写清晰简短代码的包:
\documentclass{article}
\usepackage[showframe, % in real document delete this option
vmargin=25mm]{geometry}
\renewcommand{\textfraction}{0.07}
\setcounter{totalnumber}{4}
%
\usepackage[skip=1ex,
font=small, labelfont=bf]{caption}
\usepackage{tabularray} % new
\UseTblrLibrary{booktabs, siunitx, varwidth} % new
\newcommand\gls[1]{\textcolor{cyan}{#1}}
\begin{document}
\begin{table}[ht]
\centering
\caption{Accuracy of the different constellations}
\label{tab:nn_acc_const}
\begin{tblr}{colspec = {@{} Q[r, wd=5em]
Q[c, si={table-format=3{\,\%}}]
*{4}{Q[c, si={table-format=2.2}]} @{}},
rowsep = 1pt,
measure = vbox}
\toprule
& {{{Size}}} & {{{Const$_1$}}} & {{{Const$_2$}}}
& {{{Const$_3$}}} & {{{Const$_4$}}} \\
\midrule
\SetCell[r=4]{r} Accuracy Training
& 25\,\% & 27.67 & 26.22 & 26.29 & 26.11 \\ & 50\,\% & 26.5 & 23.78 & 24.31 & 24.34 \\ & 75\,\% & 25.37 & 25.83 & 24.33 & 23.74 \\ & 100\,\% & 25.83 & 24.65 & 22.59 & 23.31 \\
\midrule
\SetCell[r=4]{r} Accuracy Validation
& 25\,\% & 18.2 & 18.84 & 18.27 & 21 \\ & 50\,\% & 17.86 & 22.32 & 18.34 & 19.27 \\ & 75\,\% & 20.07 & 20.99 & 18.8 & 20.96 \\ & 100\,\% & 21.06 & 21.22 & 18.2 & 19.56 \\
\bottomrule
\end{tblr}
\end{table}
\begin{table}[ht]
\centering
\caption{Loss of the different constellations}
\label{tab:nn_loss_const}
\begin{tblr}{colspec = {@{} Q[r, wd=5em]
Q[c, si={table-format=3{\,\%}}]
*{4}{Q[c, si={table-format=2.3}]} @{}},
rowsep = 1pt,
measure = vbox}
\toprule
& {{{Size}}} & {{{Const$_1$}}} & {{{Const$_2$}}}
& {{{Const$_3$}}} & {{{Const$_4$}}} \\
\midrule
\SetCell[r=4]{r} Loss Training
& 25\,\% & 0.047 & 0.034 & 0.039 & 0.029 \\ & 50\,\% & 0.036 & 0.26 & 0.029 & 0.023 \\ & 75\,\% & 0.030 & 0.21 & 0.025 & 0.019 \\ & 100\,\% & 0.025 & 0.018 & 0.021 & 0.16 \\
\midrule
\SetCell[r=4]{r} Loss Validation
& 25\,\% & 0.2 & 0.14 & 0.17 & 0.12 \\ & 50\,\% & 0.15 & 0.1 & 0.12 & 0.09 \\ & 75\,\% & 0.12 & 0.088 & 0.1 & 0.077 \\ & 100\,\% & 0.1 & 0.075 & 0.086 & 0.066 \\
\bottomrule
\end{tblr}
\end{table}
\begin{table}[ht]
\centering
\caption{Overview of \gls{EMG} and \gls{IMU} Accuracy per arm position}
\label{tab:nn_acc_pos}
\begin{tblr}{colspec = {@{} Q[r, wd=3em]
*{6}{Q[c, si={table-format=2.2}]} @{}},
colsep=3pt,
rowsep = 1pt,
measure = vbox}
\toprule
& {{{IMU\textsubscript{train}}}} & {{{IMU\textsubscript{val}}}}
& {{{EMG\textsubscript{train}}}} & {{{EMG\textsubscript{val}}}}
& {{{Combined\textsubscript{train}}}} & {{{Combined\textsubscript{val}}}} \\
\midrule
lower & 23.83 & 18.75 & {{{--}}} & {{{--}}} & 23.83 & 18.75 \\
middle & 26.33 & 20.19 & 28.46 & 16.85 & 22.89 & 18.99 \\
upper & 23.91 & 20.68 & 25.36 & 16.57 & 20.59 & 18.66 \\
\bottomrule
\end{tblr}
\end{table}
\begin{table}[ht]
\centering
\caption{Overview of \gls{EMG} and \gls{IMU} Loss per arm position}
\label{tab:nn_acc_pos}
\begin{tblr}{colspec = {@{} Q[r, wd=3em]
*{6}{Q[c, si={table-format=2.3}]} @{}},
rowsep = 1pt,
measure = vbox}
\toprule
& {{{IMU\textsubscript{train}}}} & {{{IMU\textsubscript{val}}}}
& {{{EMG\textsubscript{train}}}} & {{{EMG\textsubscript{val}}}}
& {{{Combined\textsubscript{train}}}} & {{{Combined\textsubscript{val}}}} \\
\midrule
lower & 0.025 & 0.105 & {{{--}}} & {{{--}}} & 0.025 & 0.105 \\
middle & 0.024 & 0.1 & 0.026 & 0.12 & 0.018 & 0.077 \\
upper & 0.018 & 0.07 & 0.019 & 0.08 & 0.013 & 0.054 \\
\bottomrule
\end{tblr}
\end{table}
\end{document}
答案2
先说一句:我没有资格宣布哪些与表格相关的格式做法可能是最好的。此外,我的建议不可避免地是基于个人观点的。尽管如此,我相信它们仍然有用。
当然,如果有两个结构非常相似的表 - 比如,一个是关于某个实体的“准确性”,另一个是关于“损失” - 我会subtable
在同一table
环境中为它们设置环境,并为整个表以及两个子表提供标题。
关于您的示例表格,有一件事立即引人注目,那就是您并没有竭尽全力提供丰富的视觉结构,尤其是在标题行中。这很不幸,因为如果您确实提供了一些有用的视觉结构,您的读者实际上会费心研究表格内容的可能性将大大提高。下面的代码提供了一些建议,希望这些建议能在这方面激发您自己的格式化工作。
最后说一句:如果提供足够的视觉结构和保持表格材料简短之间存在冲突,那么我肯定会倾向于追求前一个目标。
\documentclass{article} % or some other suitable document class
\usepackage[letterpaper,margin=2.5cm]{geometry} % set appropriate page parameters
\usepackage{booktabs,siunitx}
\providecommand\gls[1]{#1} % provide a dummy definition for "\gls"
\usepackage[skip=0.25\baselineskip]{subcaption} % <-- new instruction
\begin{document}
\begin{table}[!htbp]
\caption{Accuracy and loss of the four constellations}
\label{tab:nn_const}
\begin{subtable}{\textwidth}
\centering
\caption{Accuracy} \label{tab:nn_const_acc}
\begin{tabular}{@{} l *{4}{S[table-format=2.2]} @{}}
\toprule
Size & \multicolumn{4}{c@{}}{{Constellations}} \\
\cmidrule(l){2-5}
& {1} & {2} & {3} & {4} \\
\midrule
Training \\
\SI{25}{\%} & 27.67 & 26.22 & 26.29 & 26.11 \\
\SI{50}{\%} & 26.5 & 23.78 & 24.31 & 24.34 \\
\SI{75}{\%} & 25.37 & 25.83 & 24.33 & 23.74 \\
\SI{100}{\%} & 25.83 & 24.65 & 22.59 & 23.31 \\
\midrule
Validation \\
\SI{25}{\%} & 18.2 & 18.84 & 18.27 & 21 \\
\SI{50}{\%} & 17.86 & 22.32 & 18.34 & 19.27 \\
\SI{75}{\%} & 20.07 & 20.99 & 18.8 & 20.96 \\
\SI{100}{\%} & 21.06 & 21.22 & 18.2 & 19.56 \\
\bottomrule
\end{tabular}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\centering
\caption{Loss} \label{tab:nn_const_loss}
\begin{tabular}{@{} l *{4}{S[table-format=1.3]} @{}}
\toprule
Size & \multicolumn{4}{c@{}}{{Constellations}} \\
\cmidrule(l){2-5}
& {1} & {2} & {3} & {4} \\
\midrule
Training \\
\SI{25}{\%} & 0.047 & 0.034 & 0.039 & 0.029 \\ \SI{50}{\%} & 0.036 & 0.26 & 0.029 & 0.023 \\ \SI{75}{\%} & 0.030 & 0.21 & 0.025 & 0.019 \\ \SI{100}{\%} & 0.025 & 0.018 & 0.021 & 0.16 \\
\midrule
Validation \\
\SI{25}{\%} & 0.2 & 0.14 & 0.17 & 0.12 \\ \SI{50}{\%} & 0.15 & 0.1 & 0.12 & 0.09 \\ \SI{75}{\%} & 0.12 & 0.088 & 0.1 & 0.077 \\ \SI{100}{\%} & 0.1 & 0.075 & 0.086 & 0.066 \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\begin{table}[htbp!]
\caption{Accuracy and loss of \gls{EMG} and \gls{IMU}, per arm position}
\label{tab:nn_pos}
\begin{subtable}{\textwidth}
\centering
\caption{Accuracy} \label{tab:nn_pos_acc}
\begin{tabular}{@{} l *{6}{S[table-format=2.2]} @{}}
\toprule
& \multicolumn{2}{c}{IMU} & \multicolumn{2}{c}{EMG} & \multicolumn{2}{c@{}}{Combined} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
& {train} & {val} & {train} & {val} & {train} & {val} \\
\midrule
lower & 23.83 & 18.75 & {--} & {--} & 23.83 & 18.75 \\
middle & 26.33 & 20.19 & 28.46 & 16.85 & 22.89 & 18.99 \\
upper & 23.91 & 20.68 & 25.36 & 16.57 & 20.59 & 18.66 \\
\bottomrule
\end{tabular}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\centering
\caption{Loss} \label{tab:nn_pos_loss}
\begin{tabular}{@{} l *{6}{S[table-format=1.3]} @{}}
\toprule
& \multicolumn{2}{c}{IMU} & \multicolumn{2}{c}{EMG} & \multicolumn{2}{c@{}}{Combined} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
& {train} & {val} & {train} & {val} & {train} & {val} \\
\midrule
lower & 0.025 & 0.105 & {--} & {--} & 0.025 & 0.105 \\
middle & 0.024 & 0.1 & 0.026 & 0.12 & 0.018 & 0.077 \\
upper & 0.018 & 0.07 & 0.019 & 0.08 & 0.013 & 0.054 \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\end{document}