这是我的表格代码:
\begin{table}[h!]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
\textit{\textbf{l (m)}} & \textit{\textbf{$\overline{t}$$_{10}$}\:(s)}} & \textit{\textbf{$\Delta t_{10}\:(s)$}} & \textit{\textbf{$T\:(s)$}} & \textit{\textbf{$\Delta T\:(s)$}} & \textit{\textbf{$l^2$\:$(m^2)$}} & \textit{\textbf{$T^2\:(m\:s^2)$}} & \textit{\textbf{$\Delta T^2\:l\:(m\:s^2)$}} & \textit{\textbf{$\sigma \: (s)$}} \\ \hline
0.450 & 15.414 & 0.1739 & 1.541 & 0.01739 & 0.2025 & 1.069 & 0.02412 & 0.1168 \\ \hline
0.400 & 14.84 & 0.3927 & 1.483 & 0.03927 & 0.1600 & 0.8810 & 0.04661 & 0.1916 \\ \hline
0.350 & 14.75 & 0.6523 & 1.475 & 0.06523 & 0.1225 & 0.7613 & 0.06733 & 0.3522 \\ \hline
0.300 & 14.38 & 0.09190 & 1.437 & 0.009190 & 0.0900 & 0.6200 & 0.00793 & 0.0566 \\ \hline
0.250 & 14.18 & 0.5368 & 1.418 & 0.05368 & 0.0625 & 0.5029 & 0.03807 & 0.3006 \\ \hline
0.200 & 13.82 & 0.2223 & 1.381 & 0.02223 & 0.0400 & 0.3819 & 0.01229 & 0.1302 \\ \hline
-0.200 & 13.79 & 0.2098 & 1.379 & 0.02098 & -0.0400 & -0.3805 & -0.01157 & 0.1170 \\ \hline
-0.250 & 14.24 & 0.1223 & 1.424 & 0.01223 & -0.0625 & -0.5070 & -0.00870 & 0.07902 \\ \hline
-0.300 & 14.55 & 0.2556 & 1.455 & 0.02556 & -0.0900 & -0.6352 & -0.02231 & 0.1646 \\ \hline
-0.350 & 14.56 & 0.4752 & 1.456 & 0.04752 & -0.1225 & -0.7419 & -0.04843 & 0.2631 \\ \hline
-0.400 & 14.84 & 0.1492 & 1.484 & 0.01492 & -0.1600 & -0.8810 & -0.01771 & 0.08889 \\ \hline
-0.450 & 15.41 & 0.2191 & 1.541 & 0.02191 & -0.2025 & -1.069 & -0.03034 & 0.1271 \\ \hline
\end{tabular}
\end{table}
结果桌子就被弄得乱七八糟了。
答案1
- 我会将数字四舍五入,例如保留到小数点后四位
- 供表格使用
tblr
,规定所有列的宽度相等
\documentclass{article}
\usepackage{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}[h!]
\sisetup{round-integer-to-decimal,
round-mode=places,
round-precision = 4,
table-format= 1.4
}
\begin{tblr}{colspec = { *{9}{X[c, si]} @{}},
row{1} = {guard, mode=math},
row{2} = {guard, mode=text},
row{3-Z}= {rowsep=0pt},
row{odd[3-Z]} = {abovesep=1ex},
}
\toprule
l
& \bar{t}_{10}
& \Delta t_{10}
& T
& \Delta T
& l^2
& T^2
& \Delta T^2
& \sigma
\\
(\unit{\meter})
& (\unit{\second})
& (\unit{\second})
& (\unit{\second})
& (\unit{\second})
& (\unit{\meter\square\second})
& (\unit{\meter\square\second})
& (\unit{\meter\square\second})
& (\unit{\second})
\\
\midrule
0.450 & 15.414 & 0.1739 & 1.541 & 0.01739 & 0.2025 & 1.069 & 0.02412 & 0.1168 \\
0.400 & 14.84 & 0.3927 & 1.483 & 0.03927 & 0.1600 & 0.8810 & 0.04661 & 0.1916 \\
0.350 & 14.75 & 0.6523 & 1.475 & 0.06523 & 0.1225 & 0.7613 & 0.06733 & 0.3522 \\
0.300 & 14.38 & 0.09190 & 1.437 & 0.009190 & 0.0900 & 0.6200 & 0.00793 & 0.0566 \\
0.250 & 14.18 & 0.5368 & 1.418 & 0.05368 & 0.0625 & 0.5029 & 0.03807 & 0.3006 \\
0.200 & 13.82 & 0.2223 & 1.381 & 0.02223 & 0.0400 & 0.3819 & 0.01229 & 0.1302 \\
-0.200 & 13.79 & 0.2098 & 1.379 & 0.02098 & -0.0400 & -0.3805 & -0.01157 & 0.1170 \\
-0.250 & 14.24 & 0.1223 & 1.424 & 0.01223 & -0.0625 & -0.5070 & -0.00870 & 0.07902 \\
-0.300 & 14.55 & 0.2556 & 1.455 & 0.02556 & -0.0900 & -0.6352 & -0.02231 & 0.1646 \\
-0.350 & 14.56 & 0.4752 & 1.456 & 0.04752 & -0.1225 & -0.7419 & -0.04843 & 0.2631 \\
-0.400 & 14.84 & 0.1492 & 1.484 & 0.01492 & -0.1600 & -0.8810 & -0.01771 & 0.08889 \\
-0.450 & 15.41 & 0.2191 & 1.541 & 0.02191 & -0.2025 & -1.069 & -0.03034 & 0.1271 \\
\bottomrule
\end{tblr}
\end{table}
\end{document}
答案2
我建议您首先删除所有垂直规则和大多数水平规则。接下来,使用宏\toprule
、\midrule
、\addlinespace
和\bottomrule
代替\hline
,如下面的示例代码所示。永远不要忘记,空格在提供视觉分隔符方面与实线一样有效。
接下来,使用包的机制siunitx
(具体来说,是其S
列类型)将数字对齐到各自的小数点标记上。最后,为标题材料提供更多结构;我建议您在一行中列出变量,在第二行中列出它们的测量单位,然后使用宏\unit
(也是由siunitx
包提供的)根据印刷上完善的标准格式化单位。
现在桌子看上去是不是比以前不那么挤了?
\documentclass{article}
\usepackage{geometry} % set text block size parameters as appropriate
\usepackage{amsmath,array,booktabs,siunitx}
\newcolumntype{T}[1]{S[table-format=#1,group-digits=false]}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular}{@{} T{-1.3} T{2.3} T{1.4} T{1.3} T{1.5} T{-1.4} T{-1.4} T{-1.5} T{1.5} @{}}
\toprule
{$l$} & {$\bar{t}_{10}$} & {$\Delta t_{10}$} &
{$T$} & {$\Delta T$} & {$l^2$} &
{$T^2$} & {$\Delta T^2\,l$} & {$\sigma$}\\
{(\unit{\meter})} & {(\unit{\second})} &{(\unit{\second})} &
{(\unit{\second})} & {(\unit{\second})} & {(\unit{\meter\squared})} &
{(\unit{\second\squared})} & {(\unit{\meter\second\squared})} & {(\unit{\second})}\\
\midrule
0.450 & 15.414& 0.1739 & 1.541 & 0.01739 & 0.2025 & 1.069 & 0.02412 & 0.1168 \\
0.400 & 14.84 & 0.3927 & 1.483 & 0.03927 & 0.1600 & 0.8810 & 0.04661 & 0.1916 \\
0.350 & 14.75 & 0.6523 & 1.475 & 0.06523 & 0.1225 & 0.7613 & 0.06733 & 0.3522 \\
\addlinespace
0.300 & 14.38 & 0.0919 & 1.437 & 0.00919 & 0.0900 & 0.6200 & 0.00793 & 0.0566 \\
0.250 & 14.18 & 0.5368 & 1.418 & 0.05368 & 0.0625 & 0.5029 & 0.03807 & 0.3006 \\
0.200 & 13.82 & 0.2223 & 1.381 & 0.02223 & 0.0400 & 0.3819 & 0.01229 & 0.1302 \\
\addlinespace
-0.200 & 13.79 & 0.2098 & 1.379 & 0.02098 & -0.0400 & -0.3805 & -0.01157 & 0.1170 \\
-0.250 & 14.24 & 0.1223 & 1.424 & 0.01223 & -0.0625 & -0.5070 & -0.00870 & 0.07902\\
-0.300 & 14.55 & 0.2556 & 1.455 & 0.02556 & -0.0900 & -0.6352 & -0.02231 & 0.1646 \\
\addlinespace
-0.350 & 14.56 & 0.4752 & 1.456 & 0.04752 & -0.1225 & -0.7419 & -0.04843 & 0.2631 \\
-0.400 & 14.84 & 0.1492 & 1.484 & 0.01492 & -0.1600 & -0.8810 & -0.01771 & 0.08889\\
-0.450 & 15.41 & 0.2191 & 1.541 & 0.02191 & -0.2025 & -1.069 & -0.03034 & 0.1271 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}