我想在列标签状态、输入和输出之间添加一些空间。现在它们非常接近,所以看起来不太好。我该怎么做才能添加一些空间?
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[colorlinks,citecolor=blue,linkcolor=blue,bookmarks=false,hypertexnames=true]{hyperref}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{rotating,booktabs,multirow}
\usepackage[T1]{fontenc}
\usepackage{fix-cm}
\setlength{\tabcolsep}{0.7pt}
\begin{table*}[t]
\centering
\begin{tabular}{c c c c c c c c}
\midrule
\multicolumn{3}{c}{} & \multicolumn{2}{c}{Freezed } &\multicolumn{2}{c}{Solid SF} \\
\cmidrule(r){4-7}
States & Inputs & Outputs & Length & Time & Length & Time \\
\cmidrule(r){1-4}\cmidrule(l){4-7}
\multirow{1}{*}{4096}& 2 & 2 & 21.47 & 63327.2 & 21.62 & 52520.84 \\
\midrule
\bottomrule
\end{tabular}
\caption{Averages of experiments}
\label{tab:t3}
\end{table*}
\end{document}
答案1
请勿修改\tabcolsep
%\setlength{\tabcolsep}{0.7pt}
空间这么小,就没有意义了。
答案2
大部分都是题外话(因为主要问题已经解决了赫伯特答案)然而我在表格的代码中看到更多问题。我想对其进行如下修改:
\documentclass[12pt]{article}
%\usepackage[utf8]{inputenc} % now id default
\usepackage[T1]{fontenc}
\usepackage{fix-cm}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{booktabs, multirow, rotating}
\usepackage[colorlinks,citecolor=blue,linkcolor=blue,bookmarks=false,hypertexnames=true]{hyperref} % had to be last in preamble
\begin{document}
\begin{table*}[t]
\centering
\begin{tabular}{c c c c c c c c}
\toprule
\multicolumn{3}{c}{} & \multicolumn{2}{c}{Freezed} & \multicolumn{2}{c}{Solid SF} \\
\cmidrule(r){4-5}\cmidrule(l){6-7}
States & Inputs & Outputs & Length & Time & Length & Time \\
\midrule
4096 & 2 & 2 & 21.47 & 63327.2 & 21.62 & 52520.84 \\
\bottomrule
\end{tabular}
\caption{Averages of experiments}
\label{tab:t3}
\end{table*}
\end{document}
如果您的表格有更多(很多)行,您应该考虑使用能够S
在小数点对齐数字的列类型:
...
\usepackage {siunitx}
...
\begin{document}
\begin{table*}[t]
\centering
\begin{tabular}{c cc S[table-format=2.2]
S[table-format=5.1]
S[table-format=2.2]
S[table-format=5.2]
}
\toprule
\multicolumn{3}{c}{} & \multicolumn{2}{c}{Freezed} & \multicolumn{2}{c}{Solid SF} \\
\cmidrule(r){4-5}\cmidrule(l){6-7} % changed
States & Inputs & Outputs & {Length} & {Time} & {Length} & {Time} \\
\midrule
4096 & 2 & 2 & 21.47 & 63327.2 & 21.62 & 52520.84 \\
\bottomrule
\end{tabular}